Completed
Push — master ( 55dbed...4e3396 )
by Piotr
12s
created

CategoryNewsDisplay::getParentId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace FSi\FixturesBundle\Admin;
4
5
use FSi\Bundle\AdminBundle\Annotation as Admin;
6
use FSi\Bundle\AdminBundle\Display\Display;
7
use FSi\Bundle\AdminBundle\Display\ObjectDisplay;
8
use FSi\Bundle\AdminBundle\Display\Property\Formatter;
9
use FSi\Bundle\AdminBundle\Doctrine\Admin\DependentDisplayElement;
10
11
/**
12
 * @Admin\Element
13
 */
14
class CategoryNewsDisplay extends DependentDisplayElement
15
{
16
    const ID = 'category_news_display';
17
18
    /**
19
     * @return string
20
     */
21
    public function getId()
22
    {
23
        return self::ID;
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getParentId()
30
    {
31
        return 'category';
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getClassName()
38
    {
39
        return 'FSi\FixturesBundle\Entity\News';
40
    }
41
42
    /**
43
     * @param mixed $object
44
     * @return Display
45
     */
46
    protected function initDisplay($object)
47
    {
48
        $display = new ObjectDisplay($object);
49
        $display->add('id', 'Identity')
50
            ->add('title')
51
            ->add('date', null, [
52
                new Formatter\EmptyValue(),
53
                new Formatter\DateTime('Y-m-d H:i:s')
54
            ])
55
            ->add('visible', 'Visible', [
56
                new Formatter\Boolean("yes", "no")
57
            ])
58
            ->add('createdAt', null, [
59
                new Formatter\EmptyValue(),
60
                new Formatter\DateTime('Y-m-d H:i:s')
61
            ])
62
            ->add('creatorEmail');
63
64
        return $display;
65
    }
66
}
67