public function collections()
    {
        if (!$this->collections) {
            $this->collections = [];

            /** @var \record_adapter $record */
            foreach ($this as $record) {
                if (! isset($this->collections[$record->getBaseId()])) {
                    $this->collections[$record->getBaseId()] = $record->get_collection();
                }
            }

            $this->collections = array_values($this->collections);
        }

        return $this->collections;
    }
public function collections()
    {
        if (!$this->collections) {
            $this->collections = [];

            /** @var \record_adapter $record */
            foreach ($this as $record) {
                if (! isset($this->collections[$record->getBaseId()])) {
                    $this->collections[$record->getBaseId()] = $record->get_collection();
                }
            }

            $this->collections = array_values($this->collections);
        }

        return $this->collections;
    }
public function collections ( ) { if ( ! $ this -> collections ) { $ this -> collections = [ ] ; /** @var \record_adapter $record */ foreach ( $ this as $ record ) { if ( ! isset ( $ this -> collections [ $ record -> getBaseId ( ) ] ) ) { $ this -> collections [ $ record -> getBaseId ( ) ] = $ record -> get_collection ( ) ; } } $ this -> collections = array_values ( $ this -> collections ) ; } return $ this -> collections ; }
Return all distinct collections related to the contained records

@return \collection[]
Return all distinct collections related to the contained records