dereuromark / cakephp-hashid

CakePHP plugin to use hashids for your database table lookups
MIT License
36 stars 13 forks source link

check if entity before call the dirty function #7

Closed eymen-elkum closed 8 years ago

eymen-elkum commented 8 years ago

This is necessary when we set hydrate to false

        $apps = $this->Apps->find()->where([
            'user_id' => $user['user']['id']
        ])->hydrate(false)->first();
dereuromark commented 8 years ago

Can we also have a test for this please?

eymen-elkum commented 8 years ago

I used this lines, and the $row then is array and not entity

        $apps = $this->Apps->find()->where([
            'user_id' => $user['user']['id']
        ])->hydrate(false)->first();
eymen-elkum commented 8 years ago

Fatal error: Call to a member function dirty() on a non-object in \vendor\dereuromark\cakephp-hashid\src\Model\Behavior\HashidBehavior.php on line 234

dereuromark commented 8 years ago

Please fix CS as well. So tests are green again.