[3.0.0]Snapshot data removed after saving to cache adapter #12170

Closed
Jurigag opened this Issue Aug 26, 2016 · 2 comments

Projects

None yet

2 participants

@Jurigag
Contributor
Jurigag commented Aug 26, 2016

Expected and Actual Behavior

The script should return:

array(11) { ["cedula"]=> string(1) "1" ["tipo_documento_id"]=> string(1) "3" ["nombres"]=> string(15) "HUANG ZHENGQUIN" ["telefono"]=> string(9) "191821112" ["direccion"]=> string(16) "CRA 25 CALLE 100" ["email"]=> string(9) "@yahoo.es" ["fecha_nacimiento"]=> string(10) "2011-02-03" ["ciudad_id"]=> string(6) "127591" ["creado_at"]=> string(10) "2011-05-18" ["cupo"]=> string(7) "6930.00" ["estado"]=> string(1) "I" } array(11) { ["cedula"]=> string(1) "1" ["tipo_documento_id"]=> string(1) "3" ["nombres"]=> string(15) "HUANG ZHENGQUIN" ["telefono"]=> string(9) "191821112" ["direccion"]=> string(16) "CRA 25 CALLE 100" ["email"]=> string(9) "@yahoo.es" ["fecha_nacimiento"]=> string(10) "2011-02-03" ["ciudad_id"]=> string(6) "127591" ["creado_at"]=> string(10) "2011-05-18" ["cupo"]=> string(7) "6930.00" ["estado"]=> string(1) "I" }

But it's returning:

array(11) { ["cedula"]=> string(1) "1" ["tipo_documento_id"]=> string(1) "3" ["nombres"]=> string(15) "HUANG ZHENGQUIN" ["telefono"]=> string(9) "191821112" ["direccion"]=> string(16) "CRA 25 CALLE 100" ["email"]=> string(9) "@yahoo.es" ["fecha_nacimiento"]=> string(10) "2011-02-03" ["ciudad_id"]=> string(6) "127591" ["creado_at"]=> string(10) "2011-05-18" ["cupo"]=> string(7) "6930.00" ["estado"]=> string(1) "I" } NULL
$di = new Phalcon\DI\FactoryDefault();


$di->setShared(
    'db',
    function () {
        $connection = new Phalcon\Db\Adapter\Pdo\Mysql(
            [
                'host' => 'localhost',
                'port' => 3306,
                'dbname' => 'phalcon_test',
                'username' => 'root',
                'charset' => 'UTF8',
            ]
        );

        return $connection;
    }
);
$di->set(
    'cache',
    function () {
        $frontCache = new Data(
            [
                'lifetime' => 3600,
            ]
        );
        $cache = new \Phalcon\Cache\Backend\Libmemcached(
            $frontCache, [
                'prefix' => 'phalcon_test',
                'host' => '127.0.0.1',
                'port' => 11211,
                'persistent' => true,
            ]
        );

        return $cache;
    }
);
class Personnes extends Model
{
    public function initialize()
    {
        $this->keepSnapshots(true);
    }
}
$test = Personnes::findFirst();
var_dump($test->getSnapshotData());
$di->get('cache')->save('test', $test);
var_dump($di->get('cache')->get('test')->getSnapshotData());

Details

  • Phalcon version: 3.0.0
  • PHP Version: 7.0.9
  • Operating System: Ubuntu 14.04
  • Installation type: zephir
  • Zephir version (if any): 0.9.3a-dev-e716dbe641
  • Server: Apache
  • Other related info (Database, table schema): phalcon_test database
@Jurigag
Contributor
Jurigag commented Aug 26, 2016

I guess duplicate of #12000

@Jurigag Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@Jurigag Jurigag Fix #12000, #12170 a59a558
@Jurigag Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@Jurigag Jurigag Fix #12000, #12170 f361479
@Jurigag Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@Jurigag Jurigag Fix #12000, #12170 60538a6
@Jurigag Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@Jurigag Jurigag Fix #12000, #12170 7adb70a
@Jurigag Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@Jurigag Jurigag Fix #12000, #12170 676fd2f
@sergeyklay sergeyklay modified the milestone: 3.1.0, 3.0.2 Aug 26, 2016
@sergeyklay
Collaborator

Fixed in the 3.0.x branch.

@sergeyklay sergeyklay closed this Aug 26, 2016
@sergeyklay sergeyklay added a commit to sergeyklay/cphalcon that referenced this issue Sep 27, 2016
@Jurigag @sergeyklay Jurigag + sergeyklay Fix #12000, #12170 93483f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment