Issues (291)

tests/Dao/TestRoleDao.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TheCodingMachine\TDBM\Dao;
6
7
use TheCodingMachine\TDBM\Test\Dao\Bean\RoleBean;
0 ignored issues
show
The type TheCodingMachine\TDBM\Test\Dao\Bean\RoleBean was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use TheCodingMachine\TDBM\Test\Dao\Generated\RoleBaseDao;
0 ignored issues
show
The type TheCodingMachine\TDBM\Te...o\Generated\RoleBaseDao was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * The UserDao class will maintain the persistence of UserBean class into the users table.
12
 */
13
class TestRoleDao extends RoleBaseDao
14
{
15
    /**
16
     * Returns the list of roles join rights where right label = CAN_SING.
17
     *
18
     * @return RoleBean[]
19
     */
20
    public function getRolesByRightCanSing($orderBy = null)
21
    {
22
        return $this->findFromSql(
23
            'roles JOIN roles_rights ON roles.id = roles_rights.role_id JOIN rights ON rights.label = roles_rights.right_label',
24
            'rights.label = :right',
25
            array('right' => 'CAN_SING'),
26
            $orderBy
27
        );
28
    }
29
    /**
30
     * Returns the list of roles join rights where right label = CAN_SING.
31
     *
32
     * @return RoleBean[]
33
     */
34
    public function getRolesByRight($orderBy = null)
35
    {
36
        return $this->findFromSql(
37
            'roles JOIN roles_rights ON roles.id = roles_rights.role_id JOIN rights ON rights.label = roles_rights.right_label',
38
            null,
39
            [],
40
            $orderBy
41
        );
42
    }
43
44
    /**
45
     * Returns the role join rights where right label = CAN_SING and role name = Singers.
46
     *
47
     * @return RoleBean
48
     */
49
    public function getRoleByRightCanSingAndNameSinger()
50
    {
51
        return $this->findOneFromSql(
52
            'roles JOIN roles_rights ON roles.id = roles_rights.role_id JOIN rights ON rights.label = roles_rights.right_label',
53
            'rights.label = :right AND name = :name',
54
            array('right' => 'CAN_SING', 'name' => 'Singers')
55
        );
56
    }
57
}
58