protected function getModelIdentity(PhalconModel $model)
    {
        if (property_exists($model, 'id')) {
            return $model->id;
        }

        if (!$this->di->has('modelsMetadata')) {
            return null;
        }

        $primaryKeys = $this->di->get('modelsMetadata')->getPrimaryKeyAttributes($model);

        switch (count($primaryKeys)) {
            case 0:
                return null;
            case 1:
                return $model->{$primaryKeys[0]};
            default:
                return array_intersect_key(get_object_vars($model), array_flip($primaryKeys));
        }
    }
protected function getModelIdentity(PhalconModel $model)
    {
        if (property_exists($model, 'id')) {
            return $model->id;
        }

        if (!$this->di->has('modelsMetadata')) {
            return null;
        }

        $primaryKeys = $this->di->get('modelsMetadata')->getPrimaryKeyAttributes($model);

        switch (count($primaryKeys)) {
            case 0:
                return null;
            case 1:
                return $model->{$primaryKeys[0]};
            default:
                return array_intersect_key(get_object_vars($model), array_flip($primaryKeys));
        }
    }
protected function getModelIdentity ( PhalconModel $ model ) { if ( property_exists ( $ model , 'id' ) ) { return $ model -> id ; } if ( ! $ this -> di -> has ( 'modelsMetadata' ) ) { return null ; } $ primaryKeys = $ this -> di -> get ( 'modelsMetadata' ) -> getPrimaryKeyAttributes ( $ model ) ; switch ( count ( $ primaryKeys ) ) { case 0 : return null ; case 1 : return $ model -> { $ primaryKeys [ 0 ] } ; default : return array_intersect_key ( get_object_vars ( $ model ) , array_flip ( $ primaryKeys ) ) ; } }
Get identity.

@param \Phalcon\Mvc\Model $model
@return mixed
Get identity .