Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

Jurigag opened this issue Aug 26, 2016 · 2 comments
Labels
bug A bug report status: medium Medium
Milestone

Comments

@Jurigag
Copy link
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
Copy link
Contributor Author

Jurigag commented Aug 26, 2016

I guess duplicate of #12000

Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
Jurigag added a commit to Jurigag/cphalcon that referenced this issue Aug 26, 2016
@sergeyklay sergeyklay modified the milestones: 3.1.0, 3.0.2 Aug 26, 2016
@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

3 participants