This topic contains 2 replies, has 2 voices, and was last updated by Frank 4 years, 8 months ago.
- Topic
Hi Oro-team,
is there a sustainable solution to query for a custom field of an entity, which was created using Oro’s EntitySerializedFieldsBundle?
I want to query for buOwner-property using the ShoppingListQueryBuilder():
123456789101112131415161718192021222324252627282930313233343536/*** Usage: Customer Users** @param AclHelper $aclHelper* @param bool $selectRelations* @param null|int $websiteId* æparam $buOwner* @return null|ShoppingList** @throws \Exception*/public function findAvailableForCustomerUser(AclHelper $aclHelper,$selectRelations = false,$websiteId = null,$buOwner = null){/** @var ShoppingList $shoppingList */$qb = $this->getShoppingListQueryBuilder($selectRelations);if ($websiteId) {$qb->andWhere($qb->expr()->eq('list.website', ':website'))->setParameter('website', $websiteId);}// This could not work!!!if($buOwner) {$qb->andWhere($qb->expr()->eq('serializedData', ':buOwner'))->setParameter('buOwner', $buOwner);}$qb->addOrderBy('list.id', 'DESC')->setMaxResults(1);return $aclHelper->apply($qb)->getOneOrNullResult();}#This could not work, of course.
– buOwner is a custom ShoppingList-entity-property, but I cannot query for it directly
– buOwner is a attribute of database field serialized_dataI can retrieve the serialized_data-string using myql-decoding like
– SELECT convert(FROM_BASE64(serialized_data) using UTF8)
and build a custom hardcoded query with it …However, I want to use on board tools.
Is there an easy way to adapt function findAvailableForCustomerUser() in such a manner,
that it is queriing buOwner-property correctly?Thanks a lot for help!
Kind regrads
Frank
The forum ‘OroPlatform’ is closed to new topics and replies.