Welcome Guest, Not a member yet? Register   Sign In
Access protected properties from driver library in child drivers
#1

[eluser]mjsilva[/eluser]
Hi there,


I've stumble an annoyance today, I'm build a set of drivers to "revive several models of Frankenstein" Tongue

I've this file structure:

Code:
libraries
\- Revive_frankenstein
  \- Revive_frankenstein.php
  \- drivers
    \- Revive_frankenstein_model1.php
    \- Revive_frankenstein_model2.php
    \- etc...

In file Revive_frankenstein.php

I have:
Code:
class Revive_frankenstein extends CI_Driver_Library {

    protected $ingredient_x;
        // etc....
}

And I want in Revive_frankenstein_model1.php to be able to do:
Code:
class Revive_frankenstein_model1 extends CI_Driver{

    public function index()
        {
                echo $this->ingredient_x
        }

}

Well I figured I can't because of this: https://bitbucket.org/ellislab/codeignit...php#cl-150

Can this be changed to this:
Code:
if ($prop->isPublic() OR $prop->isProtected())
//etc...

I think it makes sense since this are "childs", and child classes should be allowed to access protected properties of parents (I guess).

cheers

EDIT: It appears there's a bug in bitbucket, the anchor for the line 150 is not working correctly.




Theme © iAndrew 2016 - Forum software by © MyBB