0

Final Class Yiisoft\ActiveRecord\Internal\LazyLoadResultSet

InheritanceYiisoft\ActiveRecord\Internal\LazyLoadResultSet

Counts the records of one result set that lazy loaded a relation. The counts are freed together with the result set they belong to, which the records are the only reference to.

See also Yiisoft\ActiveRecord\LazyLoadGuard.

Public Methods

Hide inherited methods

Method Description Defined By
registerLazyLoad() Registers a record that lazy loaded the relation and returns the number of records of this result set that have loaded it. A record that loads the relation again, after {@see ActiveRecordInterface::resetRelation()} or {@see ActiveRecordInterface::refresh()} dropped it, is counted once. Yiisoft\ActiveRecord\Internal\LazyLoadResultSet

Method Details

Hide inherited methods

registerLazyLoad() public method

Registers a record that lazy loaded the relation and returns the number of records of this result set that have loaded it. A record that loads the relation again, after {@see ActiveRecordInterface::resetRelation()} or {@see ActiveRecordInterface::refresh()} dropped it, is counted once.

public integer registerLazyLoad ( Yiisoft\ActiveRecord\ActiveRecordInterface $record, string $relation )
$record Yiisoft\ActiveRecord\ActiveRecordInterface
$relation string

                public function registerLazyLoad(ActiveRecordInterface $record, string $relation): int
{
    $this->records[$relation][spl_object_id($record)] = true;
    return count($this->records[$relation]);
}