Hi
I have a model called Commitment with a method called Commitment that
performs some basic set-up for the new Commitment object.
class Commitment extends AppModel
{
var $name = 'Commitment'; //for php4
var $belongsTo = 'Actionplan';
var $actionplan_id;
var $action_area;
var $order;
function Commitment($actionplanId, $actionArea, $order)
$this->actionplan_id = $actionplanId;
$this->action_area = $actionArea;
$this->order = $order;
}
}
I expect that I should be able to create a new Commitment object from my
controller, like this:
class FeedbackController extends AppController
{
var $name = 'Feedback'; //for php4
var $uses = array('Commitment');
function index () {
$commitment = new Commitment(300, 1, 0);
print_r($commitment);
}
}
I am passing the required arguments for the set-up function, however
when I call feedback/index I get the following errors:
Warning: Missing argument 1 for commitment() in
/dev/app/models/commitment.php on line 39
Warning: Missing argument 2 for commitment() in
/dev/app/models/commitment.php on line 39
Warning: Missing argument 3 for commitment() in
/dev/app/models/commitment.php on line 39
Looking through the Cake code, I can see other instances of "new" being
used to create objects an including arguments, so I am unsure why it
won't work in my case.
Can anyone suggest why the arguments aren't being passed successfully to
the model?
Thanks in advance for any assistance.
Regards,
Langdon
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---