News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Understanding Drupal's EntityFieldQuery
March 19, 2014 @ 10:02:16

On the SitePoint PHP blog there's a recent post that aims to help you understand the EntityFieldQuery class in the Drupal framework. The class lets you find entities based on properties, field values and other generic metadata.

When building complex web apps, you'll eventually have to interact with a database. To retrieve data in Drupal one can use the database abstraction layer provided, which requires some SQL knowledge to be used properly. From Drupal 7 EntityFieldQuery API is provided, which lets you fetch information about entities from Drupal without actually building SQL queries. In this article, let's see how we can use the EntityFieldQuery API to fetch data from Drupal and use it in our modules.

He starts by explaining a bit about the class and includes a bit of code showing how to create an instance of it. He then moves into the creation of a sample module that only locates an entity and relays the results back to the calling script. As a part of the example, he shows how to make the query to locate all "node" entity types and create a sidebar with links to each. He shows the addition of conditionals to the location call for properties, values and fields (as well as ordering the results).

0 comments voice your opinion now!
drupal entityfieldquery introduction tutorial

Link: http://www.sitepoint.com/understanding-drupals-entityfieldquery/

blog comments powered by Disqus

Similar Posts

Mike Willbanks' Blog: Integrating Gearman Into Zend Framework

Anthony Ferrara: Mediators - Programming With Anthony

PHPBuilder.com: Meet PRADO, the Component-based PHP Development Framework

Sameer Borate's Blog: Templating with Haml

Fabien Potencier's Blog: Create your own framework...on top of the Symfony2 Components (parts 3 & 4)


Community Events





Don't see your event here?
Let us know!


configure wordpress library unittest list api series threedevsandamaybe application community code install bugfix introduction language podcast interview laravel release developer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework