Welcome Guest, Not a member yet? Register   Sign In
Using isset() to check if model exists

Hi everyone,

I have a problem with my model that has been bugging me for quite a while now. Here's how my __construct method looks like:

private $is_team;

public function __construct(){
$this->is_team = isset($this->team);

// does some other stuff bellow

In this model I wanted to check if another model called "team" exists. But for some reason it returns me this error:
Quote:A PHP Error was encountered

Severity: Notice
Message: Undefined property: Dashboard::$team
Filename: core/Model.php
Line Number: 51

The error disappears if I remove the line completely, so I guess it can't be caused from somewhere else.

Any ideas on how to fix or replace this?

Thanks in advance.

If you look at the error you will see that it is telling you that $team is undefined in your Dashboard.

You need to define the $team variable.

If it is in another model or library then you need to make global like in session data.

Theme © iAndrew 2016 - Forum software by © MyBB