Code Duplication    Length = 27-30 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php 1 location

@@ 955-984 (lines=30) @@
952
     *
953
     * @return bool
954
     */
955
    public function remove($action, $id = null)
956
    {
957
        /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
958
        $query = $this->dbHandler->createDeleteQuery();
959
        $query->deleteFrom(
960
            $this->dbHandler->quoteTable('ezurlalias_ml')
961
        )->where(
962
            $query->expr->eq(
963
                $this->dbHandler->quoteColumn('action'),
964
                $query->bindValue($action, null, \PDO::PARAM_STR)
965
            )
966
        );
967
968
        if ($id !== null) {
969
            $query->where(
970
                $query->expr->lAnd(
971
                    $query->expr->eq(
972
                        $this->dbHandler->quoteColumn('is_alias'),
973
                        $query->bindValue(0, null, \PDO::PARAM_INT)
974
                    ),
975
                    $query->expr->eq(
976
                        $this->dbHandler->quoteColumn('id'),
977
                        $query->bindValue($id, null, \PDO::PARAM_INT)
978
                    )
979
                )
980
            );
981
        }
982
983
        $query->prepare()->execute();
984
    }
985
986
    /**
987
     * Loads all autogenerated entries with given $parentId with optionally included history entries.

eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php 1 location

@@ 871-897 (lines=27) @@
868
     * @param int $newParent
869
     * @param int $opcode
870
     */
871
    public function updateNodeAssignment($contentObjectId, $oldParent, $newParent, $opcode)
872
    {
873
        $query = $this->handler->createUpdateQuery();
874
        $query
875
            ->update($this->handler->quoteTable('eznode_assignment'))
876
            ->set(
877
                $this->handler->quoteColumn('parent_node'),
878
                $query->bindValue($newParent, null, \PDO::PARAM_INT)
879
            )
880
            ->set(
881
                $this->handler->quoteColumn('op_code'),
882
                $query->bindValue($opcode, null, \PDO::PARAM_INT)
883
            )
884
            ->where(
885
                $query->expr->lAnd(
886
                    $query->expr->eq(
887
                        $this->handler->quoteColumn('contentobject_id'),
888
                        $query->bindValue($contentObjectId, null, \PDO::PARAM_INT)
889
                    ),
890
                    $query->expr->eq(
891
                        $this->handler->quoteColumn('parent_node'),
892
                        $query->bindValue($oldParent, null, \PDO::PARAM_INT)
893
                    )
894
                )
895
            );
896
        $query->prepare()->execute();
897
    }
898
899
    /**
900
     * Create locations from node assignments.