src/Norm/Connection.php
public function factory($collection)
    {
        if ($collection instanceof Collection) {
            $collectionName = $collection->getName();
        } else {
            $collectionName = $collection;
        }

        if (!isset($this->collections[$collectionName])) {
            if (!($collection instanceof Collection)) {
                $collection = Norm::createCollection(array(
                    'name' => $collection,
                    'connection' => $this,
                ));

                $this->applyHook('norm.after.factory', $collection);
            }

            $this->collections[$collectionName] = $collection;
        }

        return $this->collections[$collectionName];
    }
public function factory($collection)
    {
        if ($collection instanceof Collection) {
            $collectionName = $collection->getName();
        } else {
            $collectionName = $collection;
        }

        if (!isset($this->collections[$collectionName])) {
            if (!($collection instanceof Collection)) {
                $collection = Norm::createCollection(array(
                    'name' => $collection,
                    'connection' => $this,
                ));

                $this->applyHook('norm.after.factory', $collection);
            }

            $this->collections[$collectionName] = $collection;
        }

        return $this->collections[$collectionName];
    }
public function factory ( $ collection ) { if ( $ collection instanceof Collection ) { $ collectionName = $ collection -> getName ( ) ; } else { $ collectionName = $ collection ; } if ( ! isset ( $ this -> collections [ $ collectionName ] ) ) { if ( ! ( $ collection instanceof Collection ) ) { $ collection = Norm :: createCollection ( array ( 'name' => $ collection , 'connection' => $ this , ) ) ; $ this -> applyHook ( 'norm.after.factory' , $ collection ) ; } $ this -> collections [ $ collectionName ] = $ collection ; } return $ this -> collections [ $ collectionName ] ; }
Factory to create new collection by its name or instance

@param string|Norm\Collection $collection Collection name or instance

@return Norm\Collection Conllection created by factory
Factory to create new collection by its name or instance