2017-03-29 1 views
0

Ich versuchte Abfrage in CakePHP zu machen mit beitritt, aber ich möchte mehr fileds bekommen,wie einige Felder von Tabellen in CakePHP wählen

Hier ist die SQL-Abfrage:

SELECT 
    sd.debut, 
    sd.fin, 
    fr.id, 
    f.id as formtaion_id, 
    s.id as seance_id, 
    fr.nom as formateur, 
    f.nom as formation, 
    r.title, 
    f.module, 
    sd.module as partie , 
    f.couleur 
FROM seances s 
    INNER JOIN formations f on s.formation_id = f.id 
    INNER JOIN seances_dates sd on s.id = sd.seance_id 
    INNER JOIN salles sa on sa.id = s.salle_id 
    INNER JOIN regions r on r.id = sa.region_id 
    INNER JOIN presence_formateurs pf ON pf.seance_id = s.id 
    INNER JOIN formateurs fr ON fr.id = pf.formateur_id 
    WHERE fr.archived = 0 
     AND fr.deleted is null 
     AND (
      (sd.debut between '".$from."' and '".$to."') 
      OR 
      (sd.fin between '".$from."' and '".$to."') 
     ) 
GROUP BY sd.id 
ORDER BY sd.debut 

bitte helfen mir diese Abfrage in cakephp zu machen:

Class :: init ('Seance') -> find ('alle' ....

+0

Haben Sie irgendein Modell erstellt lesen sollte? –

+0

nein wird Plugin in CakePHP machen und nur ich werde ein Modell wie folgt aufrufen: require (ROOT.DS.APP_DIR.DS.'models'.Ds.'formateur.php '); – Fredj

Antwort

Verwandte Themen