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
Allow Entities and Array of Entities #43
Comments
Thinking about it again: For the moment, the Factory works with arrays of data, and I mentioned above calling But it might be more interesting to work with entities, and perform a The The If we achieve that, I pay a round of beers! |
The package now works with entities, and not with arrays (#54) This is pushed on dev. What is left to do is to allow the dev to feed the Factories with entities and arrays of entities. |
Note that the |
We are supporting now Entities and Array of Entities |
Thanks for the contribution, it fits the requirements.
You can have a look at the commit above, and let me know if this fits from your point of view. |
Ok, can we merge Pablo’s branch (https://github.com/vierge-noire/cakephp-fixture-factories/tree/%2343_allow_entities_and_array_of_entities) in the next version and move on ? |
Yes, true. We also have to port the implementation to the cake3_next branch. |
@pakacuda I have released a cake3 compatible implementation (simple cherry-pick). I'll merge both cake4 and cake3 implementations in the next- branches in a minute. |
This is done, I close the issue for now. Thanks for constructive work together. This is a really nice feature, probably the last before the v2.2 release. |
For the moment, the make method allows only arrays, callable, and int.
This should be extended to entity interfaces and arrays of entity interfaces.
Important is that when performing a
->toArray()
on an entity, hidden fields are not "rendered" in the array.So performing a
->toArray()
will not do, unless we call->setHidden([])
prior to the->toArray()
.If you take a look at the
Article.php
file, there is extra a hidden array to test that this case is covered. This should be covered by the tests and the implementation.I propose to create a new
TestCase\Factory\BaseFactoryMakeWithEntity.php
or so class with the tests covering this new feature.The text was updated successfully, but these errors were encountered: