Code Duplication    Length = 8-8 lines in 2 locations

src/Repository/Doctrine/ORMRepository.php 2 locations

@@ 156-163 (lines=8) @@
153
     */
154
    public function findBy($criteria)
155
    {
156
        if (!$criteria instanceof Criteria) {
157
            $criteriaParams = $criteria;
158
159
            $criteria = Criteria::create();
160
            foreach ($criteriaParams as $name => $value) {
161
                $criteria->andWhere(Criteria::expr()->eq($name, $value));
162
            }
163
        }
164
165
        $queryBuilder = $this->getQueryBuilder($criteria);
166
@@ 178-185 (lines=8) @@
175
     */
176
    public function findOneBy($criteria)
177
    {
178
        if (!$criteria instanceof Criteria) {
179
            $criteriaParams = $criteria;
180
181
            $criteria = Criteria::create();
182
            foreach ($criteriaParams as $name => $value) {
183
                $criteria->andWhere($criteria->expr()->eq($name, $value));
184
            }
185
        }
186
187
        $criteria->setFirstResult(0);
188
        $criteria->setMaxResults(1);