summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/EntityNotFoundException.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
committerpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
commitbf6655a534a6775d30cafa67bd801276bda1d98d (patch)
treec6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/orm/src/EntityNotFoundException.php
parent94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff)
downloadAppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/orm/src/EntityNotFoundException.php')
-rw-r--r--vendor/doctrine/orm/src/EntityNotFoundException.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/EntityNotFoundException.php b/vendor/doctrine/orm/src/EntityNotFoundException.php
new file mode 100644
index 0000000..142dc8a
--- /dev/null
+++ b/vendor/doctrine/orm/src/EntityNotFoundException.php
@@ -0,0 +1,46 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM;
6
7use Doctrine\ORM\Exception\ORMException;
8use RuntimeException;
9
10use function implode;
11use function sprintf;
12
13/**
14 * Exception thrown when a Proxy fails to retrieve an Entity result.
15 */
16class EntityNotFoundException extends RuntimeException implements ORMException
17{
18 /**
19 * Static constructor.
20 *
21 * @param string[] $id
22 */
23 public static function fromClassNameAndIdentifier(string $className, array $id): self
24 {
25 $ids = [];
26
27 foreach ($id as $key => $value) {
28 $ids[] = $key . '(' . $value . ')';
29 }
30
31 return new self(
32 'Entity of type \'' . $className . '\'' . ($ids ? ' for IDs ' . implode(', ', $ids) : '') . ' was not found',
33 );
34 }
35
36 /**
37 * Instance for which no identifier can be found
38 */
39 public static function noIdentifierFound(string $className): self
40 {
41 return new self(sprintf(
42 'Unable to find "%s" entity identifier associated with the UnitOfWork',
43 $className,
44 ));
45 }
46}