| @@ 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. |
|
| @@ 537-560 (lines=24) @@ | ||
| 534 | * @param mixed $oldParentId |
|
| 535 | * @param mixed $newParentId |
|
| 536 | */ |
|
| 537 | public function reparent($oldParentId, $newParentId) |
|
| 538 | { |
|
| 539 | /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */ |
|
| 540 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 541 | $query->update( |
|
| 542 | $this->dbHandler->quoteTable($this->table) |
|
| 543 | )->set( |
|
| 544 | $this->dbHandler->quoteColumn('parent'), |
|
| 545 | $query->bindValue($newParentId, null, \PDO::PARAM_INT) |
|
| 546 | )->where( |
|
| 547 | $query->expr->lAnd( |
|
| 548 | $query->expr->eq( |
|
| 549 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 550 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 551 | ), |
|
| 552 | $query->expr->eq( |
|
| 553 | $this->dbHandler->quoteColumn('parent'), |
|
| 554 | $query->bindValue($oldParentId, null, \PDO::PARAM_INT) |
|
| 555 | ) |
|
| 556 | ) |
|
| 557 | ); |
|
| 558 | ||
| 559 | $query->prepare()->execute(); |
|
| 560 | } |
|
| 561 | ||
| 562 | /** |
|
| 563 | * Updates single row data matched by composite primary key. |
|
| @@ 1013-1039 (lines=27) @@ | ||
| 1010 | * |
|
| 1011 | * @return bool |
|
| 1012 | */ |
|
| 1013 | public function removeCustomAlias($parentId, $textMD5) |
|
| 1014 | { |
|
| 1015 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1016 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1017 | $query->deleteFrom( |
|
| 1018 | $this->dbHandler->quoteTable($this->table) |
|
| 1019 | )->where( |
|
| 1020 | $query->expr->lAnd( |
|
| 1021 | $query->expr->eq( |
|
| 1022 | $this->dbHandler->quoteColumn('parent'), |
|
| 1023 | $query->bindValue($parentId, null, \PDO::PARAM_INT) |
|
| 1024 | ), |
|
| 1025 | $query->expr->eq( |
|
| 1026 | $this->dbHandler->quoteColumn('text_md5'), |
|
| 1027 | $query->bindValue($textMD5, null, \PDO::PARAM_STR) |
|
| 1028 | ), |
|
| 1029 | $query->expr->eq( |
|
| 1030 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1031 | $query->bindValue(1, null, \PDO::PARAM_INT) |
|
| 1032 | ) |
|
| 1033 | ) |
|
| 1034 | ); |
|
| 1035 | $statement = $query->prepare(); |
|
| 1036 | $statement->execute(); |
|
| 1037 | ||
| 1038 | return $statement->rowCount() === 1 ?: false; |
|
| 1039 | } |
|
| 1040 | ||
| 1041 | /** |
|
| 1042 | * Deletes all rows with given $action and optionally $id. |
|
| @@ 1051-1080 (lines=30) @@ | ||
| 1048 | * |
|
| 1049 | * @return bool |
|
| 1050 | */ |
|
| 1051 | public function remove($action, $id = null) |
|
| 1052 | { |
|
| 1053 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1054 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1055 | $query->deleteFrom( |
|
| 1056 | $this->dbHandler->quoteTable($this->table) |
|
| 1057 | )->where( |
|
| 1058 | $query->expr->eq( |
|
| 1059 | $this->dbHandler->quoteColumn('action'), |
|
| 1060 | $query->bindValue($action, null, \PDO::PARAM_STR) |
|
| 1061 | ) |
|
| 1062 | ); |
|
| 1063 | ||
| 1064 | if ($id !== null) { |
|
| 1065 | $query->where( |
|
| 1066 | $query->expr->lAnd( |
|
| 1067 | $query->expr->eq( |
|
| 1068 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1069 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 1070 | ), |
|
| 1071 | $query->expr->eq( |
|
| 1072 | $this->dbHandler->quoteColumn('id'), |
|
| 1073 | $query->bindValue($id, null, \PDO::PARAM_INT) |
|
| 1074 | ) |
|
| 1075 | ) |
|
| 1076 | ); |
|
| 1077 | } |
|
| 1078 | ||
| 1079 | $query->prepare()->execute(); |
|
| 1080 | } |
|
| 1081 | ||
| 1082 | /** |
|
| 1083 | * Loads all autogenerated entries with given $parentId with optionally included history entries. |
|