ItemRepository::findByCatalogItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 1
eloc 7
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * AnimeDb package
4
 *
5
 * @package   AnimeDb
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2011, Peter Gribanov
8
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
9
 */
10
11
namespace AnimeDb\Bundle\MyAnimeListSyncBundle\Repository;
12
13
use Doctrine\ORM\EntityRepository;
14
use AnimeDb\Bundle\MyAnimeListSyncBundle\Entity\Item;
15
use AnimeDb\Bundle\CatalogBundle\Entity\Item as CatalogItem;
16
17
/**
18
 * @package AnimeDb\Bundle\MyAnimeListSyncBundle\Repository
19
 * @author  Peter Gribanov <[email protected]>
20
 */
21
class ItemRepository extends EntityRepository
22
{
23
    /**
24
     * @param CatalogItem $item
25
     *
26
     * @return Item|null
27
     */
28
    public function findByCatalogItem(CatalogItem $item)
29
    {
30
        return $this
31
            ->createQueryBuilder('i')
32
            ->where('i.item_id = :id')
33
            ->setParameter(':id', $item->getId())
34
            ->getQuery()
35
            ->getOneOrNullResult();
36
    }
37
}
38