I have a problem with displaying a list with relations in an index
action.
I have a User and an Article with a straight forward 1:n relation
between User and Article.
Now when I want to display the number of articles of a user with
count(), I always get the same number...
Code:
<h1>User List</h1>
<?php include_partial('global/pager', array('pager' => $users, 'route'
=> 'user_index')); ?>
<dl class="list">
<?php foreach ($users as $user): ?>
<dt><?php echo link_to($user->getUsername(), 'user_show',
array('username' => $user->getUsername()))?></dt>
<dd>
joined <?php echo $user->getCreatedAt() ?>
and wrote <?php echo $user->getArticle()->count() ?>
</dd>
<?php endforeach;?>
</dl>
Okay, I use a pager. but when I take a look at the SQL in the dev
environment, I do get the correct SQL queries for each user. Only its
not getting displayed correctly...
Thanks for any help that I may get.
- Warringer
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en