当前位置: 首页>>代码示例>>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;未经允许,请勿转载。