Hello,
I’m trying to use the service container of symfony 2
i have a class that is a service: ResultManager under Bundle\Entity
in it’s constructor it recives to service objects:
[php]
public function indexAction(Request $request)
{…
if($form->isValid()){
$manager = $this->get(‘result_manager’);
}
[/php]
services.yml file inside my bundle
[php]
parameters:
result_manager.class: Proj\Bundle\Entity\ResultManager
map_service.class: Proj\Bundle\Entity\Map
locations_manager.class: Proj\Bundle\Entity\Locations
services:
map_service:
class: %map_service.class%
locations_manager:
class: %locations_manager.class%
result_manager:
class: %result_manager.class%
arguments: [@map_service, @locations_manager]
[/php]
the code that symfony 2 is creating under appDevDebugProjectContainer.php:
[php]
protected function getResultManagerService()
{
return $this->services[‘result_manager’] = new \Proj\Bundle\Entity\ResultManager($this->get(‘map_service’), $this->get(‘locations_manager’));
}
protected function getMapServiceService()
{
return $this->services[‘map_service’] = new \Huji\DominoBundle\Entity\ProteinProteinStructureMap();
}
[/php]
but for some reason i get an exception when trying to run:
DebugUniversalClassLoader.php
[php]
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file; //exception thrown!! no typos detected!
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
}
}
[/php]
please please help,
thank you
Roy