|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace App\DataFixtures; |
|
6
|
|
|
|
|
7
|
|
|
use App\Entity\Property; |
|
8
|
|
|
use App\Entity\PropertyDescription; |
|
9
|
|
|
use App\Utils\Slugger; |
|
10
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
11
|
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface; |
|
12
|
|
|
use Doctrine\Persistence\ObjectManager; |
|
13
|
|
|
|
|
14
|
|
|
final class PropertyFixtures extends Fixture implements DependentFixtureInterface |
|
15
|
|
|
{ |
|
16
|
|
|
public function load(ObjectManager $manager): void |
|
17
|
|
|
{ |
|
18
|
|
|
foreach ($this->getPropertyData() as [$author, $dealType, $category, $bedrooms, $guests, $city, $district, |
|
19
|
|
|
$neighborhood, $metro, $title, $address, $latitude, $longitude, $price, $priceType, ]) { |
|
20
|
|
|
$property = new Property(); |
|
21
|
|
|
$property->setAuthor($author); |
|
22
|
|
|
$property->setDealType($dealType); |
|
23
|
|
|
$property->setCategory($category); |
|
24
|
|
|
$property->setBedroomsNumber($bedrooms); |
|
25
|
|
|
$property->setMaxGuests($guests); |
|
26
|
|
|
$property->setCity($city); |
|
27
|
|
|
$property->setNeighborhood($neighborhood); |
|
28
|
|
|
$property->setDistrict($district); |
|
29
|
|
|
$property->setMetroStation($metro); |
|
30
|
|
|
$property->setSlug(Slugger::slugify($title)); |
|
31
|
|
|
$property->setAddress($address); |
|
32
|
|
|
$property->setLatitude($latitude); |
|
33
|
|
|
$property->setLongitude($longitude); |
|
34
|
|
|
$property->setShowMap(true); |
|
35
|
|
|
$property->setPrice($price); |
|
36
|
|
|
$property->setPriceType($priceType); |
|
37
|
|
|
$property->setState('published'); |
|
38
|
|
|
$property->setCreatedAt(new \DateTime('now')); |
|
39
|
|
|
$property->setUpdatedAt(new \DateTime('now')); |
|
40
|
|
|
$property->addFeature($this->getReference('Air conditioning')); |
|
41
|
|
|
$property->addFeature($this->getReference('Balcony')); |
|
42
|
|
|
$property->addFeature($this->getReference('Fire Alarm')); |
|
43
|
|
|
$property->addFeature($this->getReference('High Impact Doors')); |
|
44
|
|
|
$property->addFeature($this->getReference('Secure parking')); |
|
45
|
|
|
$property->setPriorityNumber(0); |
|
46
|
|
|
$property->setPropertyDescription((new PropertyDescription()) |
|
47
|
|
|
->setTitle($title) |
|
48
|
|
|
->setMetaDescription($title) |
|
49
|
|
|
->setContent($this->getPropertyContent()) |
|
50
|
|
|
); |
|
51
|
|
|
$manager->persist($property); |
|
52
|
|
|
$this->addReference(Slugger::slugify($title), $property); |
|
53
|
|
|
} |
|
54
|
|
|
$manager->flush(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
private function getPropertyData(): array |
|
58
|
|
|
{ |
|
59
|
|
|
return [ |
|
60
|
|
|
/* |
|
61
|
|
|
$propertyData = [$author, $dealType, $category, $bedrooms, $guests, $city, |
|
62
|
|
|
$district $neighborhood, $metro, $title, $address, |
|
63
|
|
|
$latitude, $longitude, $price, $priceType]; |
|
64
|
|
|
*/ |
|
65
|
|
|
[ |
|
66
|
|
|
$this->getReference('admin'), |
|
67
|
|
|
$this->getReference('Sale'), |
|
68
|
|
|
$this->getReference('Villa'), |
|
69
|
|
|
5, |
|
70
|
|
|
null, |
|
71
|
|
|
$this->getReference('Tampa'), |
|
72
|
|
|
$this->getReference('South Tampa'), |
|
73
|
|
|
$this->getReference('Culbreath Isles'), |
|
74
|
|
|
null, |
|
75
|
|
|
'Beautiful villa for sale in Tampa', |
|
76
|
|
|
'4935 New Providence Ave, Tampa, FL', |
|
77
|
|
|
'27.932255', '-82.533187', 1600, 'sq. foot', |
|
78
|
|
|
], |
|
79
|
|
|
[ |
|
80
|
|
|
$this->getReference('admin'), |
|
81
|
|
|
$this->getReference('Rent'), |
|
82
|
|
|
$this->getReference('Penthouse'), |
|
83
|
|
|
2, |
|
84
|
|
|
5, |
|
85
|
|
|
$this->getReference('Palm Beach'), |
|
86
|
|
|
null, |
|
87
|
|
|
null, |
|
88
|
|
|
null, |
|
89
|
|
|
'Stylish two-level penthouse in Palm Beach', |
|
90
|
|
|
'101 Worth Ave, Palm Beach, FL 33480', |
|
91
|
|
|
'26.701320', '-80.033688', 2000, 'mo', |
|
92
|
|
|
], |
|
93
|
|
|
[ |
|
94
|
|
|
$this->getReference('admin'), |
|
95
|
|
|
$this->getReference('Rent'), |
|
96
|
|
|
$this->getReference('Apartment'), |
|
97
|
|
|
null, |
|
98
|
|
|
4, |
|
99
|
|
|
$this->getReference('Miami'), |
|
100
|
|
|
null, |
|
101
|
|
|
$this->getReference('South Beach'), |
|
102
|
|
|
null, |
|
103
|
|
|
'Bright and Cheerful alcove studio', |
|
104
|
|
|
'1451 Ocean Dr, Miami Beach, FL 33139', |
|
105
|
|
|
'25.785107', '-80.129460', 200, 'day', |
|
106
|
|
|
], |
|
107
|
|
|
[ |
|
108
|
|
|
$this->getReference('admin'), |
|
109
|
|
|
$this->getReference('Rent'), |
|
110
|
|
|
$this->getReference('Apartment'), |
|
111
|
|
|
1, |
|
112
|
|
|
2, |
|
113
|
|
|
$this->getReference('Miami'), |
|
114
|
|
|
null, |
|
115
|
|
|
$this->getReference('South Beach'), |
|
116
|
|
|
null, |
|
117
|
|
|
'Modern one-bedroom apartment in Miami', |
|
118
|
|
|
'1451 Ocean Dr, Miami Beach, FL 33139', |
|
119
|
|
|
'25.785107', '-80.129460', 250, 'day', |
|
120
|
|
|
], |
|
121
|
|
|
[ |
|
122
|
|
|
$this->getReference('admin'), |
|
123
|
|
|
$this->getReference('Rent'), |
|
124
|
|
|
$this->getReference('Apartment'), |
|
125
|
|
|
1, |
|
126
|
|
|
3, |
|
127
|
|
|
$this->getReference('Palm Beach'), |
|
128
|
|
|
null, |
|
129
|
|
|
null, |
|
130
|
|
|
null, |
|
131
|
|
|
'Bright fully furnished 1-bedroom flat on the 2nd floor', |
|
132
|
|
|
'300 S Ocean Blvd, Palm Beach, FL', |
|
133
|
|
|
'26.705007', '-80.033574', 180, 'day', |
|
134
|
|
|
], |
|
135
|
|
|
[ |
|
136
|
|
|
$this->getReference('user'), |
|
137
|
|
|
$this->getReference('Sale'), |
|
138
|
|
|
$this->getReference('Apartment'), |
|
139
|
|
|
2, |
|
140
|
|
|
null, |
|
141
|
|
|
$this->getReference('Miami'), |
|
142
|
|
|
null, |
|
143
|
|
|
$this->getReference('Downtown'), |
|
144
|
|
|
$this->getReference('Government Center'), |
|
145
|
|
|
'Interesting two-bedroom apartment for sale', |
|
146
|
|
|
'111 NE 2nd Ave, Miami, FL 33132', |
|
147
|
|
|
'25.775565', '-80.190125', 190000, '', |
|
148
|
|
|
], |
|
149
|
|
|
[ |
|
150
|
|
|
$this->getReference('user'), |
|
151
|
|
|
$this->getReference('Rent'), |
|
152
|
|
|
$this->getReference('Apartment'), |
|
153
|
|
|
2, |
|
154
|
|
|
6, |
|
155
|
|
|
$this->getReference('Tampa'), |
|
156
|
|
|
null, |
|
157
|
|
|
$this->getReference('Ballast Point'), |
|
158
|
|
|
null, |
|
159
|
|
|
'Furnished renovated 2-bedroom 2-bathroom flat', |
|
160
|
|
|
'5411 Bayshore Blvd, Tampa, FL 33611', |
|
161
|
|
|
'27.885095', '-82.486153', 2200, 'mo', |
|
162
|
|
|
], |
|
163
|
|
|
]; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
private function getPropertyContent(): string |
|
167
|
|
|
{ |
|
168
|
|
|
return '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, |
|
169
|
|
|
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
|
170
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco |
|
171
|
|
|
laboris nisi ut aliquip ex ea commodo consequat. |
|
172
|
|
|
Duis aute irure dolor in reprehenderit in voluptate |
|
173
|
|
|
velit esse cillum dolore eu fugiat nulla pariatur. |
|
174
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui |
|
175
|
|
|
officia deserunt mollit anim id est laborum.</p> |
|
176
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem |
|
177
|
|
|
accusantium doloremque laudantium, totam rem aperiam, |
|
178
|
|
|
eaque ipsa quae ab illo inventore veritatis et quasi |
|
179
|
|
|
architecto beatae vitae dicta sunt explicabo. |
|
180
|
|
|
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut |
|
181
|
|
|
odit aut fugit, sed quia consequuntur magni dolores eos qui |
|
182
|
|
|
ratione voluptatem sequi nesciunt. Neque porro quisquam est, |
|
183
|
|
|
qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, |
|
184
|
|
|
sed quia non numquam eius modi tempora incidunt ut labore et dolore |
|
185
|
|
|
magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, |
|
186
|
|
|
quis nostrum exercitationem ullam corporis suscipit laboriosam, |
|
187
|
|
|
nisi ut aliquid ex ea commodi consequatur.</p>'; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
public function getDependencies() |
|
191
|
|
|
{ |
|
192
|
|
|
return [ |
|
193
|
|
|
CategoryFixtures::class, |
|
194
|
|
|
CityFixtures::class, |
|
195
|
|
|
DealTypeFixtures::class, |
|
196
|
|
|
DistrictFixtures::class, |
|
197
|
|
|
FeatureFixtures::class, |
|
198
|
|
|
MetroFixtures::class, |
|
199
|
|
|
NeighborhoodFixtures::class, |
|
200
|
|
|
UserFixtures::class, |
|
201
|
|
|
]; |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|