]> _ Git - cubist_cms-back.git/commitdiff
wait #4865 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 10 Nov 2021 16:00:00 +0000 (17:00 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 10 Nov 2021 16:00:00 +0000 (17:00 +0100)
src/app/Magic/Fields/Field.php

index ea187f613b1ca189ce7fac1a98ecce6f8f048d06..7e593884801658e49f63d8345790c2d7e64465da 100644 (file)
@@ -264,8 +264,14 @@ class Field implements \ArrayAccess
             $crud->addClause('whereIn', $name, json_decode($value));
         } else if ($type === 'date_range') {
             $dates = json_decode($value);
-            $crud->addClause('where', $name, '>=', trim($dates->from));
-            $crud->addClause('where', $name, '<=', trim($dates->to));
+            if (null !== $dates) {
+                if ($dates->from) {
+                    $crud->addClause('where', $name, '>=', trim($dates->from));
+                }
+                if ($dates->to) {
+                    $crud->addClause('where', $name, '<=', trim($dates->to));
+                }
+            }
         }
     }
 
@@ -322,7 +328,8 @@ class Field implements \ArrayAccess
         }
     }
 
-    public function getDatabaseLength(){
+    public function getDatabaseLength()
+    {
         return $this->getAttribute('database_length');
     }