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
