本文整理汇总了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);
}
示例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);
}
示例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)]);
}
示例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;
}
示例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);
}
示例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);
}