HI Chris, r u using Propel ?
ok ..... if u r using propel then what u have to do is... u r having the job_id in $job_id $c = new Criteria(); $c->add(JobComponentPeer::JOB_ID,$job_id); $c->add(JobComponentPeer::COMPONENT_ID,ComponentPeer::ID); $components = ComponentPeer::doSelect($c); now all the components corresponding to that job_id are in $components now if u hav $job_id and also the price then $c = new Criteria(); $c->add(JobComponentPeer::JOB_ID,$job_id); $c->add(JobComponentPeer::COMPONENT_ID,ComponentPeer::ID); $c->add(JobComponentPeer::PRICE,$price); $components = ComponentPeer::doSelect($c); this will give u all the components related to that job id having that price. On Thu, Feb 26, 2009 at 11:35 AM, ChrisM <c.marscha...@gmail.com> wrote: > > Hi everyone! > > I have 2 questions related to many to many relations and forms: > > 1) Let's say I have 2 Models/Tables "Job" and "Component". A Job is > composed of several components. I would map this many to many relation > in a table called JobComponent which would take the ID of a Job and > the ID of a Component, and symfony can create a list box for me on the > Job-Form where I can choose the components. But what if I need to have > another field in JobComponent, let's say "Price"? How can I still > select the components on the Job page AND also define a price for > them? > > 2) Let's say I have furthermore Areas and Subareas of which a Job > consists. I can easily add the areas and select the corresponding job > for them, but how would I go and, on the same form, add several sub- > areas to the area too? Is this possible? The problem is that I don't > really have a connection to the job on the form which let's me add the > subarea. I can only select the area there and I would need to know to > which job it belongs (or append it to the name in __toString, but > that's not optimal). > > I hope someone can point me into the right direction, or even give me > some examples. Anything helps :) > > Thanks! > Chris M. > > > > -- Regards, Dheeraj --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---