1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/lib/Doctrine/ORM/ORMException.php

71 lines
2.0 KiB
PHP

<?php
namespace Doctrine\ORM;
/**
* Base exception class for all ORM exceptions.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
class ORMException extends \Exception
{
public static function entityMissingAssignedId($entity)
{
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID.");
}
public static function unrecognizedField($field)
{
return new self("Unrecognized field: $field");
}
public static function removedEntityInCollectionDetected($entity, $assoc)
{
return new self("Removed entity of type " . get_class($entity)
. " detected in collection '" . $assoc->sourceFieldName . "' during flush."
. " Remove deleted entities from collections.");
}
public static function invalidEntityState($state)
{
return new self("Invalid entity state: $state.");
}
public static function detachedEntityCannotBeRemoved()
{
return new self("A detached entity can not be removed.");
}
public static function invalidFlushMode($mode)
{
return new self("'$mode' is an invalid flush mode.");
}
public static function entityManagerClosed()
{
return new self("The EntityManager is closed.");
}
public static function invalidHydrationMode($mode)
{
return new self("'$mode' is an invalid hydration mode.");
}
public static function mismatchedEventManager()
{
return new self("Cannot use different EventManager instances for EntityManager and Connection.");
}
public static function findByRequiresParameter($methodName) {
return new self("You need to pass a parameter to '".$methodName."'");
}
public static function invalidFindByCall($entityName, $fieldName, $method) {
return new self(
"Entity '".$entityName."' has no field '".$fieldName."'. ".
"You can therefore not call '".$method."' on the entities' repository"
);
}
}