Re: Make database calls inside of component

2006-04-08 Thread AD7six

Hi Bill,

First a double check: Is the component Findcost only related to the
controller Costs? If so it might be easier to manage and cleaner code
to write the functionality into a method on the Costs controller.

If it is used by more than one controller then I think will do what you
want:

class CostsController extends AppController
{
var $components = array('FindCost');

function index()
   {
$this-FindCost-calculate( ???);
   }
// Rest of code

class FindcostComponent
{
   var $model;
   var $myarray = array();

function startup($controller) {
$this- model = new NameOfModel; // Not sure if there's a way
to tie this in automagially
}

   function calculate(  ???  )
   {
  $this-myarray[$itemcost]=100;
   $this-model-save($this-myarr);
}

Cheers,

AD7six
Looking for CakePHP info?
Find it faster here: http://www.cakephp.org/search/


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



Re: Make database calls inside of component

2006-04-08 Thread bigdog

I get it now!!  Using 'products_id' will not work with Cake.  You have
to use 'id' as your field name.


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