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

SysFileMetadataRepository::findByFileUid()   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
/**
4
 * SysFileMetadata.
5
 */
6
7
namespace HDNET\Focuspoint\Domain\Repository;
8
9
/**
10
 *  SysFileMetadata.
11
 */
12
class SysFileMetadataRepository extends AbstractRawRepository
13
{
14
    /**
15
     * Find one by file.
16
     *
17
     * @param int $fileUid
18
     *
19
     * @return array|null
20
     */
21
    public function findOneByFileUid(int $fileUid)
22
    {
23
        $queryBuilder = $this->getQueryBuilder();
24
        $rows = $queryBuilder->select('*')
25
            ->from($this->getTableName())
26
            ->where(
27
                $queryBuilder->expr()->eq('file', $fileUid)
28
            )
29
            ->execute()
30
            ->fetchAll();
31
32
        return $rows[0] ?? null;
33
    }
34
35
    /**
36
     * Get the tablename.
37
     *
38
     * @return string
39
     */
40
    protected function getTableName(): string
41
    {
42
        return 'sys_file_metadata';
43
    }
44
}
45