Hi, anyone can help me?
I got stuck of this code.
$billing->bookingHeader->getCodeNumber('BKG');
Actually $billing is a model and bookingHeader is the relation.
this line generate error
Fatal error: Call to a member function getCodeNumber() on a non-object
Below is the component contains result.
class MonthlyTransactionActiveRecord extends ActiveRecord
{
public function getCodeNumber($cnConstant = '')
{
$arr = array('I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII');
$month = $this->cn_month ? $this->cn_month - 1 : 0;
return sprintf('%02d/%04d/%s/%s/%02d', $this->hotel_id, $this->cn_ordinal, $cnConstant, $arr[$month], $this->cn_year);
}
}
I call
$billing->bookingHeader->getCodeNumber('BKG');
twice (in view and controller), it has no error in view, but when I call it in Controller, it gives me error.
What kind of trigger the error has? How to fix that?
Thank you…