Cakephp way
class User extends AppModel {
public $actsAs = array('Containable');
public $hasMany = array('Message');
}
class Message extends AppModel {
public $actsAs = array('Containable');
public $belongsTo = array('User');
}
You need to change the messages.from column to be messages.user_id so that cake can automagically associate the records for you.
Then you can do this from the messages controller:
$this->Message->find('all',...
Selasa, 28 Februari 2017
Cakephp Relasi type inner atau left/right
Read More
Langganan:
Postingan
(
Atom
)