I wrote simple Service which is using EntityManagerInterface and it's working but when I try in similar way add UserInterface I get:
AutowiringFailedException Cannot autowire service "AppBundle\Service\Pricer": argument "$user" of method "__construct()" references interface "Symfony\Component\Security\Core\User\UserInterface" but no such service exists. It cannot be auto-registered because it is from a different root namespace.
My code is:
namespace AppBundle\Service;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
class Pricer
{
private $em;
private $user;
public function __construct(EntityManagerInterface $em, UserInterface $user)
{
$this->em = $em;
$this->user = $user;
}
}
It's working when I have only EntityManagerInterface as argument (I can get Repository and make some find queries). Where is my mistake?