Interface craft\elements\db\ElementQueryInterface
- Extends
- ArrayAccess, Countable, IteratorAggregate, yii\base\Arrayable, yii\db\QueryInterface
- Implemented by
- craft\elements\db\AssetQuery, craft\elements\db\CategoryQuery, craft\elements\db\ElementQuery, craft\elements\db\EntryQuery, craft\elements\db\GlobalSetQuery, craft\elements\db\MatrixBlockQuery, craft\elements\db\TagQuery, craft\elements\db\UserQuery
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/elements/db/ElementQueryInterface.php
ElementQueryInterface defines the common interface to be implemented by element query classes.
The default implementation of this interface is provided by craft\elements\db\ElementQuery.
Method Details
all()
public abstract method
#
Executes the query and returns all results as an array.
public abstract craft\base\ElementInterface[] all ( $db = null )
$db |
yii\db\Connection, null | The database connection used to generate the SQL statement.
If this parameter is not given, the db application component will be used.
|
return | craft\base\ElementInterface[] | The resulting elements. |
---|
ancestorDist()
public abstract method
#
Sets the ancestorDist() property.
public abstract static ancestorDist ( \craft\elements\db\int $value = null )
$value |
integer, null | The property value |
return | static | Self reference |
---|
ancestorOf()
public abstract method
#
Sets the ancestorOf() property.
public abstract static ancestorOf ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
archived()
public abstract method
#
Sets the archived() property.
public abstract static archived ( \craft\elements\db\bool $value = true )
$value |
boolean | The property value (defaults to true) |
return | static | Self reference |
---|
asArray()
public abstract method
#
Sets the asArray() property.
public abstract static asArray ( \craft\elements\db\bool $value = true )
$value |
boolean | The property value (defaults to true) |
return | static | Self reference |
---|
dateCreated()
public abstract method
#
Sets the dateCreated() property.
public abstract static dateCreated ( $value )
$value |
mixed | The property value |
return | static | Self reference |
---|
dateUpdated()
public abstract method
#
Sets the dateUpdated() property.
public abstract static dateUpdated ( $value )
$value |
mixed | The property value |
return | static | Self reference |
---|
descendantDist()
public abstract method
#
Sets the descendantDist() property.
public abstract static descendantDist ( \craft\elements\db\int $value = null )
$value |
integer, null | The property value |
return | static | Self reference |
---|
descendantOf()
public abstract method
#
Sets the descendantOf() property.
public abstract static descendantOf ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
enabledForSite()
public abstract method
#
Sets the enabledForSite() property.
public abstract static enabledForSite ( \craft\elements\db\bool $value = true )
$value |
boolean | The property value (defaults to true) |
return | static | Self reference |
---|
fixedOrder()
public abstract method
#
Sets the fixedOrder() property.
public abstract static fixedOrder ( \craft\elements\db\bool $value = true )
$value |
boolean | The property value (defaults to true) |
return | static | Self reference |
---|
id()
public abstract method
#
Sets the id() property.
public abstract static id ( $value )
$value |
integer, integer[], false, null | The property value |
return | static | Self reference |
---|
ids()
public abstract method
#
Executes the query and returns the IDs of the resulting elements.
public abstract integer[] ids ( $db = null )
$db |
yii\db\Connection, null | The database connection used to generate the SQL statement.
If this parameter is not given, the db application component will be used.
|
return | integer[] | The resulting element IDs. An empty array is returned if no elements are found. |
---|
level()
public abstract method
#
Sets the level() property.
public abstract static level ( $value = null )
$value |
mixed | The property value |
return | static | Self reference |
---|
nextSiblingOf()
public abstract method
#
Sets the nextSiblingOf() property.
public abstract static nextSiblingOf ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
nth()
public abstract method
#
Executes the query and returns a single row of result at a given offset.
public abstract craft\base\ElementInterface, array, null nth ( \craft\elements\db\int $n, yii\db\Connection $db = null )
$n |
integer | The offset of the row to return. If offset() is set, $offset will be added to it. |
$db |
yii\db\Connection, null | The database connection used to generate the SQL statement.
If this parameter is not given, the db application component will be used.
|
return | craft\base\ElementInterface, array, null | The element or row of the query result. Null is returned if the query results in nothing. |
---|
one()
public abstract method
#
Executes the query and returns a single row of result.
public abstract craft\base\ElementInterface, array, null one ( $db = null )
$db |
yii\db\Connection | The database connection used to execute the query.
If this parameter is not given, the db application
component will be used.
|
return | craft\base\ElementInterface, array, null | The resulting element. Null is returned if the query results in nothing. |
---|
positionedAfter()
public abstract method
#
Sets the positionedAfter() property.
public abstract static positionedAfter ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
positionedBefore()
public abstract method
#
Sets the positionedBefore() property.
public abstract static positionedBefore ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
prevSiblingOf()
public abstract method
#
Sets the prevSiblingOf() property.
public abstract static prevSiblingOf ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
ref()
public abstract method
#
Sets the ref() property.
public abstract static ref ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
relatedTo()
public abstract method
#
Sets the relatedTo() property.
public abstract static relatedTo ( $value )
$value |
integer, array, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
search()
public abstract method
#
Sets the search() property.
public abstract static search ( $value )
$value |
string, array, craft\search\SearchQuery, null | The property value |
return | static | Self reference |
---|
siblingOf()
public abstract method
#
Sets the siblingOf() property.
public abstract static siblingOf ( $value )
$value |
integer, craft\base\ElementInterface, null | The property value |
return | static | Self reference |
---|
site()
public abstract method
#
Sets the siteId() property based on a given site(s)’s handle.
public abstract static site ( $value )
$value |
string, craft\models\Site | The property value |
return | static | Self reference |
---|
siteId()
public abstract method
#
Sets the siteId() property.
public abstract static siteId ( \craft\elements\db\int $value = null )
$value |
integer, null | The property value |
return | static | Self reference |
---|
slug()
public abstract method
#
Sets the slug() property.
public abstract static slug ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
status()
public abstract method
#
Sets the status() property.
public abstract static status ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
structureId()
public abstract method
#
Sets the structureId() property.
public abstract static structureId ( \craft\elements\db\int $value = null )
$value |
integer, null | The property value |
return | static | Self reference |
---|
title()
public abstract method
#
Sets the title() property.
public abstract static title ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
uid()
public abstract method
#
Sets the uid() property.
public abstract static uid ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
uri()
public abstract method
#
Sets the uri() property.
public abstract static uri ( $value )
$value |
string, string[], null | The property value |
return | static | Self reference |
---|
with()
public abstract method
#
Sets the with() property.
public abstract self with ( $value )
$value |
string, array, null | The property value |
return | self | The query object itself |
---|
withStructure()
public abstract method
#
Sets the withStructure() property.
public abstract static withStructure ( \craft\elements\db\bool $value = true )
$value |
boolean | The property value (defaults to true) |
return | static | Self reference |
---|