1 | <?php |
||
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 |