Skip to content

Commit

Permalink
Bug fix: all properties after the first one that is ignored are also …
Browse files Browse the repository at this point in the history
…considered as ignored.
  • Loading branch information
gassan authored and DamienHarper committed Jun 27, 2024
1 parent 9568bbc commit 2ef5b5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ private function getEntityConfiguration(ClassMetadata $metadata): ?array

private function getAllProperties(ReflectionClass $reflection): array
{
$annotationProperty = null;
$properties = [];

foreach ($reflection->getProperties() as $property) {
$annotationProperty = null;
$attributes = $property->getAttributes(Ignore::class);
if (\is_array($attributes) && [] !== $attributes) {
$annotationProperty = $attributes[0]->newInstance();
Expand Down
1 change: 1 addition & 0 deletions tests/Provider/Doctrine/DoctrineProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public function testLoadEntitiesWithAttributesOnly(): void
self::assertFalse($provider->isAuditedField(AuditedEntityWithAttribute::class, 'ignoredField'), 'Field "'.AuditedEntityWithAttribute::class.'::$ignoredField" is ignored.');
self::assertFalse($provider->isAuditedField(AuditedEntityWithAttribute::class, 'ignoredProtectedField'), 'Field "'.AuditedEntityWithAttribute::class.'::$ignoredProtectedField" is ignored.');
self::assertFalse($provider->isAuditedField(AuditedEntityWithAttribute::class, 'ignoredPrivateField'), 'Field "'.AuditedEntityWithAttribute::class.'::$ignoredPrivateField" is ignored.');
self::assertTrue($provider->isAuditedField(AuditedEntityWithAttribute::class, 'id'), 'Field "'.AuditedEntityWithAttribute::class.'::$id" is audited.');
}

#[Depends('testIsAuditedHonorsEnabledFlag')]
Expand Down

0 comments on commit 2ef5b5f

Please sign in to comment.