Greetings,
I recently upgraded from 1.3 to 2.0 and am now experiencing errors from the APC metdata cache when I do a basic model save. Everything worked fine in 1.3 and it also works fine if I remove the APC cache service. Below is the error, stack trace, and some relevant code. Please let me know if I can provide further information. Help/ideas/direction are greatly appreciated!
Best,
-b
error and stack trace
Undefined index: 1 in phalcon/mvc/model/metadata.zep on line 288 in <b>/Users/bbrown/projects/andrina/web/phalcon_apps/admin/api/index.php</b> on line <b>171</b><br />
{"error_msg":"The meta-data is invalid or is corrupt","error_trace":"#0 [internal function]: Phalcon\\Mvc\\Model\\MetaData->getPrimaryKeyAttributes(Object(RestEntity))\n#1 [internal function]: Phalcon\\Mvc\\Model->_exists(Object(Phalcon\\Mvc\\Model\\MetaData\\Apc), Object(Phalcon\\Db\\Adapter\\Pdo\\Postgresql), 'tag')\n#2 \/Users\/bbrown\/projects\/andrina\/web\/phalcon_apps\/admin\/api\/index.php(171): Phalcon\\Mvc\\Model->save()\n#3 [internal function]: {closure}('tag', '1')\n#4 \/Users\/bbrown\/projects\/andrina\/web\/phalcon_apps\/admin\/api\/index.php(250): Phalcon\\Mvc\\Micro->handle()
some relevant code
use Phalcon\Mvc\Micro;
use Phalcon\DI\FactoryDefault;
use Phalcon\Config\Adapter\Yaml as YAMLConfig;
use Phalcon\Db\Adapter\Pdo\Postgresql as PostgresAdapter;
use Phalcon\Mvc\Model\MetaData\APC as ApcMetaData;
use Phalcon\Session\Adapter\Files as Session;
/**
* service dispatcher
*/
$di = new FactoryDefault();
/**
* load config file
*/
$di->set('config', function() {
return new YAMLConfig(ANDRINA_ROOT."/etc/config.yml");
});
/**
* db handle
*/
$di->set("db", function() use($di) {
return new PostgresAdapter(array(
"host" => $di['config']->database->host,
"username" => $di['config']->database->user,
"password" => $di['config']->database->password,
"dbname" => $di['config']->database->name,
));
});
// db metadata caching
$di['modelsMetadata'] = function() {
// Create a meta-data manager with APC
$metaData = new ApcMetaData(array(
"lifetime" => 86400,
"prefix" => "andrina"
));
return $metaData;
};
//Start the session
$di->setShared('session', function() {
$session = new Session([
'lifetime' => 3600 * 4
]);
$session->start();
return $session;
});
$app = new ApiMicro();
$app->setDI($di);
db table schema
andrina=> \d tag
Table "public.tag"
Column | Type | Modifiers
--------+-------------------------+------------------------------------------------------
tag_id | integer | not null default nextval('tag_tag_id_seq'::regclass)
name | character varying(2044) | not null
Indexes:
"tag_pkey" PRIMARY KEY, btree (tag_id)
"tag_name_key" UNIQUE CONSTRAINT, btree (name)