warning: Creating default object from empty value in /home3/slyk/public_html/drupal6/modules/taxonomy/taxonomy.pages.inc on line 34.

Load Drupal Entity - more readable code (easy one-liner)

In my project (on Drupal 7) I'm using EntityFieldQuery alot to get some entities with given conditions, but working with resulting array of execute() function - is boring and makes code dirty IMHO. So I created helper class used only to load entities. Most of the time result is self describing one-liners instead of variables mess. I know it not covers all posibilities of EntityQuery, but 90% of my usage of it is loading Entities with some conditions. With the help of my class, loading one entity with conditions will be as simple as:

$country = (new EntityLoadQuery('country'))->propertyCondition('city_tid', 88)->loadSingle();

hook_field_validate() never called on custom entity

When I was creating own custom entity with custom field type in it I saw that myfield_field_validate() implementation of hook_field_validate() was never called. Documentation about this hook tells nothig about additional line of code for it to work...

Syndicate content