Example #1
0
 /**
  * Merges an ORM_Validation_Exception object into the current exception
  * Useful when you want to combine errors into one array
  *
  * @param  ORM_Validation_Exception $object   The exception to merge
  * @param  mixed                    $has_many The array key to use if this exception can be merged multiple times
  * @return ORM_Validation_Exception
  */
 public function merge(ORM_Validation_Exception $object, $has_many = FALSE)
 {
     $alias = $object->alias();
     // We will need this when generating errors
     $this->_objects[$alias]['_has_many'] = $has_many !== FALSE;
     if ($has_many === TRUE) {
         // This is most likely a has_many relationship
         $this->_objects[$alias][] = $object->objects();
     } elseif ($has_many) {
         // This is most likely a has_many relationship
         $this->_objects[$alias][$has_many] = $object->objects();
     } else {
         $this->_objects[$alias] = $object->objects();
     }
     return $this;
 }
Example #2
0
 /**
  * Merges an ORM_Validation_Exception object into the current exception
  * Useful when you want to combine errors into one array
  *
  * @param  string                   $alias    The relationship alias from the model
  * @param  ORM_Validation_Exception $object   The exception to merge
  * @param  mixed                    $has_many The array key to use if this exception can be merged multiple times
  * @return ORM_Validation_Exception
  */
 public function merge($alias, ORM_Validation_Exception $object, $has_many = FALSE)
 {
     if ($has_many === TRUE) {
         // This is most likely a has_many relationship
         $this->_objects[$alias][] = $object->objects();
     } elseif ($has_many) {
         // This is most likely a has_many relationship
         $this->_objects[$alias][$has_many] = $object->objects();
     } else {
         $this->_objects[$alias] = $object->objects();
     }
     return $this;
 }