I'm trying to access to the service api.service.feedback
in fixture class below but for some reason container returns error below on if
statement in load()
method:
ERROR: PHP Fatal error: Call to a member function has() on a non-object
Note: If anyone wants to know, the service api.service.feedback
itself is accessible in all the controllers and has no problem with it.
<?php
namespace .........;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class LoadOrderFixtures extends AbstractFixture implements FixtureInterface, ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
private $container;
/**
* {@inheritDoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
if ($this->container->has('api.service.feedback')) {
exit('EXISTS');
}
}
......
}