Skip to content

Commit 2f1c02d

Browse files
authored
Merge pull request #58 from RealT-Community/feature/add_tokens_fields
Add new tokens field
2 parents 84e1254 + 11c19c1 commit 2f1c02d

File tree

3 files changed

+259
-13
lines changed

3 files changed

+259
-13
lines changed

migrations/Version20211207210507.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20211207210507 extends AbstractMigration
14+
{
15+
public function getDescription() : string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema) : void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
24+
25+
$this->addSql('ALTER TABLE tokens ADD initial_launch_date DATE DEFAULT NULL, ADD series_number INT DEFAULT NULL, ADD construction_year DATE DEFAULT NULL, ADD construction_type VARCHAR(50) DEFAULT NULL, ADD roof_type VARCHAR(50) DEFAULT NULL, ADD asset_parking VARCHAR(50) DEFAULT NULL, ADD foundation VARCHAR(50) DEFAULT NULL, ADD heating VARCHAR(50) DEFAULT NULL, ADD cooling VARCHAR(50) DEFAULT NULL, ADD token_id_rules INT DEFAULT NULL, ADD rent_calculation_type VARCHAR(20) DEFAULT NULL');
26+
}
27+
28+
public function down(Schema $schema) : void
29+
{
30+
// this down() migration is auto-generated, please modify it to your needs
31+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
32+
33+
$this->addSql('ALTER TABLE tokens DROP initial_launch_date, DROP series_number, DROP construction_year, DROP construction_type, DROP roof_type, DROP asset_parking, DROP foundation, DROP heating, DROP cooling, DROP token_id_rules, DROP rent_calculation_type');
34+
}
35+
}

src/Entity/Token.php

Lines changed: 212 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,61 @@ class Token
279279
*/
280280
private $originSecondaryMarketplaces = [];
281281

282+
/**
283+
* @ORM\Column(type="date", nullable=true)
284+
*/
285+
private $initialLaunchDate;
286+
287+
/**
288+
* @ORM\Column(type="integer", nullable=true)
289+
*/
290+
private $seriesNumber;
291+
292+
/**
293+
* @ORM\Column(type="date", nullable=true)
294+
*/
295+
private $constructionYear;
296+
297+
/**
298+
* @ORM\Column(type="string", length=50, nullable=true)
299+
*/
300+
private $constructionType;
301+
302+
/**
303+
* @ORM\Column(type="string", length=50, nullable=true)
304+
*/
305+
private $roofType;
306+
307+
/**
308+
* @ORM\Column(type="string", length=50, nullable=true)
309+
*/
310+
private $assetParking;
311+
312+
/**
313+
* @ORM\Column(type="string", length=50, nullable=true)
314+
*/
315+
private $foundation;
316+
317+
/**
318+
* @ORM\Column(type="string", length=50, nullable=true)
319+
*/
320+
private $heating;
321+
322+
/**
323+
* @ORM\Column(type="string", length=50, nullable=true)
324+
*/
325+
private $cooling;
326+
327+
/**
328+
* @ORM\Column(type="integer", nullable=true)
329+
*/
330+
private $tokenIdRules;
331+
332+
/**
333+
* @ORM\Column(type="string", length=20, nullable=true)
334+
*/
335+
private $rentCalculationType;
336+
282337
public function getId(): ?int
283338
{
284339
return $this->id;
@@ -912,6 +967,150 @@ public function setRentStartDate(?\DateTimeInterface $rentStartDate): self
912967
return $this;
913968
}
914969

