Code Duplication    Length = 27-29 lines in 2 locations

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

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

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

@@ 781-807 (lines=27) @@
778
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $value
779
     * @param int $contentId
780
     */
781
    public function updateNonTranslatableField(
782
        Field $field,
783
        StorageFieldValue $value,
784
        $contentId
785
    ) {
786
        // Note, no need to care for language_id here, since Content->$alwaysAvailable
787
        // cannot change on update
788
        $q = $this->dbHandler->createUpdateQuery();
789
        $this->setFieldUpdateValues($q, $value);
790
        $q->where(
791
            $q->expr->lAnd(
792
                $q->expr->eq(
793
                    $this->dbHandler->quoteColumn('contentclassattribute_id'),
794
                    $q->bindValue($field->fieldDefinitionId, null, \PDO::PARAM_INT)
795
                ),
796
                $q->expr->eq(
797
                    $this->dbHandler->quoteColumn('contentobject_id'),
798
                    $q->bindValue($contentId, null, \PDO::PARAM_INT)
799
                ),
800
                $q->expr->eq(
801
                    $this->dbHandler->quoteColumn('version'),
802
                    $q->bindValue($field->versionNo, null, \PDO::PARAM_INT)
803
                )
804
            )
805
        );
806
        $q->prepare()->execute();
807
    }
808
809
    /**
810
     * {@inheritdoc}