| @@ 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. |
|
| @@ 514-537 (lines=24) @@ | ||
| 511 | * @param mixed $oldParentId |
|
| 512 | * @param mixed $newParentId |
|
| 513 | */ |
|
| 514 | public function reparent($oldParentId, $newParentId) |
|
| 515 | { |
|
| 516 | /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */ |
|
| 517 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 518 | $query->update( |
|
| 519 | $this->dbHandler->quoteTable($this->table) |
|
| 520 | )->set( |
|
| 521 | $this->dbHandler->quoteColumn('parent'), |
|
| 522 | $query->bindValue($newParentId, null, \PDO::PARAM_INT) |
|
| 523 | )->where( |
|
| 524 | $query->expr->lAnd( |
|
| 525 | $query->expr->eq( |
|
| 526 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 527 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 528 | ), |
|
| 529 | $query->expr->eq( |
|
| 530 | $this->dbHandler->quoteColumn('parent'), |
|
| 531 | $query->bindValue($oldParentId, null, \PDO::PARAM_INT) |
|
| 532 | ) |
|
| 533 | ) |
|
| 534 | ); |
|
| 535 | ||
| 536 | $query->prepare()->execute(); |
|
| 537 | } |
|
| 538 | ||
| 539 | /** |
|
| 540 | * Updates single row data matched by composite primary key. |
|
| @@ 978-1004 (lines=27) @@ | ||
| 975 | * |
|
| 976 | * @return bool |
|
| 977 | */ |
|
| 978 | public function removeCustomAlias($parentId, $textMD5) |
|
| 979 | { |
|
| 980 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 981 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 982 | $query->deleteFrom( |
|
| 983 | $this->dbHandler->quoteTable($this->table) |
|
| 984 | )->where( |
|
| 985 | $query->expr->lAnd( |
|
| 986 | $query->expr->eq( |
|
| 987 | $this->dbHandler->quoteColumn('parent'), |
|
| 988 | $query->bindValue($parentId, null, \PDO::PARAM_INT) |
|
| 989 | ), |
|
| 990 | $query->expr->eq( |
|
| 991 | $this->dbHandler->quoteColumn('text_md5'), |
|
| 992 | $query->bindValue($textMD5, null, \PDO::PARAM_STR) |
|
| 993 | ), |
|
| 994 | $query->expr->eq( |
|
| 995 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 996 | $query->bindValue(1, null, \PDO::PARAM_INT) |
|
| 997 | ) |
|
| 998 | ) |
|
| 999 | ); |
|
| 1000 | $statement = $query->prepare(); |
|
| 1001 | $statement->execute(); |
|
| 1002 | ||
| 1003 | return $statement->rowCount() === 1 ?: false; |
|
| 1004 | } |
|
| 1005 | ||
| 1006 | /** |
|
| 1007 | * Deletes all rows with given $action and optionally $id. |
|
| @@ 1016-1045 (lines=30) @@ | ||
| 1013 | * |
|
| 1014 | * @return bool |
|
| 1015 | */ |
|
| 1016 | public function remove($action, $id = null) |
|
| 1017 | { |
|
| 1018 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1019 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1020 | $query->deleteFrom( |
|
| 1021 | $this->dbHandler->quoteTable($this->table) |
|
| 1022 | )->where( |
|
| 1023 | $query->expr->eq( |
|
| 1024 | $this->dbHandler->quoteColumn('action'), |
|
| 1025 | $query->bindValue($action, null, \PDO::PARAM_STR) |
|
| 1026 | ) |
|
| 1027 | ); |
|
| 1028 | ||
| 1029 | if ($id !== null) { |
|
| 1030 | $query->where( |
|
| 1031 | $query->expr->lAnd( |
|
| 1032 | $query->expr->eq( |
|
| 1033 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1034 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 1035 | ), |
|
| 1036 | $query->expr->eq( |
|
| 1037 | $this->dbHandler->quoteColumn('id'), |
|
| 1038 | $query->bindValue($id, null, \PDO::PARAM_INT) |
|
| 1039 | ) |
|
| 1040 | ) |
|
| 1041 | ); |
|
| 1042 | } |
|
| 1043 | ||
| 1044 | $query->prepare()->execute(); |
|
| 1045 | } |
|
| 1046 | ||
| 1047 | /** |
|
| 1048 | * Loads all autogenerated entries with given $parentId with optionally included history entries. |
|