Man*_*raj 1 cakephp cakephp-1.3 cakephp-model
我有一个模拟Job的Jobs for Jobs.
当我点击/ jobs(作业控制器的索引功能)时,我需要在其他2个表(未加入Job)上运行查询,以查找在实际显示索引之前手动插入作业的值.
我尝试了几件事但似乎无法在此方面取得任何进展.
谁能帮我这个?
1)从客户和包的连接中选择字段(复杂条件)2)遍历结果并在作业中插入/更新值3)显示作业
先感谢您.
Manikandan
您可以通过多种方式加载不相关的模型,但这可能是控制器的最佳模型:
$this->loadModel('Customer');
$customers = $this->Customer->find('all');
Run Code Online (Sandbox Code Playgroud)
替代方案包括:
ClassRegistry::init('Customer')->find('all');
// or (equivalent)
$customer = ClassRegistry::init('Customer')
$customers = $customer->find('all');
Run Code Online (Sandbox Code Playgroud)
要么:
App::import('Model', 'Customer');
$customer = new Customer();
$customers = $customer->find('all');
Run Code Online (Sandbox Code Playgroud)