Ejemplo n.º 1
0
 /**
  * Inserts the given UrlWildcard
  *
  * @param \eZ\Publish\SPI\Persistence\Content\UrlWildcard $urlWildcard
  *
  * @return mixed
  */
 public function insertUrlWildcard(UrlWildcard $urlWildcard)
 {
     /** @var $query \ezcQueryInsert */
     $query = $this->dbHandler->createInsertQuery();
     $query->insertInto($this->dbHandler->quoteTable("ezurlwildcard"))->set($this->dbHandler->quoteColumn("destination_url"), $query->bindValue(trim($urlWildcard->destinationUrl, "/ "), null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn("id"), $this->dbHandler->getAutoIncrementValue("ezurlwildcard", "id"))->set($this->dbHandler->quoteColumn("source_url"), $query->bindValue(trim($urlWildcard->sourceUrl, "/ "), null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn("type"), $query->bindValue($urlWildcard->forward ? 1 : 2, null, \PDO::PARAM_INT));
     $query->prepare()->execute();
     return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName("ezurlwildcard", "id"));
 }
Ejemplo n.º 2
0
 /**
  * Inserts object state group translations into database
  *
  * @param \eZ\Publish\SPI\Persistence\Content\ObjectState\Group $objectStateGroup
  */
 protected function insertObjectStateGroupTranslations(Group $objectStateGroup)
 {
     foreach ($objectStateGroup->languageCodes as $languageCode) {
         $languageId = $this->maskGenerator->generateLanguageIndicator($languageCode, $languageCode === $objectStateGroup->defaultLanguage);
         $query = $this->dbHandler->createInsertQuery();
         $query->insertInto($this->dbHandler->quoteTable('ezcobj_state_group_language'))->set($this->dbHandler->quoteColumn('contentobject_state_group_id'), $query->bindValue($objectStateGroup->id, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('description'), $query->bindValue($objectStateGroup->description[$languageCode]))->set($this->dbHandler->quoteColumn('name'), $query->bindValue($objectStateGroup->name[$languageCode]))->set($this->dbHandler->quoteColumn('language_id'), $query->bindValue($languageId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('real_language_id'), $query->bindValue($languageId & ~1, null, \PDO::PARAM_INT));
         $query->prepare()->execute();
     }
 }
Ejemplo n.º 3
0
 /**
  * Assigns role to user with given limitation
  *
  * @param mixed $contentId
  * @param mixed $roleId
  * @param array $limitation
  */
 public function assignRole($contentId, $roleId, array $limitation)
 {
     foreach ($limitation as $identifier => $values) {
         foreach ($values as $value) {
             $query = $this->handler->createInsertQuery();
             $query->insertInto($this->handler->quoteTable('ezuser_role'))->set($this->handler->quoteColumn('contentobject_id'), $query->bindValue($contentId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('role_id'), $query->bindValue($roleId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('limit_identifier'), $query->bindValue($identifier))->set($this->handler->quoteColumn('limit_value'), $query->bindValue($value));
             $query->prepare()->execute();
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Adds limitations to an existing policy
  *
  * @param int $policyId
  * @param array $limitations
  *
  * @return void
  */
 public function addPolicyLimitations($policyId, array $limitations)
 {
     foreach ($limitations as $identifier => $values) {
         $query = $this->handler->createInsertQuery();
         $query->insertInto($this->handler->quoteTable('ezpolicy_limitation'))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('ezpolicy_limitation', 'id'))->set($this->handler->quoteColumn('identifier'), $query->bindValue($identifier))->set($this->handler->quoteColumn('policy_id'), $query->bindValue($policyId, null, \PDO::PARAM_INT));
         $query->prepare()->execute();
         $limitationId = $this->handler->lastInsertId($this->handler->getSequenceName('ezpolicy_limitation', 'id'));
         foreach ($values as $value) {
             $query = $this->handler->createInsertQuery();
             $query->insertInto($this->handler->quoteTable('ezpolicy_limitation_value'))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('ezpolicy_limitation_value', 'id'))->set($this->handler->quoteColumn('value'), $query->bindValue($value))->set($this->handler->quoteColumn('limitation_id'), $query->bindValue($limitationId, null, \PDO::PARAM_INT));
             $query->prepare()->execute();
         }
     }
 }