public function __construct(Alert $alert) { $this->id = $alert->getId(); $this->positionLong = $alert->getPositionLong(); $this->positionLat = $alert->getPositionLat(); $this->positionCity = $alert->getPositionCity(); $this->positionDep = $alert->getPositionDep(); $this->positionCountry = $alert->getPositionCountry(); $this->category = $alert->getCategory(); $this->status = $alert->getStatus(); $this->createdAt = $alert->getCreatedAt(); $this->finishedAt = $alert->getFinishedAt(); $this->description = $alert->getDescription(); $user = new UserDTO($alert->getUserCreator()); $this->userCreator = $user; $nbDeprecated = 0; foreach ($alert->getUserHelpAlerts() as $userHelpAlert) { $this->userHelpAlerts[] = new UserHelpAlertDTO($userHelpAlert); if ($userHelpAlert->isDeprecated()) { $nbDeprecated++; } } $this->nbAlertsDeprecated = $nbDeprecated; }