jay543_uk Posted June 2, 2014 Share Posted June 2, 2014 I have been learning php and have put together a simple site to track vehicle faults and repairs, but now i am trying to transfer it to cakephp framework to make it easier to work with. My problem is that i have 4 tables, the fault and repair a list of vehicles a list of symptoms a list of fault codes. Each repair can have 3 vehicles, 3 symptoms and 3 codes relating to it so i have lookup table to link the fault/repair id to the symptoms, code and vehicles. i have setup basic code for the vehicle , symptom and fault code models like this: public $hasAndBelongsToMany = array('Fault' =>array('className' => 'Fault','joinTable' => 'Faults_vehicles','foreignKey' => 'vehicle_id','associationForeignKey' => 'fault_id') );and this lets me search for any faults in the faults table with a given vehicle ID, and this works fine. My problem is how can i set it up so i can do a search for faults in the Faults table with a given vehicle ID and a given symptom ID that have a matching Fault code ID. I am very new to php and have only just started using cakephp so sorry in advance if this makes no sense at all. thanks for your time j Quote Link to comment https://forums.phpfreaks.com/topic/288944-using-multiple-lookup-tables-in-cakephp/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.