Actually, just read this again. In the prices controller you have to call $this->Price->Part to reach parts, or just $this->Price to reach prices.
Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 15 May 2011, at 17:09, turbo2ltr wrote: > Well that's the first thing I tried and I couldn't get it to work. > > If I try to use any reference like '$this->Part->Price' from the > Prices controller I get: > Undefined property: PricesController::$Part [APP/controllers/ > prices_controller.php, line 52] > > > > > On May 15, 5:48 am, euromark <dereurom...@googlemail.com> wrote: >> despite the fact that your code doesnt really look too cakish >> the correct approach to access related models is through chaining: >> >> $this->Part->Price->foo(); >> >> On 15 Mai, 06:43, turbo2ltr <turbo2...@gmail.com> wrote: >> >>> Parts hasMany Prices. >>> Parts belongsTo Prices >> >>> The idea is a part can have many prices but Part will have one Price >>> ID that will indicate the default price. >> >>> In the Prices controller, how would I go about updating the Parts >>> field? I searched around and it seems to be a common problem, but the >>> answers didn't get me anywhere. >> >>> One of my attempts that doesn't work.. this code is if the Price Add >>> form is submitted and the user indicated it was the default (prime): >> >>> $this->Part->id = $this->data['Price']['part_id']; >>> $partdata = $this->Part->read(); >>> $partdata['Part']['prime_price_id'] = $this->Price->getLastInsertId(); >>> $this->Part->save($this->data); >> >> > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php