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
It is not possible have a nice fluent api to have both tags php and symfony. I could do something like BlogPostFactory::createOne(['tags' => ['php', 'symfony']]), but real world examples are much less naive :)
I think there could be several solutions to mitigate this problem:
make Factory::$attributeSet protected, and let the user deal with it "at his own risk"
create a new method Factory::mergeAttributes(array), but this may come at the cost of some complexity (should we "deeply" merge array, objects, factories, etc... ?
create a new method Factory::resolveAttribute(string) which could be used in some cases to access the state of a given attribute.
not sure what would be the best solution 🤔
The text was updated successfully, but these errors were encountered:
From time to time there is the need to "merge" properties.
Given the following code:
It is not possible have a nice fluent api to have both tags
php
andsymfony
. I could do something likeBlogPostFactory::createOne(['tags' => ['php', 'symfony']])
, but real world examples are much less naive :)Another example would be with a bitmask:
I think there could be several solutions to mitigate this problem:
Factory::$attributeSet
protected, and let the user deal with it "at his own risk"Factory::mergeAttributes(array)
, but this may come at the cost of some complexity (should we "deeply" merge array, objects, factories, etc... ?Factory::resolveAttribute(string)
which could be used in some cases to access the state of a given attribute.not sure what would be the best solution 🤔
The text was updated successfully, but these errors were encountered: