Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Search In

Unbinding Model in cakePHP

Lets say there are two models named as User and Post. A User hasMany Post, so in our User model we have a relation like this :- class User extends AppModel{ var $name = ‘User’; var $hasMany = array(‘Post’=>array(‘foreignKey’=>’user_id

Using unBindModel() in CakePHP

If we have to many tables in our project and we have many association between them. So whenever we use one of the model in our controller the other model which are associated with it , automatically get attached with user data . Sometime we don'

Discussion on bindModel and unbindModel function in CakePHP 2.x

Hi Reader's, Welcome to FindNerd,today we are going to discuss bindModel and unbindModel function in CakePHP 2.X. If we are making any web application in CakePHP then sometimes we have to use bindModel and unbindModel at a runtime. So CakePHP pr

Use of bindModel and unbindModel function

bindModel and unbindModel: bindModel() function is used to create association between models when needed and unbindModel() function is used to destroy the created association when it is no longer required. Association are used when we need data from

How use auth login in different model in cakephp

How use auth login in different model in cakephp public $components = array('Session', 'Cookie', 'Auth' => array( 'authenticate' => array('Form' => array( 'userModel' => 'Admin', 'fields' => arr

How to use another model in current model using cakephp?

Hi If you want a condition where you can load another model inside you model. you can do as I code, see the example below App::import('Model', 'MyModel'); $my_model = new MyModel(); Or you can write $this->SomeModel->MyModel; if you hav

Dynamically remove the model validation in cakephp

Hello Readers; If you want to remove the validation in cakephp from the Model dynamically then use the below one line code. $this->validator()->remove('username'); The above validation completely remove all rules for a field.(Here we use us

How to filter Model assoceation data in cakephp

By using Containable Behavior we can filter model assoceation. we use 'Containable' keyword for use contain we add this property in model class User extends AppModel { public $actsAs = array('Containable'); } and we can use this on fly also

How to use another model in your model?

Hi if you want a condition where you want to load another model inside you model. you can do as I code follow App::import('Model', 'MyModel'); $my_model = new MyModel(); Or you can write $this->SomeModel->MyModel if you have already this

Updating one field in database using CakePhp

Updation in CakePHP is basically based on knowing the primary key(Id) of the records one wants to change/edit. You can update a field in CakePhp by two ways:- a)By using saveField method $this->ModelName->id=$id; $this->ModelName->

prev 1 3 18
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: