alice
alice copied to clipboard
Can't access nested reference property
The second however should work, but maybe
@self->city->postalCodeswill do?
Originally posted by @theofidry in https://github.com/nelmio/alice/issues/1019#issuecomment-678705589
I believe @self->city->postalCodes is a good solution, but it doesn't appear to work. Config is below and error output below that. Using hautelook/alice-bundle 2.11.0, nelmio/alice v3.11.0, and theofidry/alice-data-fixtures 1.6.0. As a workaround, I added method VendorUser::getOrganizationsTenant() which works, however, @self->organization->tenant is nicer.
App\Entity\Organization\Tenant:
tenant_organization_{1..5}:
__factory: { 'App\Entity\Organization\Tenant::create': [] }
name: <company()>
App\Entity\Organization\Vendor:
vendor_organization_{1..5}:
name: <company()>
tenant: '@tenant_organization_*'
App\Entity\User\VendorUser:
vendor_user_{1..15}:
organization: '@vendor_organization_*'
tenant: '@self->organization->tenant'
#tenant: '@self->organization->getTenant()'
#tenant: '@self->organizationsTenant'
firstName: '<firstName()>'
lastName: '<lastName()>'
username: '<username()>'
plainPassword: 'changeMe'
jobTitle: '<jobTitle()>'
email: '<email()>'
In TolerantFixtureDenormalizer.php line 62:
An error occurred while denormalizing the fixture "vendor_user_{1..15}" (App\Entity\User\VendorUser): Could not parse the token "@self->organization->tenant" (type: PROPERTY_REFERENCE_TYPE).
In ExpressionLanguageExceptionFactory.php line 47:
Could not parse the token "@self->organization->tenant" (type: PROPERTY_REFERENCE_TYPE).
hautelook:fixtures:load [-b|--bundle [BUNDLE]] [--no-bundles] [-m|--manager MANAGER] [--append] [--shard SHARD] [--purge-with-truncate]