Skip to content

Commit 671c152

Browse files
committed
fix undefined variable
1 parent f2f6538 commit 671c152

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Doctrine/EntityFinderByPrimary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function getEntity(string $class): object
155155
$object = $this->getNullableEntity($class);
156156

157157
if (!$object) {
158-
throw new EntityNotFound($class, (string) $this->getParameterValue());
158+
throw new EntityNotFound($class, $this->getParameterValue());
159159
}
160160

161161
return $object;

src/Exceptions/EntityNotFound.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
class EntityNotFound extends BadRequestException
88
{
99

10-
public function __construct(string $class, string $identifier)
10+
public function __construct(string $class, string|int|null $identifier)
1111
{
12-
parent::__construct(sprintf('Entity %s(%s) not found', $class, $identifier), 404);
12+
parent::__construct(
13+
sprintf('Entity %s(%s) not found.', $class, $identifier === null ? 'null' : (string) $identifier),
14+
404
15+
);
1316
}
1417

1518
}

src/Traits/Application/LazyEntityGetter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ final protected function getEntity(string $class, string $parameterName = 'id',
124124
$object = $this->getNullableEntity($class, $parameterName, $checkParameters);
125125

126126
if (!$object) {
127-
throw new EntityNotFound($class, $id);
127+
throw new EntityNotFound($class, $this->getParameter($parameterName));
128128
}
129129

130130
return $object;

0 commit comments

Comments
 (0)