Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Allow non-entity asset variants #4198

Merged
merged 2 commits into from Feb 22, 2024

Conversation

bwaidelich
Copy link
Member

Allow implementations of the AssetVariantInterface to not be doctrine entities.

Without this fix, all AssetRepository::find*() calls lead to an exception when a class implements the interface but is not an entity (for example because it is just used to generate dummy images for Monocle).

Steps to reproduce

  1. Implement the interface with a new custom class like
final class DummyImageVariant implements AssetVariantInterface {
    // ...
}
  1. Trigger AssetRepository::find*() method, eg. by invoking ./ flow media:removeunused

Expected result

No error, the custom implementation should be ignored

Actual result

Exception:

Failure while fetching class schema class "Some\Package\DummyImageVariant": No class schema found for "Some\Package\DummyImageVariant".

  Type: Doctrine\ORM\Mapping\MappingException
  Code: 1542792708
  File: Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Persist
        ence_Doctrine_Mapping_Driver_FlowAnnotationDriver.php
  Line: 187

Allow implementations of the `AssetVariantInterface` to not be doctrine entities.

Without this fix, all `AssetRepository::find*()` calls lead to an exception when a class implements the interface
but is not an entity (for example because it is just used to generate dummy images for Monocle).

1. Implement the interface with a new custom class like

```php
final class DummyImageVariant implements AssetVariantInterface {
    // ...
}
```

2. Trigger `AssetRepository::find*()` method, eg. by invoking `./ flow media:removeunused`

No error, the custom implementation should be ignored

Exception:

```
Failure while fetching class schema class "Some\Package\DummyImageVariant": No class schema found for "Some\Package\DummyImageVariant".

  Type: Doctrine\ORM\Mapping\MappingException
  Code: 1542792708
  File: Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Persist
        ence_Doctrine_Mapping_Driver_FlowAnnotationDriver.php
  Line: 187
```
@mhsdesign mhsdesign force-pushed the bugfix/allow-non-entity-asset-variants branch from 530695d to e17fdca Compare February 8, 2024 19:02
@mhsdesign mhsdesign changed the base branch from 7.3 to 8.3 February 8, 2024 19:02
@github-actions github-actions bot added 8.3 and removed 7.3 labels Feb 8, 2024
@bwaidelich
Copy link
Member Author

bwaidelich commented Feb 22, 2024

Please don't merge, the fix no longer works with Neos 8.3

fixed again :)

The fix no longer worked with 8.3 due to some other changes, so it was adjusted
@mhsdesign mhsdesign merged commit 30b7afa into 8.3 Feb 22, 2024
9 checks passed
@mhsdesign mhsdesign deleted the bugfix/allow-non-entity-asset-variants branch February 22, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants