Completed
Push — master ( 585f2b...0f3816 )
by Vitaly
02:39
created

Navigation::materials()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 17
rs 9.4286
cc 2
eloc 10
nc 2
nop 0
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>
4
 * on 07.08.14 at 17:11
5
 */
6
namespace samsoncms\api;
7
8
use samson\activerecord\structure;
9
10
/**
11
 * SamsonCMS Navigation element
12
 * @author Vitaly Egorov <[email protected]>
13
 * @copyright 2014 SamsonOS
14
 */
15
class Navigation extends structure
16
{
17
    /** @var string Navigation string identifier */
18
    public $Url;
19
20
    /** @var self[] Collection of child items */
21
    public $children = array();
22
23
    /**
24
     * Override standard view passing
25
     * @param string $prefix Prefix
26
     * @param array $restricted Collection of ignored entity fields
27
     * @return array Filled collection of key => values for view
28
     */
29
    public function toView($prefix = '', array $restricted = array())
30
    {
31
        return parent::toView($prefix, $restricted = array('parent', 'parents', 'children'));
32
    }
33
34
    /**
35
     * Material query injection
36
     * @param \samson\activerecord\dbQuery $query Query object
37
     */
38
    public function materialsHandlers(&$query)
39
    {
40
        $query->join('gallery');
41
    }
42
}
43