Completed
Branch feature/pre-split (ce4b6b)
by Anton
05:23
created

RootLoader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
namespace Spiral\ORM\Entities\Loaders;
8
9
use Spiral\Database\Builders\SelectQuery;
10
use Spiral\ORM\ORMInterface;
11
12
/**
13
 * Primary ORM loader.
14
 */
15
class RootLoader
16
{
17
    /**
18
     * @var string
19
     */
20
    private $class;
21
22
    /**
23
     * @invisible
24
     * @var ORMInterface
25
     */
26
    private $orm;
27
28
    /**
29
     * @var SelectQuery
30
     */
31
    private $select;
32
33
    /**
34
     * @param string       $class
35
     * @param ORMInterface $orm
36
     */
37
    public function __construct(string $class, ORMInterface $orm)
38
    {
39
        $this->class = $class;
40
        $this->orm = $orm;
41
42
        //Getting our initial select query
43
        $this->select = $orm->table($class)->select();
44
    }
45
}