Skip to content

Commit

Permalink
Fixing attribute mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Feb 6, 2024
1 parent 3d81ead commit b9a30b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/Mapping/Attribute/Crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
* @subpackage Annotation
*
* @author Adam Kadlec <adam.kadlec@ipublikuj.eu>
*
* @Annotation
* @Target({"PROPERTY"})
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Crud implements ORMMapping\MappingAttribute
Expand Down
10 changes: 7 additions & 3 deletions src/Mapping/EntityMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ public function fillEntity(Utils\ArrayHash $values, Entities\IEntity $entity, bo
$crud = $this->annotationReader->getPropertyAnnotation($propertyReflection, Mapping\Annotation\Crud::class);

if ($crud === null) {
/** @var Mapping\Attribute\Crud|null $crud */
$crud = $propertyReflection->getAttributes(Mapping\Attribute\Crud::class);
$attributes = $propertyReflection->getAttributes(Mapping\Attribute\Crud::class);

$crud = $attributes !== [] ? $attributes[0]->newInstance() : null;
}

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

if (!method_exists($ref, 'getDocComment')) {
if (
!method_exists($ref, 'getDocComment')
|| !is_string($ref->getDocComment())
) {
return null;
}

Expand Down

0 comments on commit b9a30b1

Please sign in to comment.