/**
  * Inserts a new relation database record
  *
  * @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
  *
  * @return int ID the inserted ID
  */
 public function insertRelation(RelationCreateStruct $createStruct)
 {
     $q = $this->dbHandler->createInsertQuery();
     $q->insertInto($this->dbHandler->quoteTable('ezcontentobject_link'))->set($this->dbHandler->quoteColumn('id'), $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id'))->set($this->dbHandler->quoteColumn('contentclassattribute_id'), $q->bindValue((int) $createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('from_contentobject_id'), $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('from_contentobject_version'), $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('relation_type'), $q->bindValue($createStruct->type, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('to_contentobject_id'), $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT));
     $q->prepare()->execute();
     return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezcontentobject_link', 'id'));
 }
 /**
  * Sends a single location identified by given $locationId to the trash.
  *
  * The associated content object is left untouched.
  *
  * @param mixed $locationId
  *
  * @return boolean
  */
 public function trashLocation($locationId)
 {
     $locationRow = $this->getBasicNodeData($locationId);
     /** @var $query \ezcQueryInsert */
     $query = $this->handler->createInsertQuery();
     $query->insertInto($this->handler->quoteTable("ezcontentobject_trash"));
     unset($locationRow["contentobject_is_published"]);
     foreach ($locationRow as $key => $value) {
         $query->set($key, $query->bindValue($value));
     }
     $query->prepare()->execute();
     $this->removeLocation($locationRow["node_id"]);
     $this->setContentStatus($locationRow["contentobject_id"], ContentInfo::STATUS_ARCHIVED);
 }