I have the testClass
class and I want to create new object from unserialized object in its constructor. Is it possible? Something like this:
class testClass {
public __constructor($id) {
$queryData = DB::query(sql);
$object = unserialize($queryData);
$this = $object;
}
}
In this way the rest of the code won't bother how the object is constructed:
$object = new testClass(3);