I am writing this blog for them who are learning Cakephp 3. This blog will going to help you to find the solution for checking if record exists.
In Cakephp 2 we can check records which exist by using Model::hasAny . For Example:
- $conditions = array( 'User.id' => $this->Session->read('User.id'),
- 'User.security_key' => $this->Session->read('User.key') );
- if ($this->User->hasAny($conditions)){
- //do something
- }
Also read such more blogs about PHP and Cake PHP visit our Nerd Digest’s PHP Development Blogs Section.
No comments:
Post a Comment