model - cakephp - difficulty to access a specific information in my controller -


i have these tables , relationships between them:

  • 1 project hasmany configurationcontext 1 issuetype hasmany
  • optionconfiguration hasmany configurationcontext hasmany
  • optionconfiguration (does not exist intermediate table)

my goal information query.

select it.id, it.pname configurationcontext               cc left outer join optionconfiguration     oc on oc.fieldconfig = cc.fieldconfigscheme left outer join issuetype               on it.id = oc.optionid cc.project = 10000 

my doubts: - controller use create function return me information? - how information?

thanks :)

assuming have model names correct, should trick:

$this->configurationcontext->find('all', array(     'joins' => array(         array(             'table' => 'optionconfiguration',             'alias' => 'optionconfiguration',             'type' => 'left outer join',             'conditions' => array(                 'optionconfiguration.fieldconfig = configurationcontext.fieldconfigscheme'             )         ),         array(             'table' => 'issuetype',             'alias' => 'issuetype',             'type' => 'left outer join',             'conditions' => array(                 'issuetype.id = optionconfiguration.optionid'             )         )     ),     'conditions' => array(         'configurationcontext.project' => 10000     ),     'fields' => array(         'issuetype.id',         'issuetype.pname'     ) )); 

i haven't tried type "left outer join" don't see why wouldn't work, maybe using containable avoid using joins if can.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -