/** * Returns searchable field mapping data * * @return array */ public function getSearchableFieldMapData() { $query = $this->dbHandler->createSelectQuery(); $query->select($this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass"), $this->dbHandler->quoteIdentifier("content_type_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("id", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_id")), $this->dbHandler->alias($this->dbHandler->quoteColumn("data_type_string", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_type_identifier")))->from($this->dbHandler->quoteTable("ezcontentclass_attribute"))->innerJoin($this->dbHandler->quoteTable("ezcontentclass"), $query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "ezcontentclass_attribute"), $this->dbHandler->quoteColumn("id", "ezcontentclass")))->where($query->expr->eq($this->dbHandler->quoteColumn("is_searchable", "ezcontentclass_attribute"), $query->bindValue(1, null, PDO::PARAM_INT))); $statement = $query->prepare($query); $statement->execute(); return $statement->fetchAll(\PDO::FETCH_ASSOC); }
/** * Get sorted arrays of content IDs, which should be returned * * @param Criterion $filter * @param array $sort * @param mixed $offset * @param mixed $limit * @param mixed $translations * * @return int[] */ protected function getContentInfoList( Criterion $filter, $sort, $offset, $limit, $translations ) { $query = $this->handler->createSelectQuery(); $query->selectDistinct( 'ezcontentobject.*', $this->handler->aliasedColumn( $query, 'main_node_id', 'main_tree' ) ); if ( $sort !== null ) { $this->sortClauseConverter->applySelect( $query, $sort ); } $query->from( $this->handler->quoteTable( 'ezcontentobject' ) )->innerJoin( 'ezcontentobject_version', 'ezcontentobject.id', 'ezcontentobject_version.contentobject_id' )->leftJoin( $this->handler->alias( $this->handler->quoteTable( 'ezcontentobject_tree' ), $this->handler->quoteIdentifier( 'main_tree' ) ), $query->expr->lAnd( $query->expr->eq( $this->handler->quoteColumn( "contentobject_id", "main_tree" ), $this->handler->quoteColumn( "id", "ezcontentobject" ) ), $query->expr->eq( $this->handler->quoteColumn( "main_node_id", "main_tree" ), $this->handler->quoteColumn( "node_id", "main_tree" ) ) ) ); if ( $sort !== null ) { $this->sortClauseConverter->applyJoin( $query, $sort ); } $query->where( $this->getQueryCondition( $filter, $query, $translations ) ); if ( $sort !== null ) { $this->sortClauseConverter->applyOrderBy( $query ); } $query->limit( $limit, $offset ); $statement = $query->prepare(); $statement->execute(); return $statement->fetchAll( \PDO::FETCH_ASSOC ); }
/** * Returns field mapping data * * Returns an associative array with ContentType and FieldDefinition identifiers as * first and second level keys respectively, and FieldDefinition ID as value. * * @return array */ public function getFieldMap() { $query = $this->dbHandler->createSelectQuery(); $query->select($this->dbHandler->alias($this->dbHandler->quoteColumn("id", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_id")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass"), $this->dbHandler->quoteIdentifier("type_identifier")))->from($this->dbHandler->quoteTable("ezcontentclass_attribute"))->innerJoin($this->dbHandler->quoteTable("ezcontentclass"), $query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "ezcontentclass_attribute"), $this->dbHandler->quoteColumn("id", "ezcontentclass"))); $statement = $query->prepare($query); $statement->execute(); $map = array(); $rows = $statement->fetchAll(\PDO::FETCH_ASSOC); foreach ($rows as $row) { $map[$row["type_identifier"]][$row["field_identifier"]] = $row["field_id"]; } return $map; }