Can not find method
Hi.
I have 3 files with correct namespaces and spl_autoload
PHP version 7
table/campaign.php
namespace table;
Class Campaign{
function getAllCampaign(){
}
}
model/modelName/Index.php
namespace model\modelName;
class Index Extends Controller{
protected $campaign;//also i tried var and public
function __construct(){
$this->campaign = new \table\Campaign;
}
function Index(){
$this->getData();
}
}
model/modelName/Controller.php
namespace model\modelName;
/**
* @property Index campaign
*/
class Controller{
function getData(){
//with property it provides campaign protected variable but no further
//if i trying to get campaign method it will not provide autocomplete
//also it says that method not found
//in website it works
$this->campaign->get
}
}
Please sign in to leave a comment.
Hm, this looks to be working for me:
What IDE version are you running?
I use 2016.2.2.
Now i see, it offers second parameter to same variable and after that it provides Sql methods.
But this is not correct. It will create error: Fatal error: Uncaught Error: Call to a member function Select() on null in
I think it works just as expected.
On the first invocation, "campaign" is a property of $this, and its type is "Index", which is perfectly fine and you get the completion you want.
On the second invocation, "campaign" is a property of "Index", and we infer the type of it as "Campaign" because of the constructor.
Hi.
So what i do wrong ?
You should probably set /** @property Index $campaign */ in Index.
Not working.
Enough of this, I'll stick to editplus.
Could you please explain what doesn't work exactly?