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

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