970+
public function getOriginSecondaryMarketplaces(): ?array
971+
{
972+
return $this->originSecondaryMarketplaces;
973+
}
974+
975+
public function setOriginSecondaryMarketplaces(?array $originSecondaryMarketplaces): self
976+
{
977+
$this->originSecondaryMarketplaces = $originSecondaryMarketplaces;
978+
979+
return $this;
980+
}
981+
982+
public function getInitialLaunchDate(): ?\DateTimeInterface
983+
{
984+
return $this->initialLaunchDate;
985+
}
986+
987+
public function setInitialLaunchDate(?\DateTimeInterface $initialLaunchDate): self
988+
{
989+
$this->initialLaunchDate = $initialLaunchDate;
990+
991+
return $this;
992+
}
993+
994+
public function getSeriesNumber(): ?int
995+
{
996+
return $this->seriesNumber;
997+
}
998+
999+
public function setSeriesNumber(?int $seriesNumber): self
1000+
{
1001+
$this->seriesNumber = $seriesNumber;
1002+
1003+
return $this;
1004+
}
1005+
1006+
public function getConstructionYear(): ?\DateTimeInterface
1007+
{
1008+
return $this->constructionYear;
1009+
}
1010+
1011+
public function setConstructionYear(?\DateTimeInterface $constructionYear): self
1012+
{
1013+
$this->constructionYear = $constructionYear;
1014+
1015+
return $this;
1016+
}
1017+
1018+
public function getConstructionType(): ?string
1019+
{
1020+
return $this->constructionType;
1021+
}
1022+
1023+
public function setConstructionType(?string $constructionType): self
1024+
{
1025+
$this->constructionType = $constructionType;
1026+
1027+
return $this;
1028+
}
1029+
1030+
public function getRoofType(): ?string
1031+
{
1032+
return $this->roofType;
1033+
}
1034+
1035+
public function setRoofType(?string $roofType): self
1036+
{
1037+
$this->roofType = $roofType;
1038+
1039+
return $this;
1040+
}
1041+
1042+
public function getAssetParking(): ?string
1043+
{
1044+
return $this->assetParking;
1045+
}
1046+
1047+
public function setAssetParking(?string $assetParking): self
1048+
{
1049+
$this->assetParking = $assetParking;
1050+
1051+
return $this;
1052+
}
1053+
1054+
public function getFoundation(): ?string
1055+
{
1056+
return $this->foundation;
1057+
}
1058+
1059+
public function setFoundation(?string $foundation): self
1060+
{
1061+
$this->foundation = $foundation;
1062+
1063+
return $this;
1064+
}
1065+
1066+
public function getHeating(): ?string
1067+
{
1068+
return $this->heating;
1069+
}
1070+
1071+
public function setHeating(?string $heating): self
1072+
{
1073+
$this->heating = $heating;
1074+
1075+
return $this;
1076+
}
1077+
1078+
public function getCooling(): ?string
1079+
{
1080+
return $this->cooling;
1081+
}
1082+
1083+
public function setCooling(?string $cooling): self
1084+
{
1085+
$this->cooling = $cooling;
1086+
1087+
return $this;
1088+
}
1089+
1090+
public function getTokenIdRules(): ?int
1091+
{
1092+
return $this->tokenIdRules;
1093+
}
1094+
1095+
public function setTokenIdRules(?int $tokenIdRules): self
1096+
{
1097+
$this->tokenIdRules = $tokenIdRules;
1098+
1099+
return $this;
1100+
}
1101+
1102+
public function getRentCalculationType(): ?string
1103+
{
1104+
return $this->rentCalculationType;
1105+
}
1106+
1107+
public function setRentCalculationType(?string $rentCalculationType): self
1108+
{
1109+
$this->rentCalculationType = $rentCalculationType;
1110+
1111+
return $this;
1112+
}
1113+
9151114
public function __toArray(array $credentials): array
9161115
{
9171116
if ($credentials['isAuth']) {
@@ -965,7 +1164,19 @@ public function __toArray(array $credentials): array
9651164
'renovationReserve' => $this->renovationReserve,
9661165
'propertyMaintenanceMonthly' => $this->propertyMaintenanceMonthly,
9671166
'rentStartDate' => $this->rentStartDate,
968-
'lastUpdate' => $this->lastUpdate
1167+
'lastUpdate' => $this->lastUpdate,
1168+
'originSecondaryMarketplaces' => $this->originSecondaryMarketplaces,
1169+
'initialLaunchDate' => $this->initialLaunchDate,
1170+
'seriesNumber' => $this->seriesNumber,
1171+
'constructionYear' => $this->constructionYear,
1172+
'constructionType' => $this->constructionType,
1173+
'roofType' => $this->roofType,
1174+
'assetParking' => $this->assetParking,
1175+
'foundation' => $this->foundation,
1176+
'heating' => $this->heating,
1177+
'cooling' => $this->cooling,
1178+
'tokenIdRules' => $this->tokenIdRules,
1179+
'rentCalculationType' => $this->rentCalculationType
9691180
];
9701181
} else {
9711182
$response = [
@@ -988,16 +1199,4 @@ public function __toArray(array $credentials): array
9881199

9891200
return $response;
9901201
}
991-
992-
public function getOriginSecondaryMarketplaces(): ?array
993-
{
994-
return $this->originSecondaryMarketplaces;
995-
}
996-
997-
public function setOriginSecondaryMarketplaces(?array $originSecondaryMarketplaces): self
998-
{
999-
$this->originSecondaryMarketplaces = $originSecondaryMarketplaces;
1000-
1001-
return $this;
1002-
}
10031202
}

src/Service/TokenService.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ private function tokenMapping(array $dataJson, ?Token $token = null): Token
416416
? new DateTime($dataJson['rentStartDate'])
417417
: null);
418418
$token->setInitialMaintenanceReserve($dataJson['initialMaintenanceReserve'] ?: null);
419+
$token->setInitialLaunchDate($dataJson['initialLaunchDate']);
420+
$token->setSeriesNumber($dataJson['seriesNumber']);
421+
$token->setConstructionYear($dataJson['constructionYear']);
422+
$token->setConstructionType($dataJson['constructionType']);
423+
$token->setRoofType($dataJson['roofType']);
424+
$token->setAssetParking($dataJson['assetParking']);
425+
$token->setFoundation($dataJson['foundation']);
426+
$token->setHeating($dataJson['heating']);
427+
$token->setCooling($dataJson['cooling']);
428+
$token->setTokenIdRules($dataJson['tokenIdRules']);
429+
$token->setRentCalculationType($dataJson['rentCalculationType']);
430+
419431
$token->setLastUpdate(new DateTime());
420432

421433
return $token;

0 commit comments

Comments
 (0)