Skip to content

Instantly share code, notes, and snippets.

@dragoonis
Last active December 16, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragoonis/67133a2fe14c4e9010fb to your computer and use it in GitHub Desktop.
Save dragoonis/67133a2fe14c4e9010fb to your computer and use it in GitHub Desktop.
<?php
namespace TWGModule\Factory;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\FactoryInterface;
use TWG\PropertyService;
class PropertyServiceFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $sm)
{
$config = $sm->get('Config');
if(!isset($config['property_upload_path'])) {
throw new \Exception('Missing property_upload_path');
}
if(!isset($config['upload_path'])) {
throw new \Exception('Missing upload_path');
}
$uploadPath = $config['upload_path'];
$path = $config['property_upload_path'];
$svc = new PropertyService(
$sm->get('Doctrine\ORM\EntityManager'),
$sm->get('property.branch.service')
);
$svc->getImageService()->setUploadPath($uploadPath, $path);
return $svc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment