|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace App\DataFixtures; |
|
6
|
|
|
|
|
7
|
|
|
use App\Entity\Property; |
|
8
|
|
|
use App\Utils\Slugger; |
|
9
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
10
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
11
|
|
|
|
|
12
|
|
|
class PropertyFixtures extends Fixture |
|
13
|
|
|
{ |
|
14
|
|
|
public function load(ObjectManager $manager): void |
|
15
|
|
|
{ |
|
16
|
|
|
foreach ($this->getPropertyData() as [$operation, $category, $locality, $title, |
|
17
|
|
|
$address, $latitude, $longitude, $price, $price_type, ]) { |
|
18
|
|
|
$property = new Property(); |
|
19
|
|
|
$property->setAuthor($this->getReference(UserFixtures::ADMIN_USER_REFERENCE)); |
|
20
|
|
|
$property->setOperation($operation); |
|
21
|
|
|
$property->setCategory($category); |
|
22
|
|
|
$property->setLocality($locality); |
|
23
|
|
|
$property->setTitle($title); |
|
24
|
|
|
$property->setDescription($title); |
|
25
|
|
|
$property->setSlug(Slugger::slugify($title)); |
|
26
|
|
|
$property->setContent($this->getPropertyContent()); |
|
27
|
|
|
$property->setAddress($address); |
|
28
|
|
|
$property->setLatitude($latitude); |
|
29
|
|
|
$property->setLongitude($longitude); |
|
30
|
|
|
$property->setShowMap(true); |
|
31
|
|
|
$property->setPrice($price); |
|
32
|
|
|
$property->setPriceType($price_type); |
|
33
|
|
|
$property->setPublished(true); |
|
34
|
|
|
$property->setPublishedAt(new \DateTime('now')); |
|
35
|
|
|
$manager->persist($property); |
|
36
|
|
|
$this->addReference(Slugger::slugify($title), $property); |
|
37
|
|
|
} |
|
38
|
|
|
$manager->flush(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
private function getPropertyData(): array |
|
42
|
|
|
{ |
|
43
|
|
|
return [ |
|
44
|
|
|
/* |
|
45
|
|
|
$propertyData = [$operation_id, $category_id, $locality_id, |
|
46
|
|
|
$title, $address, $latitude, $longitude, |
|
47
|
|
|
$price, $price_type]; |
|
48
|
|
|
*/ |
|
49
|
|
|
[ |
|
50
|
|
|
$this->getReference('Rent'), |
|
51
|
|
|
$this->getReference('Apartment'), |
|
52
|
|
|
$this->getReference('Miami'), |
|
53
|
|
|
'Modern one-bedroom apartment in Miami', |
|
54
|
|
|
'1451 Ocean Dr, Miami Beach, FL 33139', |
|
55
|
|
|
'25.785107', '-80.129460', 250, 'day', |
|
56
|
|
|
], |
|
57
|
|
|
[ |
|
58
|
|
|
$this->getReference('Rent'), |
|
59
|
|
|
$this->getReference('Apartment'), |
|
60
|
|
|
$this->getReference('Miami'), |
|
61
|
|
|
'Bright and Cheerful alcove studio', |
|
62
|
|
|
'1451 Ocean Dr, Miami Beach, FL 33139', |
|
63
|
|
|
'25.785107', '-80.129460', 200, 'day', |
|
64
|
|
|
], |
|
65
|
|
|
[ |
|
66
|
|
|
$this->getReference('Rent'), |
|
67
|
|
|
$this->getReference('Penthouse'), |
|
68
|
|
|
$this->getReference('Palm Beach'), |
|
69
|
|
|
'Stylish two-level penthouse in Palm Beach', |
|
70
|
|
|
'101 Worth Ave, Palm Beach, FL 33480', |
|
71
|
|
|
'26.701320', '-80.033688', 2000, 'mo', |
|
72
|
|
|
], |
|
73
|
|
|
[ |
|
74
|
|
|
$this->getReference('Rent'), |
|
75
|
|
|
$this->getReference('Apartment'), |
|
76
|
|
|
$this->getReference('Palm Beach'), |
|
77
|
|
|
'Bright fully furnished 1-bedroom flat on the 2nd floor', |
|
78
|
|
|
'300 S Ocean Blvd, Palm Beach, FL', |
|
79
|
|
|
'26.705007', '-80.033574', 180, 'day', |
|
80
|
|
|
], |
|
81
|
|
|
[ |
|
82
|
|
|
$this->getReference('Sale'), |
|
83
|
|
|
$this->getReference('Villa'), |
|
84
|
|
|
$this->getReference('Tampa'), |
|
85
|
|
|
'Beautiful villa for sale in Tampa', |
|
86
|
|
|
'4935 New Providence Ave, Tampa, FL', |
|
87
|
|
|
'27.932255', '-82.533187', 1600, 'sq. foot', |
|
88
|
|
|
], |
|
89
|
|
|
[ |
|
90
|
|
|
$this->getReference('Rent'), |
|
91
|
|
|
$this->getReference('Apartment'), |
|
92
|
|
|
$this->getReference('Tampa'), |
|
93
|
|
|
'Furnished renovated 2-bedroom 2-bathroom flat', |
|
94
|
|
|
'5411 Bayshore Blvd, Tampa, FL 33611', |
|
95
|
|
|
'27.885095', '-82.486153', 2200, 'mo', |
|
96
|
|
|
], |
|
97
|
|
|
[ |
|
98
|
|
|
$this->getReference('Sale'), |
|
99
|
|
|
$this->getReference('Apartment'), |
|
100
|
|
|
$this->getReference('Miami'), |
|
101
|
|
|
'Interesting two-bedroom apartment for sale', |
|
102
|
|
|
'111 NE 2nd Ave, Miami, FL 33132', |
|
103
|
|
|
'25.775565', '-80.190125', 190000, '', |
|
104
|
|
|
], |
|
105
|
|
|
]; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
private function getPropertyContent(): string |
|
109
|
|
|
{ |
|
110
|
|
|
return '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, |
|
111
|
|
|
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
|
112
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco |
|
113
|
|
|
laboris nisi ut aliquip ex ea commodo consequat. |
|
114
|
|
|
Duis aute irure dolor in reprehenderit in voluptate |
|
115
|
|
|
velit esse cillum dolore eu fugiat nulla pariatur. |
|
116
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui |
|
117
|
|
|
officia deserunt mollit anim id est laborum.</p> |
|
118
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem |
|
119
|
|
|
accusantium doloremque laudantium, totam rem aperiam, |
|
120
|
|
|
eaque ipsa quae ab illo inventore veritatis et quasi |
|
121
|
|
|
architecto beatae vitae dicta sunt explicabo. |
|
122
|
|
|
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut |
|
123
|
|
|
odit aut fugit, sed quia consequuntur magni dolores eos qui |
|
124
|
|
|
ratione voluptatem sequi nesciunt. Neque porro quisquam est, |
|
125
|
|
|
qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, |
|
126
|
|
|
sed quia non numquam eius modi tempora incidunt ut labore et dolore |
|
127
|
|
|
magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, |
|
128
|
|
|
quis nostrum exercitationem ullam corporis suscipit laboriosam, |
|
129
|
|
|
nisi ut aliquid ex ea commodi consequatur.</p>'; |
|
130
|
|
|
} |
|
131
|
|
|
} |
|
132
|
|
|
|