Code Duplication    Length = 20-21 lines in 4 locations

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

@@ 833-852 (lines=20) @@
830
     *
831
     * @return array
832
     */
833
    public function load($contentId, $version, array $translations = null)
834
    {
835
        $query = $this->queryBuilder->createFindQuery($translations);
836
        $query->where(
837
            $query->expr->lAnd(
838
                $query->expr->eq(
839
                    $this->dbHandler->quoteColumn('id', 'ezcontentobject'),
840
                    $query->bindValue($contentId)
841
                ),
842
                $query->expr->eq(
843
                    $this->dbHandler->quoteColumn('version', 'ezcontentobject_version'),
844
                    $query->bindValue($version)
845
                )
846
            )
847
        );
848
        $statement = $query->prepare();
849
        $statement->execute();
850
851
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
852
    }
853
854
    /**
855
     * {@inheritdoc}

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

@@ 596-616 (lines=21) @@
593
     *
594
     * @return int
595
     */
596
    public function getContentCount($stateId)
597
    {
598
        $query = $this->dbHandler->createSelectQuery();
599
        $query->select(
600
            $query->alias($query->expr->count('*'), 'count')
601
        )->from(
602
            $this->dbHandler->quoteTable('ezcobj_state_link')
603
        )->where(
604
            $query->expr->eq(
605
                $this->dbHandler->quoteColumn('contentobject_state_id'),
606
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
607
            )
608
        );
609
610
        $statement = $query->prepare();
611
        $statement->execute();
612
613
        $count = $statement->fetchColumn();
614
615
        return $count !== null ? (int)$count : 0;
616
    }
617
618
    /**
619
     * Updates the object state priority to provided value.

eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php 2 locations

@@ 916-935 (lines=20) @@
913
     *
914
     * @return array(int=>array(string=>mixed)) Data rows.
915
     */
916
    public function loadTypeDataByIdentifier($identifier, $status)
917
    {
918
        $q = $this->getLoadTypeQuery();
919
        $q->where(
920
            $q->expr->lAnd(
921
                $q->expr->eq(
922
                    $this->dbHandler->quoteColumn('identifier', 'ezcontentclass'),
923
                    $q->bindValue($identifier)
924
                ),
925
                $q->expr->eq(
926
                    $this->dbHandler->quoteColumn('version', 'ezcontentclass'),
927
                    $q->bindValue($status)
928
                )
929
            )
930
        );
931
        $stmt = $q->prepare();
932
        $stmt->execute();
933
934
        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
935
    }
936
937
    /**
938
     * Loads an array with data about the type referred to by $remoteId in
@@ 946-965 (lines=20) @@
943
     *
944
     * @return array(int=>array(string=>mixed)) Data rows.
945
     */
946
    public function loadTypeDataByRemoteId($remoteId, $status)
947
    {
948
        $q = $this->getLoadTypeQuery();
949
        $q->where(
950
            $q->expr->lAnd(
951
                $q->expr->eq(
952
                    $this->dbHandler->quoteColumn('remote_id', 'ezcontentclass'),
953
                    $q->bindValue($remoteId)
954
                ),
955
                $q->expr->eq(
956
                    $this->dbHandler->quoteColumn('version', 'ezcontentclass'),
957
                    $q->bindValue($status)
958
                )
959
            )
960
        );
961
        $stmt = $q->prepare();
962
        $stmt->execute();
963
964
        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
965
    }
966
967
    /**
968
     * Returns a basic query to retrieve Type data.