| @@ 1761-1791 (lines=31) @@ | ||
| 1758 | * |
|
| 1759 | * @return int ID the inserted ID |
|
| 1760 | */ |
|
| 1761 | public function insertRelation(RelationCreateStruct $createStruct) |
|
| 1762 | { |
|
| 1763 | $q = $this->dbHandler->createInsertQuery(); |
|
| 1764 | $q->insertInto( |
|
| 1765 | $this->dbHandler->quoteTable('ezcontentobject_link') |
|
| 1766 | )->set( |
|
| 1767 | $this->dbHandler->quoteColumn('id'), |
|
| 1768 | $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id') |
|
| 1769 | )->set( |
|
| 1770 | $this->dbHandler->quoteColumn('contentclassattribute_id'), |
|
| 1771 | $q->bindValue((int)$createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT) |
|
| 1772 | )->set( |
|
| 1773 | $this->dbHandler->quoteColumn('from_contentobject_id'), |
|
| 1774 | $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT) |
|
| 1775 | )->set( |
|
| 1776 | $this->dbHandler->quoteColumn('from_contentobject_version'), |
|
| 1777 | $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT) |
|
| 1778 | )->set( |
|
| 1779 | $this->dbHandler->quoteColumn('relation_type'), |
|
| 1780 | $q->bindValue($createStruct->type, null, \PDO::PARAM_INT) |
|
| 1781 | )->set( |
|
| 1782 | $this->dbHandler->quoteColumn('to_contentobject_id'), |
|
| 1783 | $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT) |
|
| 1784 | ); |
|
| 1785 | ||
| 1786 | $q->prepare()->execute(); |
|
| 1787 | ||
| 1788 | return $this->dbHandler->lastInsertId( |
|
| 1789 | $this->dbHandler->getSequenceName('ezcontentobject_link', 'id') |
|
| 1790 | ); |
|
| 1791 | } |
|
| 1792 | ||
| 1793 | /** |
|
| 1794 | * Deletes the relation with the given $relationId. |
|
| @@ 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. |
|