Code Duplication    Length = 29-30 lines in 2 locations

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

@@ 799-827 (lines=29) @@
796
     * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition
797
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef
798
     */
799
    public function updateFieldDefinition(
800
        $typeId,
801
        $status,
802
        FieldDefinition $fieldDefinition,
803
        StorageFieldDefinition $storageFieldDef
804
    ) {
805
        $q = $this->dbHandler->createUpdateQuery();
806
        $q
807
            ->update(
808
                $this->dbHandler->quoteTable('ezcontentclass_attribute')
809
            )->where(
810
                $q->expr->eq(
811
                    $this->dbHandler->quoteColumn('id'),
812
                    $q->bindValue($fieldDefinition->id, null, \PDO::PARAM_INT)
813
                ),
814
                $q->expr->eq(
815
                    $this->dbHandler->quoteColumn('version'),
816
                    $q->bindValue($status, null, \PDO::PARAM_INT)
817
                ),
818
                // @todo FIXME: Actually not needed
819
                $q->expr->eq(
820
                    $this->dbHandler->quoteColumn('contentclass_id'),
821
                    $q->bindValue($typeId, null, \PDO::PARAM_INT)
822
                )
823
            );
824
        $this->setCommonFieldColumns($q, $fieldDefinition, $storageFieldDef);
825
826
        $q->prepare()->execute();
827
    }
828
829
    /**
830
     * Deletes all name data for $typeId in $typeStatus.

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

@@ 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.