insertRelation() 추상적인 공개 메소드

Inserts a new relation database record.
abstract public insertRelation ( eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct ) : integer
$createStruct eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct
리턴 integer ID the inserted ID
 /**
  * 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 $struct)
 {
     try {
         return $this->innerGateway->insertRelation($struct);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
예제 #2
0
 /**
  * Creates a relation between $sourceContentId in $sourceContentVersionNo
  * and $destinationContentId with a specific $type.
  *
  * @todo Should the existence verifications happen here or is this supposed to be handled at a higher level?
  *
  * @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
  *
  * @return \eZ\Publish\SPI\Persistence\Content\Relation
  */
 public function addRelation(RelationCreateStruct $createStruct)
 {
     $relation = $this->mapper->createRelationFromCreateStruct($createStruct);
     $relation->id = $this->contentGateway->insertRelation($createStruct);
     return $relation;
 }