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 <[email protected]> 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 <[email protected]> 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
