CakePHP Model Relationships without resorting to Recursive -


I am new to cake php and I have problems connecting all my models correctly.

This is the layout of your model in cakePHP:

class belongsTo location
Class isTo ClassType
Class isMany ScheduledClass - ScheduledClass belongsTo Trainer

My The problem is that when I use it:

  $ this-> class-> Find me ('all')   

I only get data from class, location, classotype and scheduled class model I have not got any data from the trainer model.

I can set the '2' to be included in one on "ScheduledClass.instructor_id" instead of the recurring value and retrieve data from the trainer model, but this one (one for each line) questions The result in huge zodiac = Instructor.id "

Something like what I was hoping to achieve:

  Select ... ... classes as place on the class interiors from the classes as class.location_id = Location.id interiors on ClassType Class.class_type_id Join class_types = ClassType.id Insert ScheduledClass ScheduledClass.class_id = Class.id Insert as scheduled_classes as on ScheduledClass.instructor_id = Join Trainers as Trainer at Instructor.id   < P> I use both additives and joining to get the right data The Oshis, but I was not able to work (possibly due to misunderstanding of my applications).  

Thanks in advance!

itemprop = "text">

Use to keep and set how you want to find feedback and find what data you want .

In the model

  var $ worksAs = array ('containable');   

And you can do something like this in the admin

  $ this-> Data = $ this- & gt; User- & gt; Search ('first', array ('position' = & gt; array ('User.id' => $ this-> Auth-> User ('ID')), 'included' = & Gt; array ('city', 'region', 'country', 'user occupation', 'user group')));   

If you have your models / database relationships installed then you can drag the right data, also choose which columns you want to draw.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -