This topic contains 4 replies, has 2 voices, and was last updated by archy_bold 8 years, 1 month ago.
- Topic
Hi there. I’m trying to create a select/create inline form type for contact addresses and I’ve mostly had some good success with it. However, I need the search to limit the results it gets on addresses for a particular contact. The issue I have it that no matter what I do, I can’t seem to get the information for the contact into the search index.
So here’s my search.yml:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253OroCRM\Bundle\ContactBundle\Entity\ContactAddress:alias: orocrm_contact_addresslabel: orocrm.contact_address.entity_plural_labelroute:name: orocrm_contact_index# parameters:# id: owner.idsearch_template: BundleName:searchResult.html.twigfields:-name: namePrefixtarget_type: texttarget_fields: [namePrefix]-name: firstNametarget_type: texttarget_fields: [firstName]-name: middleNametarget_type: texttarget_fields: [middleName]-name: lastNametarget_type: texttarget_fields: [lastName]-name: nameSuffixtarget_type: texttarget_fields: [nameSuffix]-name: labeltarget_type: texttarget_fields: [label]-name: streettarget_type: texttarget_fields: [street]-name: street2target_type: texttarget_fields: [street2]-name: postalCodetarget_type: texttarget_fields: [postalCode]-name: ownerrelation_type: many-to-onerelation_fields:-name: idtarget_type: integertarget_fields: [ownerId]My definition for the search handler:
123456789bundle_name.form.autocomplete.contact_address.search_handler:class: %bundle_name.form.autocomplete.contact_address.search_handler.class%parent: oro_form.autocomplete.search_handlerarguments:- OroCRM\Bundle\ContactBundle\Entity\ContactAddress- ["namePrefix", "firstName", "middleName", "lastName", "nameSuffix", "label", "street", "street2", "postalCode", "owner", "owner.id"]tags:- { name: oro_form.autocomplete.search_handler, alias: contact_addresses, acl_resource: orocrm_contact_view }lazy: trueWith owner.id in the property definition, I get an error:
PropertyAccessor requires a graph of objects or arrays to operate on, but it found type “NULL” while trying to traverse path “owner.id” at property “id”.
And without that column, I see an empty owner object:
1234567891011121314151617181920{results: [{id: 1,namePrefix: null,firstName: null,middleName: null,lastName: null,nameSuffix: null,label: "Mr John Johnson",street: "Some Stree",street2: null,postalCode: "PO CODE",owner: {__initializer__: { },__cloner__: { },__isInitialized__: false}}]Then in the search handler, I try to get the results as follows:
12$query = $this->indexer->getSimpleSearchQuery($searchTerm, $firstResult, $maxResults, $this->entitySearchAlias);$query->andWhere('owner.id', '=', $contactId, 'integer');I’m having no issues getting the contact ID from the form type to the search handler, the problem seems to be that the information I’m trying to limit on isn’t in the search index itself. Can anyone explain what I’m doing wrong?
Thanks,
Simon
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.