I found out myself, if someone needs it:

// increment
$invoker->setNbViews($invoker->getNbViews() + 1);
// save
$q = Doctrine::getTable(get_class($invoker))->createQuery();
$q->update()
->set($q->getRootAlias().'.nb_views', '?', $invoker->getNbViews())
->where($q->getRootAlias().'.id = ?', $invoker->getId())
->execute();


On 29 Jun., 00:20, comb <[email protected]> wrote:
> Hi! =)
>
> I use the doctrine Searchable-behavior.
> I implemented a ViewCountable behavior, which always does this when
> viewing a record:
>
> $invoker->setNbViews($invoker->getNbViews() + 1);
> $invoker->save();
>
> Well, the hook of the Searchable is executed by this and that causes
> 133 (and more!) DB-Queries when _viewing_ a record... that's bad^^
>
> How can I bypass the Searchable-behavior on this save()?
>
> Thanks!
> comb

-- 
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

Reply via email to