unload() public method

forget currently loaded record and it's ID. Will not affect database
public unload ( )
Example #1
0
File: Many.php Project: atk4/atk4
 public function ref($mode = null)
 {
     if (!$this->owner->loaded()) {
         throw $this->exception('Model must be loaded before traversing reference');
     }
     if ($mode == 'model') {
         /** @type SQL_Model $m */
         $m = $this->add($this->model_name);
         return $m->addCondition($this->their_field, $this->owner->get($this->our_field));
     }
     $this->restoreConditions();
     $this->model->unload();
     return $this->model->addCondition($this->their_field, $this->owner->get($this->our_field));
 }