cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[2.0.x] Undefined index: 12 in phalcon/mvc/model/metadata.zep on line 288

Open michanismus opened this issue 11 years ago • 3 comments

The exception is thrown every time I try to save a model. Function which throws error is Phalcon\Mvc\Model\MetaData->readMetaDataIndex()

Everything worked fine until I updated 2.0.x branch via git and built a new phalcon extension. I use an annotations meta data. Did you guy change something I missed?

michanismus avatar May 12 '15 14:05 michanismus

Got it! You introduced MODELS_DEFAULT_VALUES which was not returned in my Phalcon\Mvc\Model\MetaData\StrategyInterface. Works again.

Should be added to docs...

michanismus avatar May 12 '15 15:05 michanismus

Can you explain how did you solve this?

iceye avatar Jul 01 '15 11:07 iceye

Hey, like I said. My Phalcon\Mvc\Model\MetaData\StrategyInterface now returns an array including MODELS_DEFAULT_VALUES.

        return array(
           .
           ..
           ...
            MetaData::MODELS_DEFAULT_VALUES => $defaultValues,

            MetaData::MODELS_EMPTY_STRING_VALUES => $emptyStringValues
        );

Look here for an example: https://github.com/PhalconEye/framework/blob/7ed523ad9f3eb33e0bc92ef87e2ae387be8c154d/src/Db/Model/Annotations/Metadata.php

michanismus avatar Jul 01 '15 14:07 michanismus