i'm having this really frustrating error. I'm calling the sponsor function from another function and pass an argument. The sponsor function however keeps giving the missing argument error.
here's my code:
// get random sale
public function RandomSale() {
static $sale = null;
if(!isset($sale)){
$sale = Sale::get()->filter(array('Title:not' => null))->sort("RAND()")->Limit('1');
$this->sponsor(8);
}
return $sale;
}
public function sponsor($memberid) {
$sponsor = Sponsor::get()->filter(array('MemberID' => $memberid))->Limit('1');
return $sponsor;
}
how can i fix this?
Try naming your sponsor() function to something more specific, like SponsorByID($memberID). You may have a naming conflict between your Sponsor DataObject and your sponsor() function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With