Completed
Push — master ( 1faee5...d14607 )
by Tim
15:03
created

findOneByRelativeFilePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * FileStandalone.
4
 */
5
6
namespace HDNET\Focuspoint\Domain\Repository;
7
8
/**
9
 * FileStandalone.
10
 */
11
class FileStandaloneRepository extends AbstractRawRepository
12
{
13
    /**
14
     * Find one by relative file path.
15
     *
16
     * @param string $relativeFilePath
17
     *
18
     * @return array|null
19
     */
20
    public function findOneByRelativeFilePath(string $relativeFilePath)
21
    {
22
        $queryBuilder = $this->getQueryBuilder();
23
        $rows = $queryBuilder->select('*')
24
            ->from($this->getTableName())
25
            ->where(
26
                $queryBuilder->expr()->eq('relative_file_path', $queryBuilder->createNamedParameter($relativeFilePath))
27
            )
28
            ->execute()
29
            ->fetchAll();
30
31
        return $rows[0] ?? null;
32
    }
33
34
    /**
35
     * Get the tablename.
36
     *
37
     * @return string
38
     */
39
    protected function getTableName(): string
40
    {
41
        return 'tx_focuspoint_domain_model_filestandalone';
42
    }
43
}
44