Browse files

enable services

  • Loading branch information...
1 parent 7caaaa8 commit 23d707be09f49d1b75d6adfd20f6fc3462ddf589 pcarminatti committed Jan 18, 2013
View
35 module/Application/Module.php
@@ -3,9 +3,17 @@
namespace Application;
use Zend\Mvc\ModuleRouteListener;
+use Zend\EventManager\EventInterface;
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+use Zend\ModuleManager\Feature\ConfigProviderInterface;
+use Zend\ModuleManager\Feature\ServiceProviderInterface;
-class Module
+class Module implements
+ AutoloaderProviderInterface,
+ ConfigProviderInterface,
+ ServiceProviderInterface
{
+
public function onBootstrap($e)
{
$e->getApplication()->getServiceManager()->get('translator');
@@ -44,4 +52,29 @@ public function getAutoloaderConfig()
),
);
}
+
+ public function getServiceConfig()
+ {
+ return array(
+ /**
+ * Factories
+ */
+ 'factories' => array(
+ 'Application\Service\ProjectService' => function($serviceManager) {
+ $projectMapper = $serviceManager->get('Application\Mapper\ProjectMapperInterface');
+ return new Service\ProjectService($projectMapper);
+ },
+ 'Application\Service\TaskService' => function($serviceManager) {
+ $taskMapper = $serviceManager->get('Application\Mapper\TaskMapperInterface');
+ return new Service\TaskService($taskMapper);
+ },
+ ),
+ /**
+ * Abstract factories
+ */
+ 'abstract_factories' => array(
+ 'Application\ServiceFactory\MapperAbstractFactory'
+ )
+ );
+ }
}
View
3 module/Application/config/doctrine/orm/Application.Entity.Project.dcm.xml
@@ -4,7 +4,8 @@
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
- <entity name="Application\Entity\Project" table="projects">
+ <entity name="Application\Entity\Project" table="projects"
+ repository-class="Application\Repository\ProjectRepository">
<id name="id" type="integer">
<generator strategy="AUTO" />
</id>
View
3 module/Application/config/doctrine/orm/Application.Entity.Task.dcm.xml
@@ -4,7 +4,8 @@
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
- <entity name="Application\Entity\Task" table="tasks">
+ <entity name="Application\Entity\Task" table="tasks"
+ repository-class="Application\Repository\TaskRepository">
<id name="id" type="integer">
<generator strategy="AUTO" />

0 comments on commit 23d707b

Please sign in to comment.