Passed
Pull Request — master (#161)
by David
05:10 queued 02:05
created

TestArticleSubQueryDao   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getArticlesByUserLoginStartingWith() 0 11 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TheCodingMachine\TDBM\Dao;
5
6
use TheCodingMachine\TDBM\ResultIterator;
7
use TheCodingMachine\TDBM\TDBMService;
8
use TheCodingMachine\TDBM\Test\Dao\Bean\ArticleBean;
0 ignored issues
show
Bug introduced by
The type TheCodingMachine\TDBM\Test\Dao\Bean\ArticleBean 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
use TheCodingMachine\TDBM\Test\Dao\Generated\ArticleBaseDao;
0 ignored issues
show
Bug introduced by
The type TheCodingMachine\TDBM\Te...enerated\ArticleBaseDao 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...
10
11
/**
12
 * The UserDao class will maintain the persistence of UserBean class into the users table.
13
 */
14
class TestArticleSubQueryDao extends ArticleBaseDao
15
{
16
    /**
17
     * @var TestUserDao
18
     */
19
    private $userDao;
20
21
    public function __construct(TDBMService $tdbmService, TestUserDao $userDao)
22
    {
23
        parent::__construct($tdbmService);
24
        $this->userDao = $userDao;
25
    }
26
27
    /**
28
     * Used to test a findFromSql with an order by clause on an inherited table.
29
     *
30
     * @return ResultIterator&ArticleBean[]
31
     */
32
    public function getArticlesByUserLoginStartingWith(string $login): ResultIterator
33
    {
34
        /*return $this->find(
35
            'author_id IN (:authorIds)',
36
            [ 'authorIds' => $this->userDao->getUsersByLoginStartingWith($login) ],
37
            'users.login'
38
        );*/
39
        return $this->find(
40
            $this->userDao->getUsersByLoginStartingWith($login),
41
            [],
42
            'users.login'
43
        );
44
    }
45
}
46