foundry
foundry copied to clipboard
`make:factory` fails when there is more than one level of embedded classes
When attempting to generate a factory for a class that has a protected property of Money\Money type, I get the following error:
In LegacyORMDefaultPropertiesGuesser.php line 73:
Property App\Entity\MyEntity::$price.currency does not exist
I'm using Foundry version 1.37.0.
This happens because $metadata->embeddedClasses contains a list that is too comprehensive (it lists not only child objects, but also deeper descendants).
A seemingly working fix is to add a simple check before the faulty line:
if (str_contains($fieldName, '.')) {
continue;
}
Hi @rimas-kudelis
would you mind adding a little bit more context, please? as least, how would look the minimal entity that makes the command break.
Thanks