Hi,

I am not having succes getting my component to update a record.

Insert works with this code if I don't pass a $product_id.  How do I
force an update?

class CostsController extends AppController
{
    var $name = 'costs';
    var $components=array("Findcost");


   function index()
   {
        $col=array();
        $col['products_id']=1;
        $this->Findcost->calculate('Cost', $col);   }
   } //end of index


class FindcostComponent
{
   var $controller; //gives access to controller


   function startup(& $controller) //gives access to controller
   {
        $this->controller =&$controller;
   } //startup

   function calculate(  $mymodel, $othercols=null  )
   {
       //do some calculations
      $myarray=array();
      $myarray['itemcost']=100;
      //merge product_id from othercols wth myarray to do the update
      if( isset( $othercols ) )
          $result = array_merge($myarray, $othercols);
      else      $result=$myarray;
       //I want to update the table here
       $this->controller->$mymodel->save($result);
   }//calculate



} //end of component


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to