我试图将实体经理注入这样的实体:
services.yml
somename:
class: A\B\AppBundle\Entity\Item
arguments: [ "@doctrine.orm.entity_manager" ]
Item.php
class Item
{
private $em;
public function __construct(EntityManager $entityManager)
{
$this->em = $entityManager;
var_dump(1);
exit;
}
}
它不起作用。它永远不会停在那个转储上。我做错了什么?