This topic contains 3 replies, has 2 voices, and was last updated by Mike Kudelya 7 years, 6 months ago.
- Topic
Hi all,
I have an issue which has me completely stumped. I have an extended entity which I added a field to via a migration:
123456789101112131415161718192021222324protected function createCentresContactsRelation(Schema $schema){$this->extendExtension->addManyToManyRelation($schema,'k8_centre', // owning side table'contacts', // owning side field name'orocrm_contact', // target side table["first_name", "last_name"], // column names are used to show a title of related entity["first_name", "last_name"], // column names are used to show detailed info about related entity["first_name", "last_name"], // Column names are used to show related entity in a grid[]);$this->extendExtension->addManyToManyInverseRelation($schema,'k8_centre', // owning side table'contacts', // owning side field name'orocrm_contact', // target side table'centres', // target side field name["first_name", "last_name"], // column names are used to show a title of related entity["first_name", "last_name"], // column names are used to show detailed info about related entity["first_name", "last_name"], // Column names are used to show related entity in a grid[]);}This is how the entity’s relations array now looks if use run oro:entity-config:debug:
123456789101112131415[relation] => Array([manyToMany|K8\Bundle\CentreBundle\Entity\Centre|OroCRM\Bundle\ContactBundle\Entity\Contact|contacts] => Array([target_field_id] => Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId Object([scope:Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId:private] => extend[className:Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId:private] => OroCRM\Bundle\ContactBundle\Entity\Contact[fieldName:Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId:private] => centres[fieldType:Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId:private] => manyToMany)))I am now trying to retrieve this relation in the datagrid:
123456789101112131415161718192021k8-centre-contacts-select-grid:extended_entity_name: %k8.centre.class%options:entityHint: centreacl_resource: k8_centre_viewsource:type: ormquery:select:- centre.contacts- contact.id- contact.firstName- contact.lastNamefrom:- { table: %k8.centre.class%, alias: centre }join:left:- { join: centre.contacts, alias: contact }where:and:- contact.id in centre.contactsBut I am receiving the following error:
An exception has been thrown during the rendering of a template (“No mapping found for field ‘contacts’ on class ‘K8\Bundle\CentreBundle\Entity\Centre’.”) in OroDataGridBundle:Grid/widget:widget.html.twig at line 11.
Where am I going wrong here? Thanks in advance!
Miles
The forum ‘OroPlatform’ is closed to new topics and replies.