http://www.symfony-project.com/api/1_0/sfFunctionCache is a good idea.
I did think about to put it in a preExecute of the action classes. But then
I've to put it in all actions. I read a post in the forums where someone
recommends to put a function like this in a filter.
This was my idea:

I put the ids which I get from checkIgnore Function in an array.
When I call the function to create the Online User List, I ll check the ids
which I'll get with this function against the ids in ignore array.
So I don’t have to call the checkIgnore Function every time. 
For example:

while ($rs->next())
{
        $onlineUser[] = $rs->get("0");
}
$onlineUser = array_diff($onlineUser, $this->ignoreUser);

And not like this way : 

while ($rs->next())
{
        if ( !$this->checkIgnoreUser($rs->get("0")))
                $onlineUser[] = $rs->get("0");
}

But where is the best point to create the Ignore User array ?
In a Filter or in a preExecute ? 


-----Ursprüngliche Nachricht-----
Von: symfony-users@googlegroups.com [mailto:[EMAIL PROTECTED]
Im Auftrag von Kiril Angov
Gesendet: Montag, 8. Oktober 2007 18:20
An: symfony-users@googlegroups.com
Betreff: [symfony-users] Re: "Ignorelist" Check


I would suggest you use a Propel Behavior for that. Take a look at 
http://trac.symfony-project.com/wiki/sfPropelSpamTagBehaviorPlugin for 
an example. The idea is that when the user is logged in you can get the 
user id and apply add that to the sql queries.

But now when I read better your question :)) you need to use 
sfFunctionCache() http://www.symfony-project.com/api/1_0/sfFunctionCache

Kupo

Marco Schierhorn wrote:
>
> Hey, I’m thinking about a good solution for the following problem:
>
> We’ve an online social network. And the users have the possibility to 
> ignore / block other user.
> For example: When a userA blocks userB, userB should see just a 
> limited profile of userA and shouldn’t see his profile pic on some 
> list ( i.e. the online user list ), also userB shouldn’t be able to 
> write userA a message. What is the best way to manage this problem?
> Should I create a list of the ignored User every time someone calls an 
> action and then use this list to check in the Model if there is a User 
> which ignores him?
> Because I wont like to call a function ( to check if the user ignores 
> him ) in a loop for a list ( i.e. to show the online user ) every 
> single time.
>
> I thought about this function:
>
> public function getIgnoreList($checkIgnoreUser=null)
>
> {
>
> if ($checkIgnoreUser==null)
>
> return false;
>
> $c = new Criteria();
>
> $c->clearSelectColumns()->addSelectColumn(IgnorelistPeer::BOOKED_ID.' 
> AS ignMember');
>
> $c->add(IgnorelistPeer::MEMBERS_ID, $this->getId());
>
> $c2 = new Criteria();
>
> $c2->clearSelectColumns()->addSelectColumn(IgnorelistPeer::MEMBERS_ID.' 
> AS ignMember');
>
> $c2->add(IgnorelistPeer::BOOKED_ID, $this->getId());
>
> $ign1 = IgnorelistPeer::doSelectRS($c);
>
> $ign2 = IgnorelistPeer::doSelectRS($c2);
>
> while ($ign1->next())
>
> {
>
> $ignoreList1[] = $ign1->get("0");
>
> }
>
> while ($ign2->next())
>
> {
>
> $ignoreList2[] = $ign2->get("0");
>
> }
>
> $this->ignoreList = array_unique($ignoreList1,$ignoreList2);
>
> }
>
> Any help or suggestions would be really appreciated…
>
> Thanks,
>
> Marco
>
> -- 
> Marco Schierhorn
> Technical Director
>
> -------------------------------------------------------------------
>
> ESV Media GmbH
> Meerbuscher Str. 64-78 | 40670 Meerbusch
> Tel. +49 (0)2159 / 9297-930 | Fax. +49 (0)2159 / 9297-931
> Mobil +49 (0)173 / 99 37 000
> www.esv-group.de <http://www.esv-group.de> | [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>
>
> Geschäftsführer: Heinz Eissing
> Amtsgericht | Neuss HRB 12902
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
> E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den 
> Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie 
> die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
> This e-mail may contain confidential and/or privileged information. If 
> you are not the intended recipient (or have received this e-mail in 
> error) please notify the sender immediately and destroy this e-mail. 
> Any unauthorised copying, disclosure or distribution of the material 
> in this e-mail is strictly forbidden.
>
>
> >






-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.488 / Virus Database: 269.14.4/1056 - Release Date: 07.10.2007
18:12



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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