| @@ 458-480 (lines=23) @@ | ||
| 455 | * @param mixed $typeId |
|
| 456 | * @param int $status |
|
| 457 | */ |
|
| 458 | public function deleteGroupAssignment($groupId, $typeId, $status) |
|
| 459 | { |
|
| 460 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 461 | $q->deleteFrom( |
|
| 462 | $this->dbHandler->quoteTable('ezcontentclass_classgroup') |
|
| 463 | )->where( |
|
| 464 | $q->expr->lAnd( |
|
| 465 | $q->expr->eq( |
|
| 466 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 467 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 468 | ), |
|
| 469 | $q->expr->eq( |
|
| 470 | $this->dbHandler->quoteColumn('contentclass_version'), |
|
| 471 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 472 | ), |
|
| 473 | $q->expr->eq( |
|
| 474 | $this->dbHandler->quoteColumn('group_id'), |
|
| 475 | $q->bindValue($groupId, null, \PDO::PARAM_INT) |
|
| 476 | ) |
|
| 477 | ) |
|
| 478 | ); |
|
| 479 | $q->prepare()->execute(); |
|
| 480 | } |
|
| 481 | ||
| 482 | /** |
|
| 483 | * Loads data about Groups with $groupIds. |
|
| @@ 765-789 (lines=25) @@ | ||
| 762 | * @param int $status |
|
| 763 | * @param mixed $fieldDefinitionId |
|
| 764 | */ |
|
| 765 | public function deleteFieldDefinition($typeId, $status, $fieldDefinitionId) |
|
| 766 | { |
|
| 767 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 768 | $q->deleteFrom( |
|
| 769 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 770 | )->where( |
|
| 771 | $q->expr->lAnd( |
|
| 772 | $q->expr->eq( |
|
| 773 | $this->dbHandler->quoteColumn('id'), |
|
| 774 | $q->bindValue($fieldDefinitionId, null, \PDO::PARAM_INT) |
|
| 775 | ), |
|
| 776 | $q->expr->eq( |
|
| 777 | $this->dbHandler->quoteColumn('version'), |
|
| 778 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 779 | ), |
|
| 780 | // @todo FIXME: Actually not needed |
|
| 781 | $q->expr->eq( |
|
| 782 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 783 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 784 | ) |
|
| 785 | ) |
|
| 786 | ); |
|
| 787 | ||
| 788 | $q->prepare()->execute(); |
|
| 789 | } |
|
| 790 | ||
| 791 | /** |
|
| 792 | * Updates a $fieldDefinition for $typeId. |
|
| @@ 799-827 (lines=29) @@ | ||
| 796 | * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition |
|
| 797 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef |
|
| 798 | */ |
|
| 799 | public function updateFieldDefinition( |
|
| 800 | $typeId, |
|
| 801 | $status, |
|
| 802 | FieldDefinition $fieldDefinition, |
|
| 803 | StorageFieldDefinition $storageFieldDef |
|
| 804 | ) { |
|
| 805 | $q = $this->dbHandler->createUpdateQuery(); |
|
| 806 | $q |
|
| 807 | ->update( |
|
| 808 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 809 | )->where( |
|
| 810 | $q->expr->eq( |
|
| 811 | $this->dbHandler->quoteColumn('id'), |
|
| 812 | $q->bindValue($fieldDefinition->id, null, \PDO::PARAM_INT) |
|
| 813 | ), |
|
| 814 | $q->expr->eq( |
|
| 815 | $this->dbHandler->quoteColumn('version'), |
|
| 816 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 817 | ), |
|
| 818 | // @todo FIXME: Actually not needed |
|
| 819 | $q->expr->eq( |
|
| 820 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 821 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 822 | ) |
|
| 823 | ); |
|
| 824 | $this->setCommonFieldColumns($q, $fieldDefinition, $storageFieldDef); |
|
| 825 | ||
| 826 | $q->prepare()->execute(); |
|
| 827 | } |
|
| 828 | ||
| 829 | /** |
|
| 830 | * Deletes all name data for $typeId in $typeStatus. |
|
| @@ 539-562 (lines=24) @@ | ||
| 536 | * @param mixed $oldParentId |
|
| 537 | * @param mixed $newParentId |
|
| 538 | */ |
|
| 539 | public function reparent($oldParentId, $newParentId) |
|
| 540 | { |
|
| 541 | /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */ |
|
| 542 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 543 | $query->update( |
|
| 544 | $this->dbHandler->quoteTable($this->table) |
|
| 545 | )->set( |
|
| 546 | $this->dbHandler->quoteColumn('parent'), |
|
| 547 | $query->bindValue($newParentId, null, \PDO::PARAM_INT) |
|
| 548 | )->where( |
|
| 549 | $query->expr->lAnd( |
|
| 550 | $query->expr->eq( |
|
| 551 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 552 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 553 | ), |
|
| 554 | $query->expr->eq( |
|
| 555 | $this->dbHandler->quoteColumn('parent'), |
|
| 556 | $query->bindValue($oldParentId, null, \PDO::PARAM_INT) |
|
| 557 | ) |
|
| 558 | ) |
|
| 559 | ); |
|
| 560 | ||
| 561 | $query->prepare()->execute(); |
|
| 562 | } |
|
| 563 | ||
| 564 | /** |
|
| 565 | * Updates single row data matched by composite primary key. |
|
| @@ 1015-1041 (lines=27) @@ | ||
| 1012 | * |
|
| 1013 | * @return bool |
|
| 1014 | */ |
|
| 1015 | public function removeCustomAlias($parentId, $textMD5) |
|
| 1016 | { |
|
| 1017 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1018 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1019 | $query->deleteFrom( |
|
| 1020 | $this->dbHandler->quoteTable($this->table) |
|
| 1021 | )->where( |
|
| 1022 | $query->expr->lAnd( |
|
| 1023 | $query->expr->eq( |
|
| 1024 | $this->dbHandler->quoteColumn('parent'), |
|
| 1025 | $query->bindValue($parentId, null, \PDO::PARAM_INT) |
|
| 1026 | ), |
|
| 1027 | $query->expr->eq( |
|
| 1028 | $this->dbHandler->quoteColumn('text_md5'), |
|
| 1029 | $query->bindValue($textMD5, null, \PDO::PARAM_STR) |
|
| 1030 | ), |
|
| 1031 | $query->expr->eq( |
|
| 1032 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1033 | $query->bindValue(1, null, \PDO::PARAM_INT) |
|
| 1034 | ) |
|
| 1035 | ) |
|
| 1036 | ); |
|
| 1037 | $statement = $query->prepare(); |
|
| 1038 | $statement->execute(); |
|
| 1039 | ||
| 1040 | return $statement->rowCount() === 1 ?: false; |
|
| 1041 | } |
|
| 1042 | ||
| 1043 | /** |
|
| 1044 | * Deletes all rows with given $action and optionally $id. |
|
| @@ 1053-1082 (lines=30) @@ | ||
| 1050 | * |
|
| 1051 | * @return bool |
|
| 1052 | */ |
|
| 1053 | public function remove($action, $id = null) |
|
| 1054 | { |
|
| 1055 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1056 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1057 | $query->deleteFrom( |
|
| 1058 | $this->dbHandler->quoteTable($this->table) |
|
| 1059 | )->where( |
|
| 1060 | $query->expr->eq( |
|
| 1061 | $this->dbHandler->quoteColumn('action'), |
|
| 1062 | $query->bindValue($action, null, \PDO::PARAM_STR) |
|
| 1063 | ) |
|
| 1064 | ); |
|
| 1065 | ||
| 1066 | if ($id !== null) { |
|
| 1067 | $query->where( |
|
| 1068 | $query->expr->lAnd( |
|
| 1069 | $query->expr->eq( |
|
| 1070 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1071 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 1072 | ), |
|
| 1073 | $query->expr->eq( |
|
| 1074 | $this->dbHandler->quoteColumn('id'), |
|
| 1075 | $query->bindValue($id, null, \PDO::PARAM_INT) |
|
| 1076 | ) |
|
| 1077 | ) |
|
| 1078 | ); |
|
| 1079 | } |
|
| 1080 | ||
| 1081 | $query->prepare()->execute(); |
|
| 1082 | } |
|
| 1083 | ||
| 1084 | /** |
|
| 1085 | * Loads all autogenerated entries with given $parentId with optionally included history entries. |
|