public function getMetaData(ModelInterface $model, DiInterface $di)
    {
        /** @var Reflection $reflection */
        $reflection = $di->getAnnotations()->get($model);
        $properties = $reflection->getPropertiesAnnotations();
        if (!$properties) {
            throw new \Exception('There are no properties defined on the class');
        }

        $tableProperties = $reflection->getClassAnnotations();

        if ($tableProperties && $tableProperties->has('Source')) {
            $source = $tableProperties->get('Source')->getArguments()[0];
        } else {
            throw new \Exception('Model ' . get_class($model) . ' has no Source defined');
        }

        /** @var \Phalcon\Db\Adapter $database */
        $database = $di->get($source);
        $dbType = ucfirst($database->getType());
        $indexes = $this->getIndexes($reflection);

        return call_user_func_array(['\Phalcon\Annotations\DbStrategies\\'.$dbType, 'getMetaData'], [$reflection, $properties, $indexes]);
    }
public function getMetaData(ModelInterface $model, DiInterface $di)
    {
        /** @var Reflection $reflection */
        $reflection = $di->getAnnotations()->get($model);
        $properties = $reflection->getPropertiesAnnotations();
        if (!$properties) {
            throw new \Exception('There are no properties defined on the class');
        }

        $tableProperties = $reflection->getClassAnnotations();

        if ($tableProperties && $tableProperties->has('Source')) {
            $source = $tableProperties->get('Source')->getArguments()[0];
        } else {
            throw new \Exception('Model ' . get_class($model) . ' has no Source defined');
        }

        /** @var \Phalcon\Db\Adapter $database */
        $database = $di->get($source);
        $dbType = ucfirst($database->getType());
        $indexes = $this->getIndexes($reflection);

        return call_user_func_array(['\Phalcon\Annotations\DbStrategies\\'.$dbType, 'getMetaData'], [$reflection, $properties, $indexes]);
    }
public function getMetaData ( ModelInterface $ model , DiInterface $ di ) { /** @var Reflection $reflection */ $ reflection = $ di -> getAnnotations ( ) -> get ( $ model ) ; $ properties = $ reflection -> getPropertiesAnnotations ( ) ; if ( ! $ properties ) { throw new \ Exception ( 'There are no properties defined on the class' ) ; } $ tableProperties = $ reflection -> getClassAnnotations ( ) ; if ( $ tableProperties && $ tableProperties -> has ( 'Source' ) ) { $ source = $ tableProperties -> get ( 'Source' ) -> getArguments ( ) [ 0 ] ; } else { throw new \ Exception ( 'Model ' . get_class ( $ model ) . ' has no Source defined' ) ; } /** @var \Phalcon\Db\Adapter $database */ $ database = $ di -> get ( $ source ) ; $ dbType = ucfirst ( $ database -> getType ( ) ) ; $ indexes = $ this -> getIndexes ( $ reflection ) ; return call_user_func_array ( [ '\Phalcon\Annotations\DbStrategies\\' . $ dbType , 'getMetaData' ] , [ $ reflection , $ properties , $ indexes ] ) ; }
Initializes the model's meta-data

@param ModelInterface $model
@param DiInterface $di
@return mixed
@throws \Exception
Initializes the model s meta - data