class Portfolio extends Rest{
public $pdo;
public $lanx;
public function __construct($uid, $langx){
$this->lanx = $langx;
$db = Database::getInstance();
$this->pdo = $db->getConnection();
}
When I call a function from Portfolio
Portfolio::newItem();
how can I pass $uid
and $langx
to the class?
Portfolio $p = new newItem($uid, $langx);
$object = new MyClass($param1, $param2);
Just do it like calling a function. Also take note of the "required" and "optional" parameters for that construct.
Its a better option to invoke static method with parameters like this:
Portfolio::newItem($uid, $langx);
in Method Definition:
public static function newItem($uid = null, $langx = null) {
//Check Vars are set or not if not set them
//If all vars passed null and not sett in class throw exception
}