| @@ 446-468 (lines=23) @@ | ||
| 443 | * @param mixed $typeId |
|
| 444 | * @param int $status |
|
| 445 | */ |
|
| 446 | public function deleteGroupAssignment($groupId, $typeId, $status) |
|
| 447 | { |
|
| 448 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 449 | $q->deleteFrom( |
|
| 450 | $this->dbHandler->quoteTable('ezcontentclass_classgroup') |
|
| 451 | )->where( |
|
| 452 | $q->expr->lAnd( |
|
| 453 | $q->expr->eq( |
|
| 454 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 455 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 456 | ), |
|
| 457 | $q->expr->eq( |
|
| 458 | $this->dbHandler->quoteColumn('contentclass_version'), |
|
| 459 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 460 | ), |
|
| 461 | $q->expr->eq( |
|
| 462 | $this->dbHandler->quoteColumn('group_id'), |
|
| 463 | $q->bindValue($groupId, null, \PDO::PARAM_INT) |
|
| 464 | ) |
|
| 465 | ) |
|
| 466 | ); |
|
| 467 | $q->prepare()->execute(); |
|
| 468 | } |
|
| 469 | ||
| 470 | /** |
|
| 471 | * Loads data about Group with $groupId. |
|
| @@ 756-780 (lines=25) @@ | ||
| 753 | * @param int $status |
|
| 754 | * @param mixed $fieldDefinitionId |
|
| 755 | */ |
|
| 756 | public function deleteFieldDefinition($typeId, $status, $fieldDefinitionId) |
|
| 757 | { |
|
| 758 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 759 | $q->deleteFrom( |
|
| 760 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 761 | )->where( |
|
| 762 | $q->expr->lAnd( |
|
| 763 | $q->expr->eq( |
|
| 764 | $this->dbHandler->quoteColumn('id'), |
|
| 765 | $q->bindValue($fieldDefinitionId, null, \PDO::PARAM_INT) |
|
| 766 | ), |
|
| 767 | $q->expr->eq( |
|
| 768 | $this->dbHandler->quoteColumn('version'), |
|
| 769 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 770 | ), |
|
| 771 | // @todo FIXME: Actually not needed |
|
| 772 | $q->expr->eq( |
|
| 773 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 774 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 775 | ) |
|
| 776 | ) |
|
| 777 | ); |
|
| 778 | ||
| 779 | $q->prepare()->execute(); |
|
| 780 | } |
|
| 781 | ||
| 782 | /** |
|
| 783 | * Updates a $fieldDefinition for $typeId. |
|
| @@ 790-818 (lines=29) @@ | ||
| 787 | * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition |
|
| 788 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef |
|
| 789 | */ |
|
| 790 | public function updateFieldDefinition( |
|
| 791 | $typeId, |
|
| 792 | $status, |
|
| 793 | FieldDefinition $fieldDefinition, |
|
| 794 | StorageFieldDefinition $storageFieldDef |
|
| 795 | ) { |
|
| 796 | $q = $this->dbHandler->createUpdateQuery(); |
|
| 797 | $q |
|
| 798 | ->update( |
|
| 799 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 800 | )->where( |
|
| 801 | $q->expr->eq( |
|
| 802 | $this->dbHandler->quoteColumn('id'), |
|
| 803 | $q->bindValue($fieldDefinition->id, null, \PDO::PARAM_INT) |
|
| 804 | ), |
|
| 805 | $q->expr->eq( |
|
| 806 | $this->dbHandler->quoteColumn('version'), |
|
| 807 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 808 | ), |
|
| 809 | // @todo FIXME: Actually not needed |
|
| 810 | $q->expr->eq( |
|
| 811 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 812 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 813 | ) |
|
| 814 | ); |
|
| 815 | $this->setCommonFieldColumns($q, $fieldDefinition, $storageFieldDef); |
|
| 816 | ||
| 817 | $q->prepare()->execute(); |
|
| 818 | } |
|
| 819 | ||
| 820 | /** |
|
| 821 | * Deletes all name data for $typeId in $typeStatus. |
|
| @@ 529-552 (lines=24) @@ | ||
| 526 | * @param mixed $oldParentId |
|
| 527 | * @param mixed $newParentId |
|
| 528 | */ |
|
| 529 | public function reparent($oldParentId, $newParentId) |
|
| 530 | { |
|
| 531 | /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */ |
|
| 532 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 533 | $query->update( |
|
| 534 | $this->dbHandler->quoteTable($this->table) |
|
| 535 | )->set( |
|
| 536 | $this->dbHandler->quoteColumn('parent'), |
|
| 537 | $query->bindValue($newParentId, null, \PDO::PARAM_INT) |
|
| 538 | )->where( |
|
| 539 | $query->expr->lAnd( |
|
| 540 | $query->expr->eq( |
|
| 541 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 542 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 543 | ), |
|
| 544 | $query->expr->eq( |
|
| 545 | $this->dbHandler->quoteColumn('parent'), |
|
| 546 | $query->bindValue($oldParentId, null, \PDO::PARAM_INT) |
|
| 547 | ) |
|
| 548 | ) |
|
| 549 | ); |
|
| 550 | ||
| 551 | $query->prepare()->execute(); |
|
| 552 | } |
|
| 553 | ||
| 554 | /** |
|
| 555 | * Updates single row data matched by composite primary key. |
|
| @@ 993-1019 (lines=27) @@ | ||
| 990 | * |
|
| 991 | * @return bool |
|
| 992 | */ |
|
| 993 | public function removeCustomAlias($parentId, $textMD5) |
|
| 994 | { |
|
| 995 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 996 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 997 | $query->deleteFrom( |
|
| 998 | $this->dbHandler->quoteTable($this->table) |
|
| 999 | )->where( |
|
| 1000 | $query->expr->lAnd( |
|
| 1001 | $query->expr->eq( |
|
| 1002 | $this->dbHandler->quoteColumn('parent'), |
|
| 1003 | $query->bindValue($parentId, null, \PDO::PARAM_INT) |
|
| 1004 | ), |
|
| 1005 | $query->expr->eq( |
|
| 1006 | $this->dbHandler->quoteColumn('text_md5'), |
|
| 1007 | $query->bindValue($textMD5, null, \PDO::PARAM_STR) |
|
| 1008 | ), |
|
| 1009 | $query->expr->eq( |
|
| 1010 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1011 | $query->bindValue(1, null, \PDO::PARAM_INT) |
|
| 1012 | ) |
|
| 1013 | ) |
|
| 1014 | ); |
|
| 1015 | $statement = $query->prepare(); |
|
| 1016 | $statement->execute(); |
|
| 1017 | ||
| 1018 | return $statement->rowCount() === 1 ?: false; |
|
| 1019 | } |
|
| 1020 | ||
| 1021 | /** |
|
| 1022 | * Deletes all rows with given $action and optionally $id. |
|
| @@ 1031-1060 (lines=30) @@ | ||
| 1028 | * |
|
| 1029 | * @return bool |
|
| 1030 | */ |
|
| 1031 | public function remove($action, $id = null) |
|
| 1032 | { |
|
| 1033 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1034 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1035 | $query->deleteFrom( |
|
| 1036 | $this->dbHandler->quoteTable($this->table) |
|
| 1037 | )->where( |
|
| 1038 | $query->expr->eq( |
|
| 1039 | $this->dbHandler->quoteColumn('action'), |
|
| 1040 | $query->bindValue($action, null, \PDO::PARAM_STR) |
|
| 1041 | ) |
|
| 1042 | ); |
|
| 1043 | ||
| 1044 | if ($id !== null) { |
|
| 1045 | $query->where( |
|
| 1046 | $query->expr->lAnd( |
|
| 1047 | $query->expr->eq( |
|
| 1048 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1049 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 1050 | ), |
|
| 1051 | $query->expr->eq( |
|
| 1052 | $this->dbHandler->quoteColumn('id'), |
|
| 1053 | $query->bindValue($id, null, \PDO::PARAM_INT) |
|
| 1054 | ) |
|
| 1055 | ) |
|
| 1056 | ); |
|
| 1057 | } |
|
| 1058 | ||
| 1059 | $query->prepare()->execute(); |
|
| 1060 | } |
|
| 1061 | ||
| 1062 | /** |
|
| 1063 | * Loads all autogenerated entries with given $parentId with optionally included history entries. |
|