Agree, using sfContext::getInstance() is not working here in the lib
directory.
As I am using sfAmfplugin in the frontend, see
public function executeAmf() {
$this->setLayout(false);
$gateway = new sfAmfGateway();
$response = sfContext::getInstance()->getResponse();
$response->setContent($gateway->service());
return sfView::NONE;
}
I don't know how to pass the $sf_user to sfAmfGateway plugin.
On Wed, Nov 18, 2009 at 7:12 AM, Alexandre SALOME <
[email protected]> wrote:
> NO ! Not good idea !
>
> Using sfContext::getInstance() is (always) a bad idea : why do you need the
> universe ?
>
> Change your method to :
>
> function saveMemberHeadImage($image, $sf_user){
> // your stuff
> }
>
> And change your method call to pass the sfUser
>
> Alex'
>
> 2009/11/18 Richtermeister <[email protected]>
>
> If that code is running inside a symfony context, you can get the user
>> via sfContext::getInstance() -> getUser();
>>
>> Daniel
>>
>>
>> On Nov 17, 5:28 pm, xhe <[email protected]> wrote:
>> > I want to use sfAmfService to provide service to frontend flex
>> > application. But I just met one headache, and I believe Symfony must
>> > has solution.
>> >
>> > The sfAmfService sits in directory of lib/service/com/xxxx, and how
>> > can I check the sfUser session value in that program?
>> >
>> > Say this is the code:
>> >
>> > class MemberHeadImageService extends sfAmfService {
>> > function saveMemberHeadImage($image){
>> > //step, to check if user has already logged in by using sfUser-
>> >
>> > >hasAttribute("");
>> >
>> > }
>> >
>> > }
>> >
>> > Can you fill the blank here on how to retrieve sfUser session in the
>> > lib/servcie/... directory. If in the app directory, action.class.php,
>> > this can be easily done.
>> >
>> > Thanks for your kind suggestion.
>> >
>> > Frank
>>
>> --
>>
>> 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].
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=.
>>
>>
>>
>
>
> --
> Alexandre Salomé -- [email protected]
>
> --
> 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].
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=.
>
--
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].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=.