Welcome Guest, Not a member yet? Register   Sign In
Using a class as property in another class
#1

I am using CI for years. I only have controllers, so no views or model classes.
I migrated to the latest version 3.1.5 by unzipping the CI zip file and only copying my \application\*.php files.  I read all migration stuf and googled on it.

In my file Ezbuild_ezm_tools.php I got this issue:

When I am running this code working fine on CI 2.


PHP Code:
$this->mm = new Ezbuild_ezm_mm (); 

I got this message on CI. Unable to locate the specified class: Session.php

Ezbuild_ezm_mm is also an other extension of CI_controller.

When I remove this previous line no error message. So the cause of the error is determined.

So I tried/changed the line to this:


PHP Code:
    $this->load->library('ezbuild_ezm_mm');
    $this->ezbuild_ezm_mm->say_hello(); 

This generates a new issue:
Undefined property: Ezbuild_ezm_tools::$ezbuild_ezm_mm on this line

PHP Code:
$this->ezbuild_ezm_mm->say_hello(); 

My classes are renamed according the 3 way like this:

PHP Code:
class Ezbuild extends CI_Controller {

  function __construct() {
    parent::__construct(); 

After this i am extending all my classes like this:

PHP Code:
require_once("Ezbuild.php");

class 
Ezbuild_ezm_main_class extends Ezbuild 

Any help appreciated! Thanks in advance.

John
Reply
#2

So can a library be a subclass of CI_cotnroller?

John
Reply
#3

(This post was last modified: 08-24-2017, 02:30 AM by InsiteFX. Edit Reason: spelling error )

Your problem is that it's not finding the session class from 2x to 3x
the session is now in it's own folder.

./system/libraries/Session/Session.php

There is also an Interface and Driver for the new Session library.

That's your problem not the Controller.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(08-24-2017, 02:29 AM)InsiteFX Wrote: Your problem is that it's not finding the session class from 2x to 3x
the session is now in it's own folder.

./system/libraries/Session/Session.php

There is also an Interface and Driver for the new Session library.

That's your problem not the Controller.

Nope. His problem is very much that his libraries extend CI_Controller.
Reply
#5

Thank's !@Narf, I did not know that, I heard of people doing it before but I guess it doe's not work now as you said.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB