当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManager::getReference方法代码示例

本文整理汇总了PHP中Doctrine\ORM\EntityManager::getReference方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::getReference方法的具体用法?PHP EntityManager::getReference怎么用?PHP EntityManager::getReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\EntityManager的用法示例。


在下文中一共展示了EntityManager::getReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postFlush

 /**
  * @param PostFlushEventArgs $args
  */
 public function postFlush(PostFlushEventArgs $args)
 {
     if ($this->isInProgress) {
         return;
     }
     $this->initializeFromEventArgs($args);
     if (count($this->queued) > 0) {
         $toOutDate = [];
         foreach ($this->queued as $customerIdentity => $groupedByEntityUpdates) {
             foreach ($groupedByEntityUpdates as $data) {
                 /** @var Account $account */
                 $account = is_object($data['account']) ? $data['account'] : $this->em->getReference('OroCRMAccountBundle:Account', $data['account']);
                 /** @var Channel $channel */
                 $channel = is_object($data['channel']) ? $data['channel'] : $this->em->getReference('OroCRMChannelBundle:Channel', $data['channel']);
                 $entity = $this->createHistoryEntry($customerIdentity, $account, $channel);
                 $toOutDate[] = [$account, $channel, $entity];
                 $this->em->persist($entity);
             }
         }
         $this->isInProgress = true;
         $this->em->flush();
         foreach (array_chunk($toOutDate, self::MAX_UPDATE_CHUNK_SIZE) as $chunks) {
             $this->lifetimeRepo->massStatusUpdate($chunks);
         }
         $this->queued = [];
         $this->isInProgress = false;
     }
 }
开发者ID:hugeval,项目名称:crm,代码行数:31,代码来源:ChannelDoctrineListener.php

示例2: unpack

 /**
  * {@inheritdoc}
  */
 public function unpack($object)
 {
     if ($object instanceof ObjectSignature) {
         return $this->em->getReference($object->getClass(), $object->getIdentity());
     }
     return null;
 }
开发者ID:brick,项目名称:brick,代码行数:10,代码来源:DoctrineObjectPacker.php

示例3: fillChannelToEntity

 /**
  * @param Channel $channel
  * @param string  $entity
  *
  * @throws \Exception
  */
 protected function fillChannelToEntity(Channel $channel, $entity)
 {
     $interfaces = class_implements($entity) ?: [];
     if (!in_array('OroCRM\\Bundle\\ChannelBundle\\Model\\ChannelAwareInterface', $interfaces)) {
         return;
     }
     /** @var QueryBuilder $qb */
     $qb = $this->em->getRepository($entity)->createQueryBuilder('e');
     $iterator = new BufferedQueryResultIterator($qb);
     $writeCount = 0;
     $toWrite = [];
     try {
         $this->em->beginTransaction();
         /** @var ChannelAwareInterface $data */
         foreach ($iterator as $data) {
             $writeCount++;
             if (!$data->getDataChannel()) {
                 $channelReference = $this->em->getReference(ClassUtils::getClass($channel), $channel->getId());
                 $data->setDataChannel($channelReference);
                 $toWrite[] = $data;
             }
             if (0 === $writeCount % static::BATCH_SIZE) {
                 $this->write($toWrite);
                 $toWrite = [];
             }
         }
         if (count($toWrite) > 0) {
             $this->write($toWrite);
         }
         $this->em->commit();
     } catch (\Exception $exception) {
         $this->em->rollback();
         throw $exception;
     }
 }
开发者ID:dairdr,项目名称:crm,代码行数:41,代码来源:AbstractDefaultChannelDataFixture.php

示例4: excluir

 /**
  * @param $id
  * @return integer
  */
 public function excluir($id)
 {
     $entity = $this->em->getReference('Admin\\Domain\\Entity\\OtherEntity', (int) $id);
     $this->em->remove($entity);
     $this->em->flush();
     return (int) $id;
 }
开发者ID:rzorzal,项目名称:MyZend2Skeleton,代码行数:11,代码来源:OtherEntityService.php

示例5: addPushMessage

 /**
  * @param Notification $notification
  * @param int          $userId
  */
 protected function addPushMessage(Notification $notification, $userId)
 {
     $pushMessage = new PushMessage();
     $pushMessage->setNotification($notification);
     $pushMessage->setUser($this->entityManager->getReference(User::CLASS_NAME, $userId));
     $notification->addPushMessage($pushMessage);
 }
开发者ID:oriodesign,项目名称:tastd-backend-demo,代码行数:11,代码来源:NewTaggedUserNotificationFactory.php

示例6: getRegionReference

 /**
  * @param string $countryCode ISO2 code
  * @param string $code        region code
  *
  * @return null|Region
  */
 protected function getRegionReference($countryCode, $code)
 {
     if (null === $this->regionByCountryMap) {
         $this->regionByCountryMap = $this->loadRegionByCountryMap();
     }
     return isset($this->regionByCountryMap[$countryCode], $this->regionByCountryMap[$countryCode][$code]) ? $this->em->getReference('OroAddressBundle:Region', $this->regionByCountryMap[$countryCode][$code]) : null;
 }
