generateUrl problem

Posted by Daniel Hertz on Stack Overflow See other posts from Stack Overflow or by Daniel Hertz
Published on 2010-05-31T00:22:39Z Indexed on 2010/05/31 0:32 UTC
Read the original article Hit count: 634

Filed under:
|
|

I am trying to generate a url but I keep getting a strange warning even though it works. I am making an api xml page and I use the following call in the controller:

public function executeList(sfWebRequest $request)
{
    $this->users = array();
    foreach($this->getRoute()->getObjects() as $user)
    {
        $this->users[$this->generateUrl('user_show', $user, true)] = $user->asArray($request->getHost());
    }
}

The user_show route is as follows:

# api urls
user_show:
  url:   /user/:nickname
  param: { module: user, action: show }

And the xml outputs as follows:

<br />
<b>Warning</b>:  array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br />
<br />
<b>Warning</b>:  array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br />

<br />
<b>Warning</b>:  array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br />
<?xml version="1.0" encoding="utf-8"?>
<users>
  <user url="http://krowdd.dev/frontend_dev.php/user/danny">
    <name>Danny tz</name>
    <nickname>danny</nickname>
    <email>[email protected]</email>
    <image></image>
  </user>
  <user url="http://krowdd.dev/frontend_dev.php/user/adrian">
    <name>Adrian Sooian</name>
    <nickname>adrian</nickname>
  </user>
</users>

So it outputs the correct xml but I do not know why it throws thows warning when calling the generateurl method.

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about symfony