Completed
Push — master ( b2ba42...b33960 )
by Joachim
26:09
created

TerminalManager::updateTerminal()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
namespace Loevgaard\DandomainAltapayBundle\Manager;
3
4
use Doctrine\Common\Persistence\ObjectManager;
5
use Doctrine\Common\Persistence\ObjectRepository;
6
use Loevgaard\DandomainAltapayBundle\Entity\TerminalInterface;
7
use Loevgaard\DandomainFoundationBundle\Manager\Manager;
8
9
/**
10
 * @method TerminalInterface create()
11
 * @method delete(TerminalInterface $obj)
12
 * @method update(TerminalInterface $obj, $flush = true)
13
 */
14
class TerminalManager extends Manager
15
{
16
    /**
17
     * @param string $title
18
     * @return TerminalInterface|null
19
     */
20
    public function findTerminalByTitle(string $title) : ?TerminalInterface
21
    {
22
        /** @var TerminalInterface $terminal */
23
        $terminal = $this->getRepository()->findOneBy([
24
            'title' => $title
25
        ]);
26
27
        return $terminal;
28
    }
29
30
    /**
31
     * @param string $slug
32
     * @return TerminalInterface|null
33
     */
34
    public function findTerminalBySlug(string $slug) : ?TerminalInterface
35
    {
36
        /** @var TerminalInterface $terminal */
37
        $terminal = $this->getRepository()->findOneBy([
38
            'slug' => $slug
39
        ]);
40
41
        return $terminal;
42
    }
43
}