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

@@ 837-863 (lines=27) @@
834
     * @param int $newParent
835
     * @param int $opcode
836
     */
837
    public function updateNodeAssignment($contentObjectId, $oldParent, $newParent, $opcode)
838
    {
839
        $query = $this->handler->createUpdateQuery();
840
        $query
841
            ->update($this->handler->quoteTable('eznode_assignment'))
842
            ->set(
843
                $this->handler->quoteColumn('parent_node'),
844
                $query->bindValue($newParent, null, \PDO::PARAM_INT)
845
            )
846
            ->set(
847
                $this->handler->quoteColumn('op_code'),
848
                $query->bindValue($opcode, null, \PDO::PARAM_INT)
849
            )
850
            ->where(
851
                $query->expr->lAnd(
852
                    $query->expr->eq(
853
                        $this->handler->quoteColumn('contentobject_id'),
854
                        $query->bindValue($contentObjectId, null, \PDO::PARAM_INT)
855
                    ),
856
                    $query->expr->eq(
857
                        $this->handler->quoteColumn('parent_node'),
858
                        $query->bindValue($oldParent, null, \PDO::PARAM_INT)
859
                    )
860
                )
861
            );
862
        $query->prepare()->execute();
863
    }
864
865
    /**
866
     * Create locations from node assignments.