Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing argument 1 for page::sponsor()

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?

like image 992
luukgruijs Avatar asked Nov 29 '25 14:11

luukgruijs


1 Answers

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.

like image 112
cryptopay Avatar answered Dec 01 '25 04:12

cryptopay