2009-10-28 13:31:47 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\ORM;
|
|
|
|
|
2009-12-18 16:20:22 +03:00
|
|
|
/**
|
|
|
|
* Base exception class for all ORM exceptions.
|
|
|
|
*
|
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
|
|
|
* @since 2.0
|
|
|
|
*/
|
2009-10-28 13:31:47 +03:00
|
|
|
class ORMException extends \Exception
|
|
|
|
{
|
|
|
|
public static function entityMissingAssignedId($entity)
|
|
|
|
{
|
|
|
|
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID.");
|
|
|
|
}
|
2009-10-28 18:32:55 +03:00
|
|
|
|
|
|
|
public static function unrecognizedField($field)
|
|
|
|
{
|
|
|
|
return new self("Unrecognized field: $field");
|
|
|
|
}
|
2009-11-19 16:12:00 +03:00
|
|
|
|
|
|
|
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.");
|
|
|
|
}
|
2009-12-02 23:32:41 +03:00
|
|
|
|
|
|
|
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.");
|
|
|
|
}
|
2009-12-18 16:20:22 +03:00
|
|
|
|
|
|
|
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.");
|
|
|
|
}
|
2010-01-30 00:36:05 +03:00
|
|
|
|
|
|
|
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.");
|
|
|
|
}
|
2009-10-28 13:31:47 +03:00
|
|
|
}
|