當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ORM\ORMInvalidArgumentException類代碼示例

本文整理匯總了PHP中Doctrine\ORM\ORMInvalidArgumentException的典型用法代碼示例。如果您正苦於以下問題:PHP ORMInvalidArgumentException類的具體用法?PHP ORMInvalidArgumentException怎麽用?PHP ORMInvalidArgumentException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ORMInvalidArgumentException類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: persist

 /**
  * {@inheritdoc}
  */
 public function persist($entity)
 {
     if (!is_object($entity)) {
         throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity);
     }
     $this->getUnitOfWork()->persist($entity);
 }
開發者ID:xamin123,項目名稱:platform,代碼行數:10,代碼來源:EntityManagerMock.php

示例2: merge

 /**
  * Merges the state of a detached entity into the persistence context
  * of this EntityManager and returns the managed copy of the entity.
  * The entity passed to merge will not become associated/managed with this EntityManager.
  *
  * @param object $entity The detached entity to merge into the persistence context.
  *
  * @return object The managed copy of the entity.
  *
  * @throws ORMInvalidArgumentException
  */
 public function merge($entity)
 {
     if (!is_object($entity)) {
         throw ORMInvalidArgumentException::invalidObject('EntityManager#merge()', $entity);
     }
     $this->errorIfClosed();
     return $this->unitOfWork->merge($entity);
 }
開發者ID:svobodni,項目名稱:web,代碼行數:19,代碼來源:EntityManager.php

示例3: isReadOnly

 /**
  * Is this entity read only?
  *
  * @param object $object
  *
  * @return bool
  *
  * @throws ORMInvalidArgumentException
  */
 public function isReadOnly($object)
 {
     if (!is_object($object)) {
         throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object);
     }
     return isset($this->readOnlyObjects[spl_object_hash($object)]);
 }
開發者ID:josercl,項目名稱:forum,代碼行數:16,代碼來源:UnitOfWork.php

示例4: processParameterValue

 /**
  * Processes an individual parameter value.
  *
  * @param mixed $value
  *
  * @return array
  *
  * @throws ORMInvalidArgumentException
  */
 public function processParameterValue($value)
 {
     if (is_array($value)) {
         foreach ($value as $key => $paramValue) {
             $paramValue = $this->processParameterValue($paramValue);
             $value[$key] = is_array($paramValue) ? reset($paramValue) : $paramValue;
         }
         return $value;
     }
     if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
         $value = $this->_em->getUnitOfWork()->getSingleIdentifierValue($value);
         if ($value === null) {
             throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
         }
     }
     return $value;
 }
開發者ID:nemekzg,項目名稱:doctrine2,代碼行數:26,代碼來源:AbstractQuery.php

示例5: toIdentifierArray

 /**
  * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata   The entity metadata.
  * @param mixed                               $identifier The entity identifier.
  *
  * @return array
  */
 private function toIdentifierArray(ClassMetadata $metadata, $identifier)
 {
     if (is_object($identifier) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($identifier))) {
         $identifier = $this->uow->getSingleIdentifierValue($identifier);
         if ($identifier === null) {
             throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
         }
     }
     return array($metadata->identifier[0] => $identifier);
 }
開發者ID:Dren-x,項目名稱:mobitnew,代碼行數:16,代碼來源:DefaultCache.php

示例6: inverseSideAdderThrowAdderOrmInvalidArgumentException

 /**
  * @param ORMInvalidArgumentException $exception
  * @throws ReportException
  */
 protected function inverseSideAdderThrowAdderOrmInvalidArgumentException(ORMInvalidArgumentException $exception)
 {
     $message = 'ORMInvalidArgumentException occured after calling ';
     $message .= $this->getInverseSideClassName() . '::' . $this->getInverseSideAdder() . '(), ';
     $message .= 'then ' . get_class($this->getManager()) . '::flush().';
     $errorReport = new ErrorReport($message);
     $errorReport->addError($exception->getMessage());
     $this->inverseSideAdderAddInverseSideEntityPersistError($errorReport);
     throw new ReportException($this->getReport(), $errorReport);
 }
開發者ID:steevanb,項目名稱:doctrine-mapping-validator,代碼行數:14,代碼來源:ValidateInverseSideAdderTrait.php


注:本文中的Doctrine\ORM\ORMInvalidArgumentException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。