Skip to content

Commit b9a30b1

Browse files
committed
Fixing attribute mapper
1 parent 3d81ead commit b9a30b1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Mapping/Attribute/Crud.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
* @subpackage Annotation
2626
*
2727
* @author Adam Kadlec <adam.kadlec@ipublikuj.eu>
28-
*
29-
* @Annotation
30-
* @Target({"PROPERTY"})
3128
*/
3229
#[Attribute(Attribute::TARGET_PROPERTY)]
3330
final class Crud implements ORMMapping\MappingAttribute

src/Mapping/EntityMapper.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ public function fillEntity(Utils\ArrayHash $values, Entities\IEntity $entity, bo
120120
$crud = $this->annotationReader->getPropertyAnnotation($propertyReflection, Mapping\Annotation\Crud::class);
121121

122122
if ($crud === null) {
123-
/** @var Mapping\Attribute\Crud|null $crud */
124-
$crud = $propertyReflection->getAttributes(Mapping\Attribute\Crud::class);
123+
$attributes = $propertyReflection->getAttributes(Mapping\Attribute\Crud::class);
124+
125+
$crud = $attributes !== [] ? $attributes[0]->newInstance() : null;
125126
}
126127

127128
if ($crud !== null) {
@@ -442,7 +443,10 @@ private function parseAnnotation(Reflector $ref, string $name): ?string
442443
{
443444
$factory = phpDocumentor\Reflection\DocBlockFactory::createInstance();
444445

445-
if (!method_exists($ref, 'getDocComment')) {
446+
if (
447+
!method_exists($ref, 'getDocComment')
448+
|| !is_string($ref->getDocComment())
449+
) {
446450
return null;
447451
}
448452

0 commit comments

Comments
 (0)