Completed
Push — master ( 86bee8...f7a629 )
by Grégoire
04:38
created

GalleryItem::setPosition()   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 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\MediaBundle\Model;
13
14
abstract class GalleryItem implements GalleryItemInterface
15
{
16
    /**
17
     * @var MediaInterface
18
     */
19
    protected $media;
20
21
    /**
22
     * @var GalleryInterface
23
     */
24
    protected $gallery;
25
26
    /**
27
     * @var int
28
     */
29
    protected $position;
30
31
    /**
32
     * @var \DateTime
33
     */
34
    protected $updatedAt;
35
36
    /**
37
     * @var \DateTime
38
     */
39
    protected $createdAt;
40
41
    /**
42
     * @var bool
43
     */
44
    protected $enabled;
45
46
    /**
47
     * Construct.
48
     */
49
    public function __construct()
50
    {
51
        $this->position = 0;
52
        $this->enabled = false;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function __toString()
59
    {
60
        return $this->getGallery().' | '.$this->getMedia();
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function setCreatedAt(\DateTime $createdAt = null)
67
    {
68
        $this->createdAt = $createdAt;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getCreatedAt()
75
    {
76
        return $this->createdAt;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function setEnabled($enabled)
83
    {
84
        $this->enabled = $enabled;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function getEnabled()
91
    {
92
        return $this->enabled;
93
    }
94
95
    /**
96
     * {@inheritdoc}
97
     */
98
    public function setGallery(GalleryInterface $gallery = null)
99
    {
100
        $this->gallery = $gallery;
101
    }
102
103
    /**
104
     * {@inheritdoc}
105
     */
106
    public function getGallery()
107
    {
108
        return $this->gallery;
109
    }
110
111
    /**
112
     * {@inheritdoc}
113
     */
114
    public function setMedia(MediaInterface $media = null)
115
    {
116
        $this->media = $media;
117
    }
118
119
    /**
120
     * {@inheritdoc}
121
     */
122
    public function getMedia()
123
    {
124
        return $this->media;
125
    }
126
127
    /**
128
     * {@inheritdoc}
129
     */
130
    public function setPosition($position)
131
    {
132
        $this->position = $position;
133
    }
134
135
    /**
136
     * {@inheritdoc}
137
     */
138
    public function getPosition()
139
    {
140
        return $this->position;
141
    }
142
143
    /**
144
     * {@inheritdoc}
145
     */
146
    public function setUpdatedAt(\DateTime $updatedAt = null)
147
    {
148
        $this->updatedAt = $updatedAt;
149
    }
150
151
    /**
152
     * {@inheritdoc}
153
     */
154
    public function getUpdatedAt()
155
    {
156
        return $this->updatedAt;
157
    }
158
}
159