EntityQuery with fieldcondition of link field

by Estaa Shah   Last Updated August 14, 2019 10:07 AM

I have a field called field_url which is of type link. I want to query and fetch all those nodes which have field_url value like eg. www.google.com. I tried using the below code:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'websites')
  ->fieldCondition('field_url','value','%google%','like');
  $result = $query->execute();

I get database error with this. I saw the values stored in field_data_field_url table and they look like serialized. What is the correct way of doing this?

Tags : 7


Related Questions