/** * @inheritdoc */ public static function find() { return parent::find()->where(['type' => static::CMS_TYPE]); }
/** * @inheritdoc */ public static function find() { /** @var RelationModel $instance */ $instance = new static(); $query = parent::find(); return $query; }
/** * @inheritdoc */ public static function find() { $instance = new static(); $query = parent::find()->select("{$instance::tableName()}.*"); foreach ($instance->_relations as $key => $relation) { $joinType = isset($relation['joinType']) ? $relation['joinType'] : 'leftJoin'; if (isset($relation['table'])) { $relationTable = $instance->{$relation['table']}->tableName(); } else { $relationTable = $instance::tableName(); } $table = $instance->{$key}->tableName(); if (is_array($relation['on'])) { $on = []; foreach ($relation['on'] as $k => $fk) { $on[] = "{$table}.{$k} = {$relationTable}.{$fk}"; } $on = implode(' AND ', $on); } else { $on = $relation['on']; } $params = isset($relation['params']) ? $relation['params'] : []; $query->{$joinType}($table, $on, $params)->addSelect("{$table}.*"); } return $query; }
public static function find() { return parent::find()->where(['role' => static::ROLE_USER]); }