1 | <?php |
||
15 | class TestImage implements ResponsiveImageInterface |
||
16 | { |
||
17 | /** |
||
18 | * @ORM\Column(name="id", type="integer") |
||
19 | * @ORM\Id |
||
20 | * @ORM\GeneratedValue(strategy="AUTO") |
||
21 | */ |
||
22 | private $id = 1; |
||
23 | /** |
||
24 | * @ORM\Column(name="title", type="string", length=255) |
||
25 | */ |
||
26 | private $title = 'Test image'; |
||
27 | /** |
||
28 | * @ORM\Column(name="path", type="string", length=255, unique=true) |
||
29 | */ |
||
30 | private $path = 'dummy.jpg'; |
||
31 | /** |
||
32 | * @ORM\Column(name="alt", type="string", length=255, nullable=true) |
||
33 | */ |
||
34 | private $alt = 'Test image alt text'; |
||
35 | /** |
||
36 | * @ORM\Column(name="width", type="integer", nullable=true) |
||
37 | */ |
||
38 | private $width = 1000; |
||
39 | /** |
||
40 | * @ORM\Column(name="height", type="integer", nullable=true) |
||
41 | */ |
||
42 | private $height = 1600; |
||
43 | /** |
||
44 | * @Assert\File(maxSize="6000000") |
||
45 | */ |
||
46 | private $file; |
||
47 | /** |
||
48 | * @ORM\Column(name="crop_coordinations", type="string", nullable=true) |
||
49 | */ |
||
50 | private $cropCoordinates = '200, 3, 800, 1400:310, 145, 750, 617'; |
||
51 | private $src; |
||
52 | |||
53 | public function getId() |
||
57 | |||
58 | public function getPath() |
||
62 | |||
63 | public function setPath($path) |
||
67 | |||
68 | public function getTitle() |
||
72 | |||
73 | public function setTitle($title) |
||
77 | |||
78 | public function getStyleData() |
||
82 | |||
83 | public function setStyle($style) |
||
87 | |||
88 | public function getAlt() |
||
92 | |||
93 | public function setAlt($alt) |
||
97 | |||
98 | public function getWidth() |
||
102 | |||
103 | public function setWidth($width) |
||
107 | |||
108 | public function getHeight() |
||
112 | |||
113 | public function setHeight($height) |
||
117 | |||
118 | public function getCropCoordinates() |
||
122 | |||
123 | public function setCropCoordinates($cords) |
||
127 | |||
128 | public function setFile(UploadedFile $file) |
||
132 | |||
133 | public function getFile() |
||
137 | |||
138 | public function setSrc($src) |
||
142 | |||
143 | public function getSrc() |
||
147 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: