Code Duplication    Length = 8-8 lines in 2 locations

src/Repository/Doctrine/ORMRepository.php 2 locations

@@ 161-168 (lines=8) @@
158
     */
159
    public function findBy($criteria)
160
    {
161
        if (!$criteria instanceof Criteria) {
162
            $criteriaParams = $criteria;
163
164
            $criteria = Criteria::create();
165
            foreach ($criteriaParams as $name => $value) {
166
                $criteria->andWhere(Criteria::expr()->eq($name, $value));
167
            }
168
        }
169
170
        $queryBuilder = $this->getQueryBuilder($criteria);
171
@@ 185-192 (lines=8) @@
182
     */
183
    public function findOneBy($criteria)
184
    {
185
        if (!$criteria instanceof Criteria) {
186
            $criteriaParams = $criteria;
187
188
            $criteria = Criteria::create();
189
            foreach ($criteriaParams as $name => $value) {
190
                $criteria->andWhere(Criteria::expr()->eq($name, $value));
191
            }
192
        }
193
194
        $criteria->setFirstResult(0);
195
        $criteria->setMaxResults(1);