Added assert, all arrays are empty initialized now
authorRoland Häder <roland@mxchange.org>
Wed, 13 Feb 2013 01:25:11 +0000 (01:25 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 13 Feb 2013 01:25:11 +0000 (01:25 +0000)
inc/classes/main/criteria/class_BaseCriteria.php

index b1102e283c2751502440b27327372e06ce437696..6a4511028b841be3baaa5238c38c21bac78d09c7 100644 (file)
@@ -30,7 +30,14 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
        /**
         * Criteria to handle
         */
-       private $criteria = array();
+       private $criteria = array(
+               // Default
+               'default' => array(),
+               // Choice
+               'choice'  => array(),
+               // .. and exclude
+               'exclude' => array(),
+       );
 
        /**
         * Protected constructor
@@ -255,6 +262,12 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $cacheKey       The key suitable for the cache system
         */
        public function getCacheKey ($onlyKeys = array(), $criteriaType = 'default') {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($this->__toString() . ': criteriaType=' . $criteriaType . ',count()=' . count($this->criteria));
+
+               // Make sure the criteria is there
+               assert((isset($this->criteria[$criteriaType])) && (is_array($this->criteria[$criteriaType])));
+
                // Initialize the key
                $cacheKey = '';