public function getModelName($type = 'plural')
    {
        if ($type == 'plural') {
            if (isset($this->pluralName)) {
                return $this->pluralName;
            } else {
                $config = $this->getDI()->get('config');
                $modelNameSpace = $config['namespaces']['models'];

                $name = get_class($this);
                $name = str_replace($modelNameSpace, '', $name);
                $this->pluralName = $name;
                return $this->pluralName;
            }
        }

        if ($type == 'singular') {
            if (!isset($this->singularName)) {
                $this->singularName = substr($this->getModelName('plural'), 0, strlen($this->getModelName('plural')) - 1);
            }
            return $this->singularName;
        }

        // todo throw an error here?
        return false;
    }
public function getModelName($type = 'plural')
    {
        if ($type == 'plural') {
            if (isset($this->pluralName)) {
                return $this->pluralName;
            } else {
                $config = $this->getDI()->get('config');
                $modelNameSpace = $config['namespaces']['models'];

                $name = get_class($this);
                $name = str_replace($modelNameSpace, '', $name);
                $this->pluralName = $name;
                return $this->pluralName;
            }
        }

        if ($type == 'singular') {
            if (!isset($this->singularName)) {
                $this->singularName = substr($this->getModelName('plural'), 0, strlen($this->getModelName('plural')) - 1);
            }
            return $this->singularName;
        }

        // todo throw an error here?
        return false;
    }
public function getModelName ( $ type = 'plural' ) { if ( $ type == 'plural' ) { if ( isset ( $ this -> pluralName ) ) { return $ this -> pluralName ; } else { $ config = $ this -> getDI ( ) -> get ( 'config' ) ; $ modelNameSpace = $ config [ 'namespaces' ] [ 'models' ] ; $ name = get_class ( $ this ) ; $ name = str_replace ( $ modelNameSpace , '' , $ name ) ; $ this -> pluralName = $ name ; return $ this -> pluralName ; } } if ( $ type == 'singular' ) { if ( ! isset ( $ this -> singularName ) ) { $ this -> singularName = substr ( $ this -> getModelName ( 'plural' ) , 0 , strlen ( $ this -> getModelName ( 'plural' ) ) - 1 ) ; } return $ this -> singularName ; } // todo throw an error here? return false ; }
provided to lazy load the model's name

@param string $type singular|plural
@return string
provided to lazy load the model s name