You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I find() a product, attempting to contain its counterpart and its own containments, I don't get both sets of contained information. I'm assuming this is because the contained joins use the same aliases. I tried to overwrite the aliases for each individual contain, but it didn't work. My first attempt was the most obvious:
Description
Say I have a join table where I map products to products, for example two counterparts of each other. (Please assume it makes sense.)
Then I want to select a pair of products out of that table. Each product belongsTo category, and finally each category belongsTo store.
In the join table where the product pairs are, I can define the association twice:
But when I
find()
a product, attempting to contain its counterpart and its own containments, I don't get both sets of contained information. I'm assuming this is because the contained joins use the same aliases. I tried to overwrite the aliases for each individual contain, but it didn't work. My first attempt was the most obvious:That resulted in The alias association is not defined. I tried a few more and then finally found a complete list of all accepted options:
cakephp/src/ORM/EagerLoader.php
Lines 53 to 65 in 27ef3b0
Unless I'm missing something, there doesn't seem to be a way to manually set an alias for an individual contain?
CakePHP Version
4.4.14
PHP Version
8.3.1
The text was updated successfully, but these errors were encountered: