Prado\Data\ActiveRecord\Relations\TActiveRecordRelation::__call PHP Метод

__call() публичный Метод

Multiple relationship calls can be chain together.
public __call ( $method, $args ) : mixed
Результат mixed TActiveRecord or array of TActiveRecord results depending on the method called.
    public function __call($method, $args)
    {
        static $stack = array();
        $results = call_user_func_array(array($this->getSourceRecord(), $method), $args);
        $validArray = is_array($results) && count($results) > 0;
        if ($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord) {
            $this->collectForeignObjects($results);
            while ($obj = array_pop($stack)) {
                $obj->collectForeignObjects($results);
            }
        } else {
            if ($results instanceof TActiveRecordRelation) {
                $stack[] = $this;
            } else {
                if ($results === null || !$validArray) {
                    $stack = array();
                }
            }
        }
        return $results;
    }