Browse code

Add geodata fields

Benjamin Roth authored on01/10/2024 13:29:28
Showing1 changed files
... ...
@@ -12,10 +12,17 @@ namespace vonRotenberg\RealEstateListingBundle\EventListener;
12 12
 
13 13
 use Contao\CoreBundle\ServiceAnnotation\Callback;
14 14
 use Contao\DataContainer;
15
+use Doctrine\DBAL\Connection;
15 16
 use vonRotenberg\RealEstateListingBundle\Model\ManagedPropertyModel;
16 17
 
17 18
 class ReManagedPropertiesContainerListener
18 19
 {
20
+    private $db;
21
+    public function __construct(Connection $db)
22
+    {
23
+        $this->db = $db;
24
+    }
25
+
19 26
     /**
20 27
      * @Callback(table="tl_vr_re_managedProperties", target="config.onsubmit")
21 28
      */
... ...
@@ -24,7 +31,8 @@ class ReManagedPropertiesContainerListener
24 31
         if (!$dc->id || ($Property = ManagedPropertyModel::findByPk($dc->id)) === null) {
25 32
             return;
26 33
         }
34
+        dump($this->db);
27 35
 
28
-        $this->db->update('tl_vr_real_estate_assets', ['managedPropertyId' => $dc->id], ['geox' => $Property->geox, 'geoy' => $Property->geoy]);
36
+        $this->db->update('tl_vr_real_estate_assets', ['geox' => $Property->geox, 'geoy' => $Property->geoy],['managedPropertyId' => $dc->id]);
29 37
     }
30 38
 }