/usr/share/php/Doctrine/ORM/ORMException.php is in php-doctrine-orm 2.5.14+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | <?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM;
use Doctrine\Common\Cache\Cache as CacheDriver;
use Exception;
/**
* Base exception class for all ORM exceptions.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
class ORMException extends Exception
{
/**
* @return ORMException
*/
public static function missingMappingDriverImpl()
{
return new self("It's a requirement to specify a Metadata Driver and pass it ".
"to Doctrine\\ORM\\Configuration::setMetadataDriverImpl().");
}
/**
* @param string $queryName
*
* @return ORMException
*/
public static function namedQueryNotFound($queryName)
{
return new self('Could not find a named query by the name "' . $queryName . '"');
}
/**
* @param string $nativeQueryName
*
* @return ORMException
*/
public static function namedNativeQueryNotFound($nativeQueryName)
{
return new self('Could not find a named native query by the name "' . $nativeQueryName . '"');
}
/**
* @param object $entity
* @param object $relatedEntity
*
* @return ORMException
*/
public static function entityMissingForeignAssignedId($entity, $relatedEntity)
{
return new self(
"Entity of type " . get_class($entity) . " has identity through a foreign entity " . get_class($relatedEntity) . ", " .
"however this entity has no identity itself. You have to call EntityManager#persist() on the related entity " .
"and make sure that an identifier was generated before trying to persist '" . get_class($entity) . "'. In case " .
"of Post Insert ID Generation (such as MySQL Auto-Increment) this means you have to call " .
"EntityManager#flush() between both persist operations."
);
}
/**
* @param object $entity
* @param string $field
*
* @return ORMException
*/
public static function entityMissingAssignedIdForField($entity, $field)
{
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " .
"The identifier generation strategy for this entity requires the ID field to be populated before ".
"EntityManager#persist() is called. If you want automatically generated identifiers instead " .
"you need to adjust the metadata mapping accordingly."
);
}
/**
* @param string $field
*
* @return ORMException
*/
public static function unrecognizedField($field)
{
return new self("Unrecognized field: $field");
}
/**
*
* @param string $class
* @param string $association
* @param string $given
* @param string $expected
*
* @return \Doctrine\ORM\ORMInvalidArgumentException
*/
public static function unexpectedAssociationValue($class, $association, $given, $expected)
{
return new self(sprintf('Found entity of type %s on association %s#%s, but expecting %s', $given, $class, $association, $expected));
}
/**
* @param string $className
* @param string $field
*
* @return ORMException
*/
public static function invalidOrientation($className, $field)
{
return new self("Invalid order by orientation specified for " . $className . "#" . $field);
}
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidFlushMode($mode)
{
return new self("'$mode' is an invalid flush mode.");
}
/**
* @return ORMException
*/
public static function entityManagerClosed()
{
return new self("The EntityManager is closed.");
}
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidHydrationMode($mode)
{
return new self("'$mode' is an invalid hydration mode.");
}
/**
* @return ORMException
*/
public static function mismatchedEventManager()
{
return new self("Cannot use different EventManager instances for EntityManager and Connection.");
}
/**
* @param string $methodName
*
* @return ORMException
*/
public static function findByRequiresParameter($methodName)
{
return new self("You need to pass a parameter to '".$methodName."'");
}
/**
* @param string $entityName
* @param string $fieldName
* @param string $method
*
* @return ORMException
*/
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"
);
}
/**
* @param string $entityName
* @param string $associationFieldName
*
* @return ORMException
*/
public static function invalidFindByInverseAssociation($entityName, $associationFieldName)
{
return new self(
"You cannot search for the association field '".$entityName."#".$associationFieldName."', ".
"because it is the inverse side of an association. Find methods only work on owning side associations."
);
}
/**
* @return ORMException
*/
public static function invalidResultCacheDriver()
{
return new self("Invalid result cache driver; it must implement Doctrine\\Common\\Cache\\Cache.");
}
/**
* @return ORMException
*/
public static function notSupported()
{
return new self("This behaviour is (currently) not supported by Doctrine 2");
}
/**
* @return ORMException
*/
public static function queryCacheNotConfigured()
{
return new self('Query Cache is not configured.');
}
/**
* @return ORMException
*/
public static function metadataCacheNotConfigured()
{
return new self('Class Metadata Cache is not configured.');
}
/**
* @param \Doctrine\Common\Cache\Cache $cache
*
* @return ORMException
*/
public static function queryCacheUsesNonPersistentCache(CacheDriver $cache)
{
return new self('Query Cache uses a non-persistent cache driver, ' . get_class($cache) . '.');
}
/**
* @param \Doctrine\Common\Cache\Cache $cache
*
* @return ORMException
*/
public static function metadataCacheUsesNonPersistentCache(CacheDriver $cache)
{
return new self('Metadata Cache uses a non-persistent cache driver, ' . get_class($cache) . '.');
}
/**
* @return ORMException
*/
public static function proxyClassesAlwaysRegenerating()
{
return new self('Proxy Classes are always regenerating.');
}
/**
* @param string $entityNamespaceAlias
*
* @return ORMException
*/
public static function unknownEntityNamespace($entityNamespaceAlias)
{
return new self(
"Unknown Entity namespace alias '$entityNamespaceAlias'."
);
}
/**
* @param string $className
*
* @return ORMException
*/
public static function invalidEntityRepository($className)
{
return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository.");
}
/**
* @param string $className
* @param string $fieldName
*
* @return ORMException
*/
public static function missingIdentifierField($className, $fieldName)
{
return new self("The identifier $fieldName is missing for a query of " . $className);
}
/**
* @param string $className
* @param string $fieldName
*
* @return ORMException
*/
public static function unrecognizedIdentifierFields($className, $fieldNames)
{
return new self(
"Unrecognized identifier fields: '" . implode("', '", $fieldNames) . "' " .
"are not present on class '" . $className . "'."
);
}
/**
* @param string $functionName
*
* @return ORMException
*/
public static function overwriteInternalDQLFunctionNotAllowed($functionName)
{
return new self("It is not allowed to overwrite internal function '$functionName' in the DQL parser through user-defined functions.");
}
/**
* @return ORMException
*/
public static function cantUseInOperatorOnCompositeKeys()
{
return new self("Can't use IN operator on entities that have composite keys.");
}
}
|