public function get($modelName, $directory = null)
    {
        if (empty($modelName))
        {
            throw new ModelException("Could not load model. No name provided", 1);
        }

        // First get the directories where the model can be located
        $directories = (is_null($directory) ? $this->modelPaths : array($directory));

        // Fire a model load event
        $event = Events::fireEvent('modelLoadEvent', $modelName, $directories);
        $directories = $event->directories;
        $modelName = $event->modelName;

        // If the event is cancelled, stop loading
        if ($event->isCancelled())
        {
            return false;
        }

        // And attempt to load the model
        return $this->loadModel($modelName, $directories);
    }
public function get($modelName, $directory = null)
    {
        if (empty($modelName))
        {
            throw new ModelException("Could not load model. No name provided", 1);
        }

        // First get the directories where the model can be located
        $directories = (is_null($directory) ? $this->modelPaths : array($directory));

        // Fire a model load event
        $event = Events::fireEvent('modelLoadEvent', $modelName, $directories);
        $directories = $event->directories;
        $modelName = $event->modelName;

        // If the event is cancelled, stop loading
        if ($event->isCancelled())
        {
            return false;
        }

        // And attempt to load the model
        return $this->loadModel($modelName, $directories);
    }
public function get ( $ modelName , $ directory = null ) { if ( empty ( $ modelName ) ) { throw new ModelException ( "Could not load model. No name provided" , 1 ) ; } // First get the directories where the model can be located $ directories = ( is_null ( $ directory ) ? $ this -> modelPaths : array ( $ directory ) ) ; // Fire a model load event $ event = Events :: fireEvent ( 'modelLoadEvent' , $ modelName , $ directories ) ; $ directories = $ event -> directories ; $ modelName = $ event -> modelName ; // If the event is cancelled, stop loading if ( $ event -> isCancelled ( ) ) { return false ; } // And attempt to load the model return $ this -> loadModel ( $ modelName , $ directories ) ; }
Get a model.

Supply the name and the model will be loaded from the supplied directory,
or from one of the modelPaths (which you can add).

@param string        $modelName  Name of the model
@param string|null   $directory  Directory to load the model from, will ignore $modelPaths
@return ModelAbstract|bool       The Model object
Get a model .