I have declared two functions inside my model,
Let say:
class Services extends \yii\db\ActiveRecord
{
public myFunction1(){
}
public myFunction2($param){
}
}
now I want to use myFunction2($param) inside myFunciton1()!
How I can do this?
I used this method:
public myFunction1(){
$param = 1;
$this->myFunction2($param)
}
Error: Using $this when not in object context
Hi!
First, learn the difference of $this and self:: to understand your error message.
Then learn when to use static functions:
http://php.net/manual/en/language.oop5.static.php
This should show you how to do it.
Regards.
How are you calling myFunction1() ?
rahif
(Rahif)
4
you forget function word:
class Services extends \yii\db\ActiveRecord
{
public function myFunction1(){
}
public function myFunction2($param){
}
}
Thanks man, it is really a bad mistake