Code Duplication    Length = 39-39 lines in 2 locations

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

@@ 744-782 (lines=39) @@
741
     *
742
     * @return array
743
     */
744
    public function loadAutogeneratedEntry($action, $parentId = null)
745
    {
746
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
747
        $query = $this->dbHandler->createSelectQuery();
748
        $query->select(
749
            '*'
750
        )->from(
751
            $this->dbHandler->quoteTable('ezurlalias_ml')
752
        )->where(
753
            $query->expr->lAnd(
754
                $query->expr->eq(
755
                    $this->dbHandler->quoteColumn('action'),
756
                    $query->bindValue($action, null, \PDO::PARAM_STR)
757
                ),
758
                $query->expr->eq(
759
                    $this->dbHandler->quoteColumn('is_original'),
760
                    $query->bindValue(1, null, \PDO::PARAM_INT)
761
                ),
762
                $query->expr->eq(
763
                    $this->dbHandler->quoteColumn('is_alias'),
764
                    $query->bindValue(0, null, \PDO::PARAM_INT)
765
                )
766
            )
767
        );
768
769
        if (isset($parentId)) {
770
            $query->where(
771
                $query->expr->eq(
772
                    $this->dbHandler->quoteColumn('parent'),
773
                    $query->bindValue($parentId, null, \PDO::PARAM_INT)
774
                )
775
            );
776
        }
777
778
        $statement = $query->prepare();
779
        $statement->execute();
780
781
        return $statement->fetch(\PDO::FETCH_ASSOC);
782
    }
783
784
    /**
785
     * Loads all data for the path identified by given $id.
@@ 994-1032 (lines=39) @@
991
     *
992
     * @return array
993
     */
994
    public function loadAutogeneratedEntries($parentId, $includeHistory = false)
995
    {
996
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
997
        $query = $this->dbHandler->createSelectQuery();
998
        $query->select(
999
            '*'
1000
        )->from(
1001
            $this->dbHandler->quoteTable('ezurlalias_ml')
1002
        )->where(
1003
            $query->expr->lAnd(
1004
                $query->expr->eq(
1005
                    $this->dbHandler->quoteColumn('parent'),
1006
                    $query->bindValue($parentId, null, \PDO::PARAM_INT)
1007
                ),
1008
                $query->expr->eq(
1009
                    $this->dbHandler->quoteColumn('action_type'),
1010
                    $query->bindValue('eznode', null, \PDO::PARAM_STR)
1011
                ),
1012
                $query->expr->eq(
1013
                    $this->dbHandler->quoteColumn('is_alias'),
1014
                    $query->bindValue(0, null, \PDO::PARAM_INT)
1015
                )
1016
            )
1017
        );
1018
1019
        if (!$includeHistory) {
1020
            $query->where(
1021
                $query->expr->eq(
1022
                    $this->dbHandler->quoteColumn('is_original'),
1023
                    $query->bindValue(1, null, \PDO::PARAM_INT)
1024
                )
1025
            );
1026
        }
1027
1028
        $statement = $query->prepare();
1029
        $statement->execute();
1030
1031
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
1032
    }
1033
}
1034