From 62564be28991a32bf3b72f334bd165da5bdb088d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Sat, 28 Aug 2021 06:53:44 +0200 Subject: [PATCH] Remove short title Add preUpdate doctrine lifecycle callbacks --- Entity/Location.php | 27 ---------------------- Repository/LocationRepository.php | 3 +-- Resources/config/doctrine/Location.orm.yml | 5 ++-- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/Entity/Location.php b/Entity/Location.php index 6e66cea..4af1280 100644 --- a/Entity/Location.php +++ b/Entity/Location.php @@ -28,11 +28,6 @@ class Location { */ private $title; - /** - * @var string - */ - private $short; - /** * @var string */ @@ -128,28 +123,6 @@ class Location { return $this->title; } - /** - * Set short - * - * @param string $short - * - * @return Location - */ - public function setShort(string $short): Location { - $this->short = $short; - - return $this; - } - - /** - * Get short - * - * @return string - */ - public function getShort(): string { - return $this->short; - } - /** * Set address * diff --git a/Repository/LocationRepository.php b/Repository/LocationRepository.php index f5efbc6..129a176 100644 --- a/Repository/LocationRepository.php +++ b/Repository/LocationRepository.php @@ -148,7 +148,7 @@ ORDER BY '.(!empty($userId)?'COUNT(a.id) DESC, ':'').'COUNT(s.id) DESC, l.id' ]; //Set the request - $req = 'SELECT l.id, l.title, l.short + $req = 'SELECT l.id, l.title FROM RapsysAirBundle:UserLocation AS ul JOIN RapsysAirBundle:Location AS l ON (l.id = ul.location_id) WHERE ul.user_id = :uid'; @@ -164,7 +164,6 @@ WHERE ul.user_id = :uid'; $rsm->addEntityResult('RapsysAirBundle:Location', 'l'); $rsm->addFieldResult('l', 'id', 'id'); $rsm->addFieldResult('l', 'title', 'title'); - $rsm->addFieldResult('l', 'short', 'short'); //Send result return $em diff --git a/Resources/config/doctrine/Location.orm.yml b/Resources/config/doctrine/Location.orm.yml index 41a3e0c..0cb8dfc 100644 --- a/Resources/config/doctrine/Location.orm.yml +++ b/Resources/config/doctrine/Location.orm.yml @@ -13,9 +13,6 @@ Rapsys\AirBundle\Entity\Location: title: type: string length: 32 - short: - type: string - length: 16 address: type: string length: 32 @@ -54,3 +51,5 @@ Rapsys\AirBundle\Entity\Location: #XXX: used in SessionRepository::(findAllPendingDailyWeather|findAllPendingHourlyWeather) zipcode: columns: [ zipcode ] + lifecycleCallbacks: + preUpdate: ['preUpdate'] -- 2.41.1