Welcome Guest, Not a member yet? Register   Sign In
Email class trying to reference private $email attributes in models
#1

[eluser]skibum001[/eluser]
Hi,

I couldn't find this problem listed anywhere else so hopefully it can be answered here.

I'm trying to use the email class from within a controller (pretty sure that the code is correct here).

Code:
$this->load->library('email');
$this->email->clear();                
$this->email->from('no-reply@***.com', 'Booking Confirmation');
$this->email->to($bm->getEmail());
$this->email->bcc('info@***.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');    
$this->email->send();

Problem is, I get an error Fatal error: Cannot access private property Place_model::$email in C:\web\system\application\libraries\Model.php on line 69

It looks like there is a referencing error somewhere EG CI sees $this->email as belonging to a model, not the super object. Many of my models have private $email atributes.

Can anyone help out here please? I'm using CI 1.6 but get the same error (Model line 68 on CI 1.7)
#2

[eluser]skibum001[/eluser]
Anyone?
#3

[eluser]binarymoon[/eluser]
I know this is really old but I am getting exactly the same error so I'd really appreciate it if someone could help point me in the right direction

Thanks
#4

[eluser]binarymoon[/eluser]
ignore me - I've worked it out. It does seem like a CI bug, but the work around was easy.

I had a private variable in one of my models called email and when I tried to load the email class the two clached (for some strange reason?)

Not sure why it happens, but a quick search and replace in the model fixed the problem nicely.




Theme © iAndrew 2016 - Forum software by © MyBB