| @@ 448-470 (lines=23) @@ | ||
| 445 | * @param mixed $typeId |
|
| 446 | * @param int $status |
|
| 447 | */ |
|
| 448 | public function deleteGroupAssignment($groupId, $typeId, $status) |
|
| 449 | { |
|
| 450 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 451 | $q->deleteFrom( |
|
| 452 | $this->dbHandler->quoteTable('ezcontentclass_classgroup') |
|
| 453 | )->where( |
|
| 454 | $q->expr->lAnd( |
|
| 455 | $q->expr->eq( |
|
| 456 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 457 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 458 | ), |
|
| 459 | $q->expr->eq( |
|
| 460 | $this->dbHandler->quoteColumn('contentclass_version'), |
|
| 461 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 462 | ), |
|
| 463 | $q->expr->eq( |
|
| 464 | $this->dbHandler->quoteColumn('group_id'), |
|
| 465 | $q->bindValue($groupId, null, \PDO::PARAM_INT) |
|
| 466 | ) |
|
| 467 | ) |
|
| 468 | ); |
|
| 469 | $q->prepare()->execute(); |
|
| 470 | } |
|
| 471 | ||
| 472 | /** |
|
| 473 | * Loads data about Group with $groupId. |
|
| @@ 758-782 (lines=25) @@ | ||
| 755 | * @param int $status |
|
| 756 | * @param mixed $fieldDefinitionId |
|
| 757 | */ |
|
| 758 | public function deleteFieldDefinition($typeId, $status, $fieldDefinitionId) |
|
| 759 | { |
|
| 760 | $q = $this->dbHandler->createDeleteQuery(); |
|
| 761 | $q->deleteFrom( |
|
| 762 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 763 | )->where( |
|
| 764 | $q->expr->lAnd( |
|
| 765 | $q->expr->eq( |
|
| 766 | $this->dbHandler->quoteColumn('id'), |
|
| 767 | $q->bindValue($fieldDefinitionId, null, \PDO::PARAM_INT) |
|
| 768 | ), |
|
| 769 | $q->expr->eq( |
|
| 770 | $this->dbHandler->quoteColumn('version'), |
|
| 771 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 772 | ), |
|
| 773 | // @todo FIXME: Actually not needed |
|
| 774 | $q->expr->eq( |
|
| 775 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 776 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 777 | ) |
|
| 778 | ) |
|
| 779 | ); |
|
| 780 | ||
| 781 | $q->prepare()->execute(); |
|
| 782 | } |
|
| 783 | ||
| 784 | /** |
|
| 785 | * Updates a $fieldDefinition for $typeId. |
|
| @@ 792-820 (lines=29) @@ | ||
| 789 | * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition |
|
| 790 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef |
|
| 791 | */ |
|
| 792 | public function updateFieldDefinition( |
|
| 793 | $typeId, |
|
| 794 | $status, |
|
| 795 | FieldDefinition $fieldDefinition, |
|
| 796 | StorageFieldDefinition $storageFieldDef |
|
| 797 | ) { |
|
| 798 | $q = $this->dbHandler->createUpdateQuery(); |
|
| 799 | $q |
|
| 800 | ->update( |
|
| 801 | $this->dbHandler->quoteTable('ezcontentclass_attribute') |
|
| 802 | )->where( |
|
| 803 | $q->expr->eq( |
|
| 804 | $this->dbHandler->quoteColumn('id'), |
|
| 805 | $q->bindValue($fieldDefinition->id, null, \PDO::PARAM_INT) |
|
| 806 | ), |
|
| 807 | $q->expr->eq( |
|
| 808 | $this->dbHandler->quoteColumn('version'), |
|
| 809 | $q->bindValue($status, null, \PDO::PARAM_INT) |
|
| 810 | ), |
|
| 811 | // @todo FIXME: Actually not needed |
|
| 812 | $q->expr->eq( |
|
| 813 | $this->dbHandler->quoteColumn('contentclass_id'), |
|
| 814 | $q->bindValue($typeId, null, \PDO::PARAM_INT) |
|
| 815 | ) |
|
| 816 | ); |
|
| 817 | $this->setCommonFieldColumns($q, $fieldDefinition, $storageFieldDef); |
|
| 818 | ||
| 819 | $q->prepare()->execute(); |
|
| 820 | } |
|
| 821 | ||
| 822 | /** |
|
| 823 | * Deletes all name data for $typeId in $typeStatus. |
|
| @@ 515-538 (lines=24) @@ | ||
| 512 | * @param mixed $oldParentId |
|
| 513 | * @param mixed $newParentId |
|
| 514 | */ |
|
| 515 | public function reparent($oldParentId, $newParentId) |
|
| 516 | { |
|
| 517 | /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */ |
|
| 518 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 519 | $query->update( |
|
| 520 | $this->dbHandler->quoteTable($this->table) |
|
| 521 | )->set( |
|
| 522 | $this->dbHandler->quoteColumn('parent'), |
|
| 523 | $query->bindValue($newParentId, null, \PDO::PARAM_INT) |
|
| 524 | )->where( |
|
| 525 | $query->expr->lAnd( |
|
| 526 | $query->expr->eq( |
|
| 527 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 528 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 529 | ), |
|
| 530 | $query->expr->eq( |
|
| 531 | $this->dbHandler->quoteColumn('parent'), |
|
| 532 | $query->bindValue($oldParentId, null, \PDO::PARAM_INT) |
|
| 533 | ) |
|
| 534 | ) |
|
| 535 | ); |
|
| 536 | ||
| 537 | $query->prepare()->execute(); |
|
| 538 | } |
|
| 539 | ||
| 540 | /** |
|
| 541 | * Updates single row data matched by composite primary key. |
|
| @@ 979-1005 (lines=27) @@ | ||
| 976 | * |
|
| 977 | * @return bool |
|
| 978 | */ |
|
| 979 | public function removeCustomAlias($parentId, $textMD5) |
|
| 980 | { |
|
| 981 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 982 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 983 | $query->deleteFrom( |
|
| 984 | $this->dbHandler->quoteTable($this->table) |
|
| 985 | )->where( |
|
| 986 | $query->expr->lAnd( |
|
| 987 | $query->expr->eq( |
|
| 988 | $this->dbHandler->quoteColumn('parent'), |
|
| 989 | $query->bindValue($parentId, null, \PDO::PARAM_INT) |
|
| 990 | ), |
|
| 991 | $query->expr->eq( |
|
| 992 | $this->dbHandler->quoteColumn('text_md5'), |
|
| 993 | $query->bindValue($textMD5, null, \PDO::PARAM_STR) |
|
| 994 | ), |
|
| 995 | $query->expr->eq( |
|
| 996 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 997 | $query->bindValue(1, null, \PDO::PARAM_INT) |
|
| 998 | ) |
|
| 999 | ) |
|
| 1000 | ); |
|
| 1001 | $statement = $query->prepare(); |
|
| 1002 | $statement->execute(); |
|
| 1003 | ||
| 1004 | return $statement->rowCount() === 1 ?: false; |
|
| 1005 | } |
|
| 1006 | ||
| 1007 | /** |
|
| 1008 | * Deletes all rows with given $action and optionally $id. |
|
| @@ 1017-1046 (lines=30) @@ | ||
| 1014 | * |
|
| 1015 | * @return bool |
|
| 1016 | */ |
|
| 1017 | public function remove($action, $id = null) |
|
| 1018 | { |
|
| 1019 | /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */ |
|
| 1020 | $query = $this->dbHandler->createDeleteQuery(); |
|
| 1021 | $query->deleteFrom( |
|
| 1022 | $this->dbHandler->quoteTable($this->table) |
|
| 1023 | )->where( |
|
| 1024 | $query->expr->eq( |
|
| 1025 | $this->dbHandler->quoteColumn('action'), |
|
| 1026 | $query->bindValue($action, null, \PDO::PARAM_STR) |
|
| 1027 | ) |
|
| 1028 | ); |
|
| 1029 | ||
| 1030 | if ($id !== null) { |
|
| 1031 | $query->where( |
|
| 1032 | $query->expr->lAnd( |
|
| 1033 | $query->expr->eq( |
|
| 1034 | $this->dbHandler->quoteColumn('is_alias'), |
|
| 1035 | $query->bindValue(0, null, \PDO::PARAM_INT) |
|
| 1036 | ), |
|
| 1037 | $query->expr->eq( |
|
| 1038 | $this->dbHandler->quoteColumn('id'), |
|
| 1039 | $query->bindValue($id, null, \PDO::PARAM_INT) |
|
| 1040 | ) |
|
| 1041 | ) |
|
| 1042 | ); |
|
| 1043 | } |
|
| 1044 | ||
| 1045 | $query->prepare()->execute(); |
|
| 1046 | } |
|
| 1047 | ||
| 1048 | /** |
|
| 1049 | * Loads all autogenerated entries with given $parentId with optionally included history entries. |
|