Closed as not planned
Description
there is a similar issue #193, I followed its example, but don't get lucky.
here is what I tried
pub fn render(#[this] this: &mut ZendClassObject<Template>, vars: &mut ZendObject) -> String {
dbg!(&vars.get_properties().unwrap());
let o = vars.get_property::<&ZendObject>("t").unwrap();
let callable = Zval::new();
callable.set_array(vec![o, "hello"]); // this line won't work, because
// o is &ZendObject, I can't convert it to Zval. I don't know why the example works.
let arguments = vec![];
if let Ok(result) = callable.try_call(arguments) {
dbg!(result);
}
let vars = ZendObjectView(vars);
return this.template.render(&vars).unwrap();
}
class T {
public function hello()
{
return "hello";
}
}
$t = new T();
$vars = new stdClass();
$vars->name = 'David';
$vars->age = 18;
$vars->t = $t;
Why all that fussy?
Is there an easy way to call object method?