Hi everyone,

    I passed many hours for this strange thing, in fact I got a problem when
using json_encode in symfony.

     In my front-end module, method executeIndex() as below:

  public function executeIndex(sfWebRequest $request)
  {
        $this->test = $this->getRoute()->getObject();
        // Call json_encode, but return '{}'
        $json = json_encode($this->test);

        // this simple test works
        $test = new stdClass();
        $test->id = new stdClass();
        var_dump(json_encode($test));
    }

I get my object from routing, and call json_encode, but in $json value, I
got always '{}',
So I tried another simple test with stdClass, the result is ok.

My object is not null, but why after json_encode, the value is empty?

Can you help me please ? Thank u so much.

JoJo

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to