什么之间的差别Doctrine\Common\Persistence\ObjectManager
和Doctrine\ORM\EntityManager
自定义窗体类型使用的时候吗?
我可以用得到的程序存储库都$this->em->getRepository()
和$this->om->getRepository()
class MyFormType extends \Symfony\Component\Form\AbstractType
{
/**
* @var Doctrine\ORM\EntityManager
*/
protected $em;
public function __construct(Doctrine\ORM\EntityManager $em)
{
$this->em = $em;
}
}
代替:
class MyFormType extends \Symfony\Component\Form\AbstractType
{
/**
* @var Doctrine\Common\Persistence\ObjectManager
*/
protected $om;
public function __construct(Doctrine\Common\Persistence\ObjectManager $om)
{
$this->om = $om;
}
}