开发者ID:antrampa,项目名称:crm,代码行数:13,代码来源:AbstractDemoFixture.php

示例7: deleteAction

 /**
  * @param Request $request
  * @return RedirectResponse
  * @throws \Doctrine\ORM\ORMException
  */
 public function deleteAction(Request $request)
 {
     $invoiceId = $request->get('invoiceId');
     $invoiceReference = $this->entityManager->getReference('Invoicity\\Business\\Entity\\Invoice', $invoiceId);
     $this->entityManager->remove($invoiceReference);
     $this->entityManager->flush();
     return new RedirectResponse($this->router->generate('invoicity_invoice_index'));
 }
开发者ID:wildewouter,项目名称:invoicity,代码行数:13,代码来源:InvoiceController.php

示例8: update

 public function update(array $data)
 {
     $entity = $this->em->getReference('Advocacia\\Entity\\Cadastro', $data['id']);
     $entity = Configurator::configure($entity, $data);
     $this->em->persist($entity);
     $this->em->flush();
     return $entity;
 }
开发者ID:Dturati,项目名称:advocacia,代码行数:8,代码来源:Cadastro.php

示例9: delete

	public function delete($id) {
		$cod_cli = $id;
		$entity = $this->em->getReference ( 'Pc_help\Entity\Cliente', $cod_cli );
		if ($entity) {
			$this->em->remove ( $entity );
			$this->em->flush ();
			return $id;
		}
	}
开发者ID:AgnaldoJaws,项目名称:teste.zf2,代码行数:9,代码来源:Cliente.php

示例10: delete

 public function delete($id)
 {
     $entity = $this->em->getReference($this->entity, $id);
     if ($entity) {
         $this->em->remove($entity);
         $this->em->flush();
         return $id;
     }
 }
开发者ID:rockmarquim,项目名称:zf2,代码行数:9,代码来源:AbstractService.php

示例11: insert

	public function insert(array $data) {
		$entity = new solucaoService ( $data );
		
		$problema = $this->em->getReference ( "Pc_help\Entity\Problema", $data ['id'] );
		
		$entity->setProblema ( $problema );
		$this->em->persist ( $entity );
		$this->em->flush ();
		return $entity;
	}
开发者ID:AgnaldoJaws,项目名称:teste.zf2,代码行数:10,代码来源:Solucao.php

示例12: insertMessage

 /**
  * Insert un message de team en base
  *
  * @param User      $user
  * @param integer   $teamId
  * @param string    $message
  *
  * @author Benjamin Levoir <ben@levoir.fr>
  */
 public function insertMessage(User $user, $teamId, $message)
 {
     $m = new \CoreBundle\Entity\TeamMessage();
     $m->setContent($message);
     $m->setSender($this->em->getReference('CoreBundle:User', $user->getId()));
     $m->setTeam($this->em->getReference('CoreBundle:Team', $teamId));
     $this->em->persist($m);
     $this->em->flush();
     return $this;
 }
开发者ID:blevoir,项目名称:teamlol,代码行数:19,代码来源:TeamMessageService.php

示例13: addPushMessage

 /**
  * @param Notification $notification
  * @param int          $userId
  */
 protected function addPushMessage(Notification $notification, $userId)
 {
     if ($this->frequencyFilter->filter($userId)) {
         return;
     }
     $this->frequencyFilter->addPushedUser($userId);
     $pushMessage = new PushMessage();
     $pushMessage->setNotification($notification);
     $pushMessage->setUser($this->entityManager->getReference(User::CLASS_NAME, $userId));
     $notification->addPushMessage($pushMessage);
 }
开发者ID:oriodesign,项目名称:tastd-backend-demo,代码行数:15,代码来源:LeaderWishNotificationFactory.php

示例14: insert

	public function insert(array $data) {
		$maquina = new clienteService ( $data );
		
		$cliente = $this->em->getReference ( "Pc_help\Entity\Cliente", $data ['id'] );
		
		$maquina->setCliente ( $cliente );
		
		$this->em->persist ( $maquina );
		$this->em->flush ();
		return $maquina;
	}
开发者ID:AgnaldoJaws,项目名称:teste.zf2,代码行数:11,代码来源:Maquina.php

示例15: update

	public function update(array $data) {
		// find
		// da set automaticamnete
		$entity = $this->em->getReference ( 'Pc_help\Entity\Problema', $data ['id'] );
		$entity = Configurator::configure ( $entity, $data );
		
		$this->em->persist ( $entity );
		$this->em->flush ();
		
		return $entity;
	}
开发者ID:AgnaldoJaws,项目名称:teste.zf2,代码行数:11,代码来源:Problema.php


注:本文中的Doctrine\ORM\EntityManager::getReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。