-
-
Notifications
You must be signed in to change notification settings - Fork 228
FEATURE: Enable hierarchical asset collections #4160
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
base: 7.3
Are you sure you want to change the base?
Conversation
This allows assigning a parent to collections to enable the hierachy feature in the Flowpack.Media.UI.
@bwaidelich as discussed the hierarchy change for AssetCollections targeted at 7.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really happy about this approach and how little code it actually changes!
Just a couple of comments re circular dependencies and lazy loading
@bwaidelich thx for the check. Honestly it's a bit confusing what parts the persistence layer takes care of and which I have to implement myself with those relations 😔 |
When I check out this branch in a Neos 8.2 installation I get
o.O |
Related Media UI Change: Flowpack/media-ui#184 |
Wait why in 7.3 backwards? I am not totally against it, but introducing a feature (with a migration no less) is a bit sketchy? |
FYI: It was declared a "TASK". But I just changed that, because that is surely a feature. Something related I would like to discuss: I would suggest to target this for 8.3 or even 9.0. But we could try to extract an installable package with the required patches for Neos < 8 ? |
Thinking about it again, that's probably too much of a change no matter what.. Probably we can solve this via UX (e.g. offer both ways when moving an asset to a collection) – I'm not sure what the current state of the UI change is since I can't get it to compile currently |
Yes, that all sounds like a good suggestion, although migration might be a bit of a problem between a package and then later core, although if we name it the same version it could work? Also checking that it is in only one collection at a time seems sensible. I don't want to start a huge dicsussion but wonder about some cases this opens that seem "complicated". And I don't understand how nested collections are supposed to work internally. A collection has tags attached, how is that supposed to work with children? It seems counter intuitive that children do not inherit the tags? I probably missed a discussion about it but if those two were my choices, I still prefer making tags nestable (I know we reverted that) but collections really seems tricky? |
We wanted to have nesting possibilities for assets in the Media UI with Neos 7.3 support which was discussed with the Media UI sponsors and involved people. Targeting Neos 9.0 would be a huge problem as most users will not be on a Neos 9 version for quite a while. I have a AOP version of the folders in the Media UI folder branch currently, but this makes db migrations really hard. At least I don't know how I would prevent conflicts later. In the future I would handle tags in the Media UI in a different way than the Media browser. The connection between site and collection is unchanged and doesn't need a change IMO. We only need a new privilege for including child collections. And regarding one asset / collection. I'm making this configurable in the Media.UI as I heard good reasons for both usages currently and don't want to force either way right now. But I would define the single collection for each as default and enforce it via the Media UI API |
Yes right, I remember, sorry.. |
Doctrine unfortunately is nasty about that as it selects all defined properties of the objects it handles, so it will fail hard when the columns do not exist. I would still be kinda ok with doing this, I am pretty sure we had a couple of bugfix releaess with migrations before, but it definitely breaks if you don't migrate. Still feels like conceptually this is a bit "wobbly" with the tags and site connection, but if there is awareness of those points and it seems to work, fine for now I guess. |
I think I missed some discussions about this, but I have the feeling that we should collect some more input in order to come up with a unified model that suits the most. My personal preference would be one close to computer file systems because people will be familiar with it. Thinking out loud: And instead of connecting a site to an asset collection we could maybe use asset sources instead (i.e. more or less isolated DAMs). Disclaimer: This is just my personal feeling of the day and I don't really (have to) work with the media module on a daily basis. So it's perfectly possible that I'm missing some points. But I would love to discuss this once again and write down conclusions – and then derive next steps from it. maybe at the sprint? btw: I wonder why we need both, |
Yes this would be my favorite is well
This was mostly a shortcut to above, allowing people the freedom to express either flat or neste structures. I don't care either way, and don't need tags to be nestable, and understand that concept might not be for everyone (and might result in a change of naming as well), but the idea of a hierarchical structure that allows multiple assignment can make sense (see gmail labels - which by concept were adopted by other mail providers). But either way I am totally fine to split the hierarchy from the tags, I just feel collection isn't it yet. (And it could be interesting to consider multi assigning to "folders" as well - maybe a switchable option?)
Then we need to change the concept of assigning one collection to a site, as you certianly might want multiple sources that can be assignet to all or just one or a few sites in your installation, and we need to make it easy to have multiple "neos" sources, which I think currently is not possible?
Same, same 👍 |
I discussed the hierarchical thing, collections and tags with a bunch of people and currently the collections and tags are mostly used as a pseudo 2-level folder system. It's rare that they are used for anything else in my experience. Though I would love to implement multiple Neos sources in the not so far future. As it would solve several use cases especially with a multi site installation, access or when trying to separate data from imports etc.. But back to the topic. How do we proceed here? :) |
…collection hierarchy
5b50f26
to
e2c7825
Compare
@bwaidelich I removed the child operations but without the |
We need a way to get all direct (or maybe even all descendant) collections anyways, but I would suggest to do that in the repository: class AssetCollectionRepository {
public function findChildCollections(string $collectionId) {
// ...
}
public function findDescendantCollections(string $collectionId) {
// ...
}
} They might require a little DQL magic to be fast, but that should work in general. |
Hi @bwaidelich I adjusted the code to remove the children in the repo instead of letting doctrine do it via the annotation, the functional test is happy with the change. |
private function validateCircularHierarchy(): void | ||
{ | ||
$parent = $this->parent; | ||
$parents = [$parent]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you never change that variable, can that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think this is correct as we have a circle and the parent would always appear twice, except if there was a circle to begin with and we would attach to that circle.
But I will improve the code, error message and test labels
Co-authored-by: Bastian Waidelich <[email protected]>
8bd121d
to
3551a54
Compare
@bwaidelich I adjusted both migrations. |
$parent = $this->parent; | ||
while ($parent !== null) { | ||
$parent = $parent->getParent(); | ||
if ($parent === $this->parent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 by reading (apart from the last nitpick) and a quick test
But as discussed we should consider targetting 8.4
(once that exists) with the option to backport this feature via composer-patches or AOP
This allows assigning a parent to collections to enable the hierarchy feature in the Flowpack.Media.UI.
Upgrade instructions
Run
./flow doctrine:migrate
.Review instructions
The tests should cover the functionality.
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions