public function getEntity()
    {
        if ($this->entity == false) {
            $config = $this->getDI()->get('config');
            $model = $this->getModel();
            $searchHelper = $this->getSearchHelper();
            $entity = $config['namespaces']['entities'] . $this->getControllerName('singular') . 'Entity';
            $entityPath = $config['application']['entitiesDir'] . $this->getControllerName('singular') . 'Entity.php';
            $defaultEntityNameSpace = $config['namespaces']['defaultEntity'];

            //check for file, otherwise load generic entity - it should work just fine
            if (file_exists($entityPath)) {
                $entity = new $entity($model, $searchHelper);
            } else {
                $entity = new $defaultEntityNameSpace($model, $searchHelper);
            }
            $this->entity = $this->configureEntity($entity);
        }
        return $this->entity;
    }
public function getEntity()
    {
        if ($this->entity == false) {
            $config = $this->getDI()->get('config');
            $model = $this->getModel();
            $searchHelper = $this->getSearchHelper();
            $entity = $config['namespaces']['entities'] . $this->getControllerName('singular') . 'Entity';
            $entityPath = $config['application']['entitiesDir'] . $this->getControllerName('singular') . 'Entity.php';
            $defaultEntityNameSpace = $config['namespaces']['defaultEntity'];

            //check for file, otherwise load generic entity - it should work just fine
            if (file_exists($entityPath)) {
                $entity = new $entity($model, $searchHelper);
            } else {
                $entity = new $defaultEntityNameSpace($model, $searchHelper);
            }
            $this->entity = $this->configureEntity($entity);
        }
        return $this->entity;
    }
public function getEntity ( ) { if ( $ this -> entity == false ) { $ config = $ this -> getDI ( ) -> get ( 'config' ) ; $ model = $ this -> getModel ( ) ; $ searchHelper = $ this -> getSearchHelper ( ) ; $ entity = $ config [ 'namespaces' ] [ 'entities' ] . $ this -> getControllerName ( 'singular' ) . 'Entity' ; $ entityPath = $ config [ 'application' ] [ 'entitiesDir' ] . $ this -> getControllerName ( 'singular' ) . 'Entity.php' ; $ defaultEntityNameSpace = $ config [ 'namespaces' ] [ 'defaultEntity' ] ; //check for file, otherwise load generic entity - it should work just fine if ( file_exists ( $ entityPath ) ) { $ entity = new $ entity ( $ model , $ searchHelper ) ; } else { $ entity = new $ defaultEntityNameSpace ( $ model , $ searchHelper ) ; } $ this -> entity = $ this -> configureEntity ( $ entity ) ; } return $ this -> entity ; }
Load a default entity unless a custom version is detected
return the currently loaded entity

@see $entity
@return \PhalconRest\API\Entity
Load a default entity unless a custom version is detected return the currently loaded entity