Php -> operator
Can anyone tell me what the -> operator would be accessing/calling? in this context:
$qu开发者_开发知识库ery = db_select('date_formats', 'd')->extend('PagerDefault');
Is it assigning a class of PagerDefault to &query or accessing property or nested function or something? I'm just completely guessing. Thanks.
It executes the method extend
on the object returned by db_select
. For details on objects and an introduction, refer to the PHP manual.
You can also write it like this:
$query = db_select('date_formats', 'd');
$query->extend('PagerDefault');
First line assigns to $query
an object that is returned by db_select()
, the second one calls extend()
method on this object.
It calls the extend
method of the Drupal query object, in this case it's extending the query by adding paging functionality.
精彩评论