Ejemplo n.º 1
0
 /**
  * Loads all autogenerated entries with given $parentId with optionally included history entries.
  *
  * @param mixed $parentId
  * @param boolean $includeHistory
  *
  * @return array
  */
 public function loadAutogeneratedEntries($parentId, $includeHistory = false)
 {
     /** @var $query \ezcQuerySelect */
     $query = $this->dbHandler->createSelectQuery();
     $query->select("*")->from($this->dbHandler->quoteTable("ezurlalias_ml"))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("parent"), $query->bindValue($parentId, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn("action_type"), $query->bindValue("eznode", null, \PDO::PARAM_STR)), $query->expr->eq($this->dbHandler->quoteColumn("is_alias"), $query->bindValue(0, null, \PDO::PARAM_INT))));
     if (!$includeHistory) {
         $query->where($query->expr->eq($this->dbHandler->quoteColumn("is_original"), $query->bindValue(1, null, \PDO::PARAM_INT)));
     }
     $statement = $query->prepare();
     $statement->execute();
     return $statement->fetchAll(\PDO::FETCH_ASSOC);
 }
Ejemplo n.º 2
0
 /**
  * Publishes the Type with $typeId from $sourceVersion to $targetVersion,
  * including its fields
  *
  * @param int $typeId
  * @param int $sourceVersion
  * @param int $targetVersion
  *
  * @return void
  */
 public function publishTypeAndFields($typeId, $sourceVersion, $targetVersion)
 {
     $query = $this->dbHandler->createUpdateQuery();
     $query->update($this->dbHandler->quoteTable('ezcontentclass'))->set($this->dbHandler->quoteColumn('version'), $query->bindValue($targetVersion, null, \PDO::PARAM_INT))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('id'), $query->bindValue($typeId, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn('version'), $query->bindValue($sourceVersion, null, \PDO::PARAM_INT))));
     $query->prepare()->execute();
     $query = $this->dbHandler->createUpdateQuery();
     $query->update($this->dbHandler->quoteTable('ezcontentclass_classgroup'))->set($this->dbHandler->quoteColumn('contentclass_version'), $query->bindValue($targetVersion, null, \PDO::PARAM_INT))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $query->bindValue($typeId, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn('contentclass_version'), $query->bindValue($sourceVersion, null, \PDO::PARAM_INT))));
     $query->prepare()->execute();
     $query = $this->dbHandler->createUpdateQuery();
     $query->update($this->dbHandler->quoteTable('ezcontentclass_attribute'))->set($this->dbHandler->quoteColumn('version'), $query->bindValue($targetVersion, null, \PDO::PARAM_INT))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $query->bindValue($typeId, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn('version'), $query->bindValue($sourceVersion, null, \PDO::PARAM_INT))));
     $query->prepare()->execute();
     $query = $this->dbHandler->createUpdateQuery();
     $query->update($this->dbHandler->quoteTable('ezcontentclass_name'))->set($this->dbHandler->quoteColumn('contentclass_version'), $query->bindValue($targetVersion, null, \PDO::PARAM_INT))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $query->bindValue($typeId, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn('contentclass_version'), $query->bindValue($sourceVersion, null, \PDO::PARAM_INT))));
     $query->prepare()->execute();
 }