atk4\data\Reference_SQL_One::ref PHP Method

ref() public method

public ref ( $defaults = [] )
    public function ref($defaults = [])
    {
        $m = parent::ref($defaults);
        // If model is not loaded, then we are probably doing deep traversal
        if (!$this->owner->loaded() && isset($this->owner->persistence) && $this->owner->persistence instanceof Persistence_SQL) {
            $values = $this->owner->action('field', [$this->our_field]);
            return $m->addCondition($this->their_field ?: $m->id_field, $values);
        }
        return $m;
    }