本文整理汇总了PHP中Doctrine\ORM\EntityRepository::getFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityRepository::getFirst方法的具体用法?PHP EntityRepository::getFirst怎么用?PHP EntityRepository::getFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\EntityRepository
的用法示例。
在下文中一共展示了EntityRepository::getFirst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
/** @var Organization $organization */
$organization = $this->organizationRepository->getFirst();
$this->addReference('default_organization', $organization);
/** @var BusinessUnit $oroMain */
$oroMain = $this->businessUnitRepository->findOneBy(array('name' => 'Main'));
if (!$oroMain) {
$oroMain = $this->businessUnitRepository->findOneBy(array('name' => 'Acme, General'));
}
if (!$oroMain) {
throw new \Exception('"Main" business unit is not defined');
}
$oroMain->setName('Acme, General');
$oroMain->setEmail('general@acme.inc');
$oroMain->setPhone('798-682-5917');
$this->persistAndFlush($this->organizationManager, $oroMain);
$this->addReference('default_main_business', $oroMain);
/** @var BusinessUnit $oroUnit */
$oroUnit = new BusinessUnit();
/** @var BusinessUnit $mageCoreUnit */
$mageCoreUnit = new BusinessUnit();
$oroUnit->setName('Acme, West')->setWebsite('http://www.orocrm.com')->setOrganization($organization)->setEmail('west@acme.inc')->setPhone('798-682-5918')->setOwner($oroMain);
$this->persist($this->organizationManager, $oroUnit);
$this->addReference('default_crm_business', $oroUnit);
$mageCoreUnit->setName('Acme, East')->setWebsite('http://www.magecore.com/')->setOrganization($organization)->setEmail('east@acme.inc')->setPhone('798-682-5919')->setOwner($oroMain);
$this->persistAndFlush($this->organizationManager, $mageCoreUnit);
$this->addReference('default_core_business', $mageCoreUnit);
}