| @@ 131-160 (lines=30) @@ | ||
| 128 | * |
|
| 129 | * @return mixed Group ID |
|
| 130 | */ |
|
| 131 | public function insertGroup(Group $group) |
|
| 132 | { |
|
| 133 | $q = $this->dbHandler->createInsertQuery(); |
|
| 134 | $q->insertInto( |
|
| 135 | $this->dbHandler->quoteTable('ezcontentclassgroup') |
|
| 136 | )->set( |
|
| 137 | $this->dbHandler->quoteColumn('id'), |
|
| 138 | $this->dbHandler->getAutoIncrementValue('ezcontentclassgroup', 'id') |
|
| 139 | )->set( |
|
| 140 | $this->dbHandler->quoteColumn('created'), |
|
| 141 | $q->bindValue($group->created, null, \PDO::PARAM_INT) |
|
| 142 | )->set( |
|
| 143 | $this->dbHandler->quoteColumn('creator_id'), |
|
| 144 | $q->bindValue($group->creatorId, null, \PDO::PARAM_INT) |
|
| 145 | )->set( |
|
| 146 | $this->dbHandler->quoteColumn('modified'), |
|
| 147 | $q->bindValue($group->modified, null, \PDO::PARAM_INT) |
|
| 148 | )->set( |
|
| 149 | $this->dbHandler->quoteColumn('modifier_id'), |
|
| 150 | $q->bindValue($group->modifierId, null, \PDO::PARAM_INT) |
|
| 151 | )->set( |
|
| 152 | $this->dbHandler->quoteColumn('name'), |
|
| 153 | $q->bindValue($group->identifier) |
|
| 154 | ); |
|
| 155 | $q->prepare()->execute(); |
|
| 156 | ||
| 157 | return $this->dbHandler->lastInsertId( |
|
| 158 | $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id') |
|
| 159 | ); |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * Updates a group with data in $group. |
|
| @@ 1887-1917 (lines=31) @@ | ||
| 1884 | * |
|
| 1885 | * @return int ID the inserted ID |
|
| 1886 | */ |
|
| 1887 | public function insertRelation(RelationCreateStruct $createStruct) |
|
| 1888 | { |
|
| 1889 | $q = $this->dbHandler->createInsertQuery(); |
|
| 1890 | $q->insertInto( |
|
| 1891 | $this->dbHandler->quoteTable('ezcontentobject_link') |
|
| 1892 | )->set( |
|
| 1893 | $this->dbHandler->quoteColumn('id'), |
|
| 1894 | $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id') |
|
| 1895 | )->set( |
|
| 1896 | $this->dbHandler->quoteColumn('contentclassattribute_id'), |
|
| 1897 | $q->bindValue((int)$createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT) |
|
| 1898 | )->set( |
|
| 1899 | $this->dbHandler->quoteColumn('from_contentobject_id'), |
|
| 1900 | $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT) |
|
| 1901 | )->set( |
|
| 1902 | $this->dbHandler->quoteColumn('from_contentobject_version'), |
|
| 1903 | $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT) |
|
| 1904 | )->set( |
|
| 1905 | $this->dbHandler->quoteColumn('relation_type'), |
|
| 1906 | $q->bindValue($createStruct->type, null, \PDO::PARAM_INT) |
|
| 1907 | )->set( |
|
| 1908 | $this->dbHandler->quoteColumn('to_contentobject_id'), |
|
| 1909 | $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT) |
|
| 1910 | ); |
|
| 1911 | ||
| 1912 | $q->prepare()->execute(); |
|
| 1913 | ||
| 1914 | return $this->dbHandler->lastInsertId( |
|
| 1915 | $this->dbHandler->getSequenceName('ezcontentobject_link', 'id') |
|
| 1916 | ); |
|
| 1917 | } |
|
| 1918 | ||
| 1919 | /** |
|
| 1920 | * Deletes the relation with the given $relationId. |
|