I can not use Models Metadata, the page is blank, no error message

I used the code sample on the document: https://docs.phalconphp.com/en/latest/reference/models-metadata.html#manual-metadata
The page is blank, no any error message. Example tested? has a problem?

use Phalcon\Mvc\Model;
class Mymodel extends Model
{
    public function metaData()
    {
        return  MetaData::MODELS_ATTRIBUTES => [
                "id",
                "title",
                "addtime",
            ]
        ]
    }
}


30.7k
edited Oct '16

Hi,

did you declare: use Phalcon\Mvc\Model\MetaData; in your model ?

also metaData must be instantiate in the DI.

edited Oct '16

Did you even read le51 what is wrote in docs ? This is for not having need to set intospection and metaData service. You forgot ; after

 return  MetaData::MODELS_ATTRIBUTES => [
                "id",
                "title",
                "addtime",
            ]
        ]

Also there is no needed ] Using IDE you would know about this. Even some good editors should inform about this. Because this is just php syntax.