[symfony-users] [Symfony2] Using ZendAMF with Symfony2
Hi All, I've been digging into Symfony2 and really love what I've learned so far. I will be needing a complete AMF3 solution, and have been planning on using ZendAMF since before I started developing with Symfony2. I'm wondering if there is any recommended method for using this 3rd party library with Sf2? Should I just include it in my controllers and use it as the documentation describes, or should I create a wrapper bundle and use it like that? (i'm not sure how to do that yet, but just wondering if that's the direction I should be going). Any advice or suggestions welcome. Thanks in advance -Nick -- 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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] [Symfony2] FOS\UserBundle setup problems (Unable to create user)
Hi All, I've got the latest from the symfony-standard UserBundle git repositories, have gone through the instructions in UserBundle\Resources\doc\index.rst and gotten things setup. However I'm unable to create a new user. When I go to [url]/user/new - out the form and click submit, I get the error: No encoder has been configured for account Application\uNapseBundle\Entity\User. Searching through the index.rst doc, the only reference to 'encoder' I could find was this chunk of configuration: encoder: algorithm:~ encode_as_base64: ~ iterations: ~ Which I added to my app/config/config.yml - but this produced a fatal error: Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The parameter fos_user.encoder.algorithm must be defined.' in [app_root]/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 77 I don't know what options I have, as far as what to set on these configuration parameters. I brought this up in IRC and was told that I shouldn't have to specify these settings, as the bundle does not use the core encoder for this class but a custom one. However I don't know enough about how UserBundle is implemented to do any troubleshooting of my own, so I was hoping someone on the list could help me out. Here is my User class. ?php namespace Application\uNapseBundle\Entity; use FOS\UserBundle\Entity\User as BaseUser; /** * Application\uNapseBundle\Entity\User * * @orm:Table(name=user) * @orm:Entity */ class User extends BaseUser { /** * @orm:Id * @orm:Column(type=integer) * @orm:generatedValue(strategy=AUTO) */ protected $id; /** * @orm:ManyToMany(targetEntity=FOS\UserBundle\Entity\DefaultGroup) * @orm:JoinTable(name=fos_user_user_group, * joinColumns={@orm:JoinColumn(name=user_id, referencedColumnName=id)}, * inverseJoinColumns={@orm:JoinColumn(name=group_id, referencedColumnName=id)} * ) */ protected $groups; /** * @var Application\uNapseBundle\Entity\ActivityLog * @OneToMany(targetEntity=ActivityLog, mappedBy=user) * */ private $activityLogEntries; /** * @var Application\uNapseBundle\Entity\Cloud * @OneToMany(targetEntity=Cloud, mappedBy=user) * */ private $cloudList; /** * @var Application\uNapseBundle\Entity\Instance * @OneToMany(targetEntity=Instance, mappedBy=user) * */ private $instanceList; public function __construct() { $this-activityLogEntries = new \Doctrine\Common\Collections\ArrayCollection(); $this-cloudList = new \Doctrine\Common\Collections\ArrayCollection(); $this-instanceList = new \Doctrine\Common\Collections\ArrayCollection(); $this-groups = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Returns a list of activity logs for this user * * @return Doctrine\Common\Collections\Collection */ public function getActivityLogEntries() { return $this-activityLogEntries; } // TODO : other mappings getter/setter methods from tables } -- 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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] [Symfony2] FOS\UserBundle setup problems (Unable to create user)
Hi All, I've got the latest from the symfony-standard UserBundle git repositories, have gone through the instructions in UserBundle\Resources\doc\index.rst and gotten things setup. However I'm unable to create a new user. When I go to [url]/user/new - out the form and click submit, I get the error: No encoder has been configured for account Application\uNapseBundle\Entity\User. Searching through the index.rst doc, the only reference to 'encoder' I could find was this chunk of configuration: encoder: algorithm:~ encode_as_base64: ~ iterations: ~ Which I added to my app/config/config.yml - but this produced a fatal error: Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The parameter fos_user.encoder.algorithm must be defined.' in [app_root]/vendor/symfony/src/Symfony/Component/DependencyInjection/ ParameterBag/ParameterBag.php on line 77 I don't know what options I have, as far as what to set on these configuration parameters. I brought this up in IRC and was told that I shouldn't have to specify these settings, as the bundle does not use the core encoder for this class but a custom one. However I don't know enough about how UserBundle is implemented to do any troubleshooting of my own, so I was hoping someone on the list could help me out. Here is my User class. ?php namespace Application\uNapseBundle\Entity; use FOS\UserBundle\Entity\User as BaseUser; /** * Application\uNapseBundle\Entity\User * * @orm:Table(name=user) * @orm:Entity */ class User extends BaseUser { /** * @orm:Id * @orm:Column(type=integer) * @orm:generatedValue(strategy=AUTO) */ protected $id; /** * @orm:ManyToMany(targetEntity=FOS\UserBundle\Entity \DefaultGroup) * @orm:JoinTable(name=fos_user_user_group, * joinColumns={@orm:JoinColumn(name=user_id, referencedColumnName=id)}, * inverseJoinColumns={@orm:JoinColumn(name=group_id, referencedColumnName=id)} * ) */ protected $groups; /** * @var Application\uNapseBundle\Entity\ActivityLog * @OneToMany(targetEntity=ActivityLog, mappedBy=user) * */ private $activityLogEntries; /** * @var Application\uNapseBundle\Entity\Cloud * @OneToMany(targetEntity=Cloud, mappedBy=user) * */ private $cloudList; /** * @var Application\uNapseBundle\Entity\Instance * @OneToMany(targetEntity=Instance, mappedBy=user) * */ private $instanceList; public function __construct() { $this-activityLogEntries = new \Doctrine\Common\Collections\ArrayCollection(); $this-cloudList = new \Doctrine\Common\Collections \ArrayCollection(); $this-instanceList = new \Doctrine\Common\Collections\ArrayCollection(); $this-groups = new \Doctrine\Common\Collections \ArrayCollection(); } /** * Returns a list of activity logs for this user * * @return Doctrine\Common\Collections\Collection */ public function getActivityLogEntries() { return $this-activityLogEntries; } // TODO : other mappings getter/setter methods from tables } -- 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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] issue with doctrine inheritance!!
Hello, I have a doctrine schema with four tables extending from a table named Proposition with a lot of fields, making the column_aggregation inheritance not available by performance reasons, and over all for validations and mainteinance causes... I tried the concrete inheritance, and everything works fine with forms, the generation and all of that, until the time of saving th form of each one of the proposition children. The issue is that the table Proposition has some relations and when the child os gonna be saved, it the constraint of the relations asked for a non-existent key on the table Proposition, which as we all know, remain empty all the time. there is a way to redirect the validation to the child primary key? due to that, I cannot save my forms!!! I need some help!! Thanks!! PD: sorry my english, I´m still learning!! -- 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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en To unsubscribe, reply using remove me as the subject.
[symfony-users] handling multiple subdomains, sharing the lib and apps folder
I know this question comes up a lot, but I'm having trouble tracking down the info I need. I'd like to have a bunch of sub-domains: one.mysite.com two.mysite.com three.mysite.com They all live on the same server. I'd like for them all to have different databases, but to share the lib and apps folders. Can anyone point me to a tutorial on this? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
[symfony-users] Re: getId() not working on newly saved object
$this-product-getId() will give you the auto increment ID of the row just inserted 2009/10/6 Josh joshlaro...@gmail.com Hi all: I'm still pretty fresh to Symfony so bear with my newbie questions and confusions. Here's the deal: $this-product = new Product; // from BaseProduct::Product $obj = $this-product-save(); echo $obj-getProductId(); // product.product_id: int(11), autoincrement, primary key. The echo yields nothing though the object is saved to a row in the table. Thoughts? Thanks. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony has definitely become too complicated framework
Ghost3D, If you do not like the new form framework, then I recommend that you stick with the 1.0 branch of Symfony. I don't think there's anything wrong with the directory structure used in Symfony projects. Once you get used to the layout, it makes sense. Kind regards, Nick. 2009/9/23 bghost bggho...@gmail.com Hi Fabien, You say that I write nonsense and stupid e-mails? Well, seems that you did not understand me. So, I'll be here a little more detailed and specific: First: No offense Fabien, this is a well-meaning criticism. I know that you invested so much effort into Symfony. However, you are a little exaggerated forcing object model and object-oriented programming where it is necessary - and where it is not (as is the case with WEB Forms), in the language which already has a very bad and sloppy object model. So you complicate some tasks in the Symfony framework that already was simple and good. Second: Almost 90% of the code that generates the Symfony framework developer need to modify or re-write, because the generated code does not follow best practice (per your words) in programming. What is the point and what the benefits of the code generated if 90% of the code must be re-written on the completely different way? Third: The result of all this is a complex directory structure, many empty classes that only contain a skeleton and just inherits one of the base classes, and finally the CRUD code that always must be re-written. And to get all that, the programmer must learn a bunch of different configuration and command line options. And when a programmer, after a painstaking setup and configuration of various options and parameters, finally gets the generated code, he must re-write 90% of the generated code. WBR, Ghost3D On Sep 23, 9:19 am, Fabien Potencier fabien.potenc...@symfony- project.com wrote: Ok, I think we get the point. No need to be rude. Please, go away, use whatever framework you want, and stop writing nonsense emails. Thanks, Fabien -- Fabien Potencier Sensio CEO - symfony lead developer sensiolabs.com | symfony-project.org | fabien.potencier.org Tél: +33 1 40 99 80 80 bghost wrote: As I said at the beginning: Symfony has become too complicated. Also, Symfony folder structure has become too complicated. Definitely, the learning of principles on which Symfony working is painful and unprofitable. If you really want to see, which means fast, easy and effective PHP framework, then take a look on the following link: http://www.yiiframework.com/ WBR, Ghost3D On Sep 21, 3:31 pm, Sid Bachtiar sid.bacht...@gmail.com wrote: XD On Tue, Sep 22, 2009 at 1:28 AM, dziobacz aaabbbcccda...@gmail.com wrote: I would like to say that Symfony is very, very good and future framework. Thx Symfony I could learn very fast ASP.NET MVC (not ASP.NET but ASP.NET MVC) - these two frameworks have got many similar things. While Zend Framework is far, far away Symfony and ASP.NET MVS. In Zend you must almost everything creat by yourself !! For example you must modify Bootstrap file and write there strange code to enable layout !!! Symfony is the best !! :) On 21 Wrz, 10:58, CaffeineInc simon@gmail.com wrote: I think symfony is brilliant, If you need a framework which can scale to enterprise level websites with fast prototyping and a flexible ORM, then you don't need anything else. If you think it's complicated, then maybe you're in the wrong place. If you want to build a small website with everything pre-configured, I'd probably stick with something like SilverStripe. P.s slagging off the framework in 2-3 lines is not very constructive for the users forum. On Sep 18, 6:09 pm, bghost bggho...@gmail.com wrote: No, the crux of what I wanted to say is: Users should not spend more time to learn how some Web Framework works but they need to learn a programming language. Any framework should be only an auxiliary tool, not an entire small science. So, simplicity and speed should be paramount. WBR, Ghost3D On Sep 18, 5:30 pm, Sid Ferreira sid@gmail.com wrote: The most easy thing to understand is something that doesn't need documentation and I believe that THIS is the point that BGhost is talking about.I don't want launch a rocket in 30 days, I want my gallery ready in 12 minutes... On Fri, Sep 18, 2009 at 12:26, Thomas Rabaix thomas.rab...@gmail.comwrote: Symfony has many components, each of them are : - easy to understand - easy to configure - very well documented Now, the only thing complicated is to know how all these components play together. This is the tricky part, but symfony default configuration will be fine for many projects. You just need to go further ... if you have already create/try to implement a framework, you will see that symfony has
[symfony-users] Re: Task generate-admin is not defined.
Your syntax is different from what I usually run. I usually go with something like: symfony propel:generate-crud backend category BlogCategory (the last is the model you use, the next to last is any name that you want to give to the module.) On May 26, 7:09 am, Vikaash vikaash...@gmail.com wrote: hai I m trying to run this command php symfony propel:generate-admin backend RoomBooking -- module=home for my backend application for admin generator where RoomBooking is my propel object. when i run this command i get the Error Task generate-admin is not defined. i dont know whats the problem .pls somebody help me out of it. thanks vikaash --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] how do I get past security when running tests?
Sorry for the dumb question. How do I get past security when running functional tests? I keep getting 401 errors. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: I have a problem in file layout
What error do you get? On May 27, 6:51 pm, Romildo Jozué Paiter romildopai...@gmail.com wrote: Look de code: action :: module:: frontend I start estudant the framework preview Friday, it's good. But, in file layout.php, don't exibition outher function. View only executeIndex(). I have create all files: executeSuccess.php and linguasSuccess.php In use, Symfony 1.2 version ?php class frontendActions extends sfActions { //Exibe a as informações da pagina public function executeIndex() { $response = $this-getResponse(); // HTTP headers $response-setContentType('text/xml'); //$response-setHttpHeader('Content-Language', 'en'); #$response-setStatusCode(403); #$response-addVaryHttpHeader('Accept-Language'); #$response-addCacheControlHttpHeader('no-cache'); // Cookies #$response-setCookie($name, $content, $expire, $path, $domain); // Metas and page headers $response-addMeta('robots', 'bimetal industria metalurgica'); $response-addMeta('keywords', 'industria torres telecom bimetal'); $response-setTitle('Bimetal Industria Metalurgica'); $response-addStyleSheet('main'); $response-addStyleSheet('menu_dd'); //$response-addJavaScript('custom_behavior'); $empresa = Bimetal Engenharia; $this-company = $empresa; } public function executeShow() { $today = getdate(); $this-hour = $today['hours']; //return $this-hour = $today['hours']; } public function executeLinguas(){ $c = new Criteria(); //$c-add(SecoesPeer::IdpaiSec, 0); $this-resultset = SecoesPeer::doSelect($c); } } ? Adrress: symfony.bimetal.eng.br i need help. Thanks for all. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] functional tests for security
How do I build a functional test that checks to see that I'm locked out of a secure page? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] does sfPropelActAsTaggableBehaviorPlugin need any change to my schema.yml?
I'm looking at the install instructions for sfPropelActAsTaggableBehaviorPlugin: http://www.symfony-project.org/plugins/sfPropelActAsTaggableBehaviorPlugin Where do the tags go? Do I need to create a tag database table? Does the plugin do that itself? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: sfTask::logProgress()
On May 18, 3:12 pm, isleshocky77 sost...@sowebdesigns.com wrote: I don't know if I'm the first or only person to find this functionality useful, but in a recent project of mine one of my tasks was used for importing large amounts of data which took a total of 20 minutes combined. It was extremely nice knowing where in the import it was so I wrote a function which would write out the progress, clear the previous, and re-write. (Side note, it was entirely too much information and overwhelming to log each change without clearing the previous. This way I was able to keep note of what section I was in.) The problem I ran into was the way sfConsoleLogger writes to the command line does not allow for the use of chr(8) in order to delete previous printed characters. So I had to just do a simple echo rather than using the commandline logger. Great idea. Useful for big imports. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] What is sf_method in the forms?
Hmm, I generate some CRUD forms for a new module. I notice this in the source code: input type=hidden name=sf_method value=put / What does this do? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 16, 12:59 am, Sid Bachtiar sid.bacht...@gmail.com wrote: Use $this-getUser()-setAttribute('referer', 'URL to come back to'); sfGuard upon successful login should try to take you there. Sad to say, that didn't work. My code now looks like this: if ($request-getParameter('redirect')) { $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } $this-getUser()-setAttribute('referer', $model.'/'.$action.'?'. $queryString); } $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user-getReferer('@homepage')); return $this-redirect($signinUrl); Just as before, when I log in, I'm sent back to the home page, rather than being sent forward to the page that I was trying to go to. But if I echo $model.'/'.$action.'?'.$queryString to the screen I can see that I have the right URL. But it is only the right URL the first time this code runs through (that is, when I submit the login form). Symfony then reloads the signin() method a second time, and at that point the page I'm coming from is the login page. I'm assuming this is a task that a lot of Symfony developers have implemented on their own sites. Could someone please post some sample code? On Sat, May 16, 2009 at 4:53 PM, nick lal...@teamlalala.com wrote: Clearly, I'm going about this all wrong. If anyone else out there who has done this wants to chime in, I'd be grateful. Out of desperation, I tried the straightforward approach, which I know is a big hack: $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } return $this-redirect($model.'/'.$action.'?'.$queryString); If I simply echo this last bit to the screen, I can see that I'm getting exactly what I need as an URL: frontend_dev.php/sfZed/zed/model/inventory/id/5 But I again get an infinite loop of redirection: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. So clearly, this adjustment is suppose to be made somewhere else in the code. I'm not suppose to be working in sfGuardAuth - executeSignin (). But where else do I make this adjustment? On May 15, 11:16 pm, nick lal...@teamlalala.com wrote: Interesting. I feel like I'm getting closer. Instead of getUri() I switched to using getPathInfo() in the form: form action=?php echo url_for('@sf_guard_signin') ? method=post table ?php echo $form ? /table input type=submit value=sign in / input type=hidden name=redirect value=?php echo substr ($sf_request-getPathInfo(), 1) ? / /form I had to use substr() to remove the first / forward slash, otherwise the address was treated as absolute from the document root. I then changed actions.class.php like this: $this-finalRedirectInForm = $request-getParameter('redirect'); return $this-redirect($this-finalRedirectInForm); This allowed me to escape the problem that I'd been having before - the problem of falling into an infinite loop of redirection. Now if I try to go here: frontend_dev.php/sfStar/starit/model/BailiwickQuestion/id/55 I'm first redirected to the login screen, and then when that submits, I'm redirected here: frontend_dev.php/sfStar/starit I've now lost this part of the URL: model/BailiwickQuestion/id/55 So I end up with a fatal error: method called on a non-object. Any thoughts? I can not believe how hard this is. Seems like this is a fairly common thing, that most Symfony developers probably do on most sites. On May 15, 10:15 pm, nick lal...@teamlalala.com wrote: On May 15, 2:48 pm, David Ashwood da...@inspiredthinking.co.uk wrote: Aye - so looking at the code you need to pass the referring URL to the form from executeSignin. In the form them append the referrer to the post request with something like referrer=url. Then in the isValid codeblock - pull out the param and use it in your redirect. Are you suggesting (at the end of the process) handing the entire urldecoded() url to $this-redirect()? -- Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 symfony-users
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 16, 3:00 am, Sid Bachtiar sid.bacht...@gmail.com wrote: URL is in Symfony format, e.g.: 'module/action?param=value' Don't set the following app.yml sfGuard's setttings: all: sf_guard_plugin: success_signin_url: �...@my_route?param=value # the plugin use the referer as default Thanks for that tip. I've removed sucess_signing_url from app.yml. On Sat, May 16, 2009 at 6:46 PM, nick lal...@teamlalala.com wrote: On May 16, 12:59 am, Sid Bachtiar sid.bacht...@gmail.com wrote: Use $this-getUser()-setAttribute('referer', 'URL to come back to'); sfGuard upon successful login should try to take you there. Sad to say, that didn't work. My code now looks like this: if ($request-getParameter('redirect')) { $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } $this-getUser()-setAttribute('referer', $model.'/'.$action.'?'. $queryString); } $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user-getReferer('@homepage')); return $this-redirect($signinUrl); Just as before, when I log in, I'm sent back to the home page, rather than being sent forward to the page that I was trying to go to. But if I echo $model.'/'.$action.'?'.$queryString to the screen I can see that I have the right URL. But it is only the right URL the first time this code runs through (that is, when I submit the login form). Symfony then reloads the signin() method a second time, and at that point the page I'm coming from is the login page. I'm assuming this is a task that a lot of Symfony developers have implemented on their own sites. Could someone please post some sample code? On Sat, May 16, 2009 at 4:53 PM, nick lal...@teamlalala.com wrote: Clearly, I'm going about this all wrong. If anyone else out there who has done this wants to chime in, I'd be grateful. Out of desperation, I tried the straightforward approach, which I know is a big hack: $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } return $this-redirect($model.'/'.$action.'?'.$queryString); If I simply echo this last bit to the screen, I can see that I'm getting exactly what I need as an URL: frontend_dev.php/sfZed/zed/model/inventory/id/5 But I again get an infinite loop of redirection: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. So clearly, this adjustment is suppose to be made somewhere else in the code. I'm not suppose to be working in sfGuardAuth - executeSignin (). But where else do I make this adjustment? On May 15, 11:16 pm, nick lal...@teamlalala.com wrote: Interesting. I feel like I'm getting closer. Instead of getUri() I switched to using getPathInfo() in the form: form action=?php echo url_for('@sf_guard_signin') ? method=post table ?php echo $form ? /table input type=submit value=sign in / input type=hidden name=redirect value=?php echo substr ($sf_request-getPathInfo(), 1) ? / /form I had to use substr() to remove the first / forward slash, otherwise the address was treated as absolute from the document root. I then changed actions.class.php like this: $this-finalRedirectInForm = $request-getParameter('redirect'); return $this-redirect($this-finalRedirectInForm); This allowed me to escape the problem that I'd been having before - the problem of falling into an infinite loop of redirection. Now if I try to go here: frontend_dev.php/sfStar/starit/model/BailiwickQuestion/id/55 I'm first redirected to the login screen, and then when that submits, I'm redirected here: frontend_dev.php/sfStar/starit I've now lost this part of the URL: model/BailiwickQuestion/id/55 So I end up with a fatal error: method called on a non-object. Any thoughts? I can not believe how hard this is. Seems like this is a fairly common thing, that most Symfony developers probably do on most sites. On May 15, 10:15 pm, nick lal...@teamlalala.com wrote: On May 15, 2:48 pm, David Ashwood da...@inspiredthinking.co.uk wrote: Aye - so looking at the code you need to pass the referring URL to the form from executeSignin. In the form them append the referrer to the post request with something like referrer
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 16, 3:00 am, Sid Bachtiar sid.bacht...@gmail.com wrote: URL is in Symfony format, e.g.: 'module/action?param=value' Don't set the following app.yml sfGuard's setttings: all: sf_guard_plugin: success_signin_url: �...@my_route?param=value # the plugin use the referer as default Okay, I commented out the success_signin_url: # sf_guard_plugin: #success_signin_url: homepage I also removed my custom code for sfGuardAuth. I then ran: php symfony cc The I put a die statement in BasesfGuardAuthActions, just to be sure that the code was now back to using the default base class: die(hi); I could see this being triggered, so I took it out. So now I have the default code which comes with the sfGuard plugin, which looks like this: $user = $this-getUser(); if ($user-isAuthenticated()) { return $this-redirect('@homepage'); } $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin'); $this-form = new $class(); if ($request-isMethod('post')) { $this-form-bind($request-getParameter('signin')); if ($this-form-isValid()) { $values = $this-form-getValues(); $this-getUser()-signin($values['user'], array_key_exists ('remember', $values) ? $values['remember'] : false); // always redirect to a URL set in app.yml // or to the referer // or to the homepage $signinUrl = sfConfig::get ('app_sf_guard_plugin_success_signin_url', $user-getReferer ('@homepage')); return $this-redirect($signinUrl); } } And now, when I try to log in, I again get this error: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. Seems like I either redirect to the home page, or I end up in an infinite loop of redirection. Surely there is a way around this? On Sat, May 16, 2009 at 6:46 PM, nick lal...@teamlalala.com wrote: On May 16, 12:59 am, Sid Bachtiar sid.bacht...@gmail.com wrote: Use $this-getUser()-setAttribute('referer', 'URL to come back to'); sfGuard upon successful login should try to take you there. Sad to say, that didn't work. My code now looks like this: if ($request-getParameter('redirect')) { $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } $this-getUser()-setAttribute('referer', $model.'/'.$action.'?'. $queryString); } $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user-getReferer('@homepage')); return $this-redirect($signinUrl); Just as before, when I log in, I'm sent back to the home page, rather than being sent forward to the page that I was trying to go to. But if I echo $model.'/'.$action.'?'.$queryString to the screen I can see that I have the right URL. But it is only the right URL the first time this code runs through (that is, when I submit the login form). Symfony then reloads the signin() method a second time, and at that point the page I'm coming from is the login page. I'm assuming this is a task that a lot of Symfony developers have implemented on their own sites. Could someone please post some sample code? On Sat, May 16, 2009 at 4:53 PM, nick lal...@teamlalala.com wrote: Clearly, I'm going about this all wrong. If anyone else out there who has done this wants to chime in, I'd be grateful. Out of desperation, I tried the straightforward approach, which I know is a big hack: $arrayOfUrlParts = explode('/', $request-getParameter('redirect')); $model = $arrayOfUrlParts[0]; $action = $arrayOfUrlParts[1]; $queryString = ''; for ($i=2; $i count($arrayOfUrlParts); $i++) { if ($i % 2 == 0 ) $queryString .= $arrayOfUrlParts[$i] . '='; if ($i % 2 != 0 ) $queryString .= $arrayOfUrlParts[$i] . ''; } return $this-redirect($model.'/'.$action.'?'.$queryString); If I simply echo this last bit to the screen, I can see that I'm getting exactly what I need as an URL: frontend_dev.php/sfZed/zed/model/inventory/id/5 But I again get an infinite loop of redirection: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. So clearly, this adjustment is suppose to be made somewhere else in the code. I'm not suppose to be working in sfGuardAuth - executeSignin (). But where else do I make this adjustment? On May 15, 11:16 pm, nick lal...@teamlalala.com wrote: Interesting. I feel like I'm getting closer. Instead of getUri() I switched to using getPathInfo() in the form: form action=?php echo url_for('@sf_guard_signin
[symfony-users] once again, the error The default context does not exist.
I'm using Symfony 1.2.7. I'm using Propel as the ORM. I would like to be able to run this command: symfony propel:build-all-load I try to run this and I get the error: The default context does not exist. I look around on Google and there are dozens of mentions of this error, such as this discussion on the forum: http://forum.symfony-project.org/index.php/t/15101/ Apparently the problem is the sfContext() Here, Jonathon Wage suggests not using the current context in model classes: http://groups.google.com/group/symfony-devs/msg/52ffa70b40d5f44d Here Fabien Potencier responds to an old post about this problem, and he writes: One of the main goal of the configuration refactoring was to be able to use all symfony tools without initializing a sfContext object. However, I face a problem. sfContext is used in several plugins, and in dozens of places in the code. It shows up in the base classes generated by Propel. If I were to try to comment out the line that is cause the trouble, I would hardly know where to start. Consider how many times this appears. Suppose I change directory so that I'm in the symfony project directory, and then I run this command: grep -R sfContext * I get: apps/frontend/lib/myUser.class.php:sfContext::getInstance()- getConfiguration()-loadHelpers('Privacy'); lib/model/om/BaseApartmentInterestredRentPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentRentPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentCategoryPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentDraftAnswerPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentWaitListPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAffiliateInPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPrizeTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserProfileImagePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAuditTrailPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerStatusPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPasswordResetPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPrivacySettingPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAffiliateOutPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPaymentTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPriorityPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPaymentStatusPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserStatusPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentInterestredAnswerPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeaturedRentPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeatureTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeatureStatusPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentVotesPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentInterestredUserPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentRentTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPrivacyEntityPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentRentStatusPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentCategoryImagePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentImagePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentDraftRentPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserTransactionPeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserTransactionTypePeer.php:$request = sfContext::getInstance()-getRequest(); lib/model/ApartmentRent.php:
[symfony-users] Re: once again, the error The default context does not exist.
Okay, I came up with a ridiculous hack to get this working. I simply wanted to be able to run the load-data and build-all tasks. This page gives info about how to add sfContext to a task: http://www.symfony-project.org/book/1_2/16-Application-Management-Tools So on my machine I opened up these two files: /usr/share/php/symfony/plugins/sfPropelPlugin/lib/task/ sfPropelBuilAllLoadTask.class.php /usr/share/php/symfony/plugins/sfPropelPlugin/lib/task/ sfPropelLoadTask.class.php And I added this to the top of the file: require_once('/var/www/apartments/config/ ProjectConfiguration.class.php'); $configuration = ProjectConfiguration::getApplicationConfiguration ('frontend', 'dev', true); sfContext::createInstance($configuration); That got the tasks to run. One hell of an ugly hack. I hate editing core files. I feel like there should always be a solution to every problem that doesn't involve editing core fles. On May 17, 12:41 am, nick lal...@teamlalala.com wrote: I'm using Symfony 1.2.7. I'm using Propel as the ORM. I would like to be able to run this command: symfony propel:build-all-load I try to run this and I get the error: The default context does not exist. I look around on Google and there are dozens of mentions of this error, such as this discussion on the forum: http://forum.symfony-project.org/index.php/t/15101/ Apparently the problem is the sfContext() Here, Jonathon Wage suggests not using the current context in model classes: http://groups.google.com/group/symfony-devs/msg/52ffa70b40d5f44d Here Fabien Potencier responds to an old post about this problem, and he writes: One of the main goal of the configuration refactoring was to be able to use all symfony tools without initializing a sfContext object. However, I face a problem. sfContext is used in several plugins, and in dozens of places in the code. It shows up in the base classes generated by Propel. If I were to try to comment out the line that is cause the trouble, I would hardly know where to start. Consider how many times this appears. Suppose I change directory so that I'm in the symfony project directory, and then I run this command: grep -R sfContext * I get: apps/frontend/lib/myUser.class.php: sfContext::getInstance()- getConfiguration()-loadHelpers('Privacy'); lib/model/om/BaseApartmentInterestredRentPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentRentPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentCategoryPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentDraftAnswerPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserTypePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentWaitListPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAffiliateInPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPrizeTypePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerTypePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserProfileImagePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAuditTrailPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerStatusPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPasswordResetPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPrivacySettingPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAffiliateOutPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPaymentTypePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPriorityPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentPaymentStatusPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentUserStatusPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentInterestredAnswerPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeaturedRentPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeatureTypePeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentFeatureStatusPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om/BaseApartmentAnswerPeer.php: $request = sfContext::getInstance()-getRequest(); lib/model/om
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 15, 9:32 am, Alexandru-Emil Lupu gang.al...@gmail.com wrote: usually if you would set in your app config dir into security.yml all: is_secure: on then you won't have to worry .. any directory that would access your user, will be automatically redirected to login form unless he's already logged in. That would mean the page that was requested becomes the referer. So, the plugin will automatically redirect you to the initially requested page. Right, but that is not happening. As I explained in an earlier post: So if I'm at the home page and I try go here: index.php/wiki/show/id/54 The home page is treated as the referer. But after the user signs in, I want them to end up here: index.php/wiki/show/id/54 If I change this: return $this-redirect($signinUrl); to this: return $this-redirect($request-getUri()); then I end up with an infinite loop of redirection. (Or rather, if I put getUri() in the login form that submits.) Ideally I could use $this-forward(), but this forward usually takes a module and action like this: $this-forward('question', 'index'); I think it would be a lot of work for me to fetch the id and squeeze it in there. Everything I do seems to lead to an infinite redirection loop. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 15, 5:23 am, David Ashwood da...@inspiredthinking.co.uk wrote: There's a couple of places that tend to cause confusion when people try to override Symfony plugin functionality and the autoloader doesn't help when you're trying to test things out. You can generally create your own version of any class - if you put the new version in the right place and if the file and class are named properly. The location you put the file depends on a number of factors and the scope you want to affect. With plugins generally the best approach to start is to be as local to your Symfony app as possible. 1. Clear your cache - it doesn't hurt to do this before and after you start making changes and it's a good habit to do this often 2. Start by making a folder for the in apps\applicationName\modules\pluginName (often you just make the folder rather than using the generator) a. Depending on what you're overloading you create the sub folder here for it - so if you're modifying a template then create a templates folder under the plugin folder you just created 3. Now copy the existing file from the plugin to the folder you just created- it'll be a good starting place to making any changes. When copying a file it's the file that will be used initially by the autoloader rather than a file named Base.. a. So if you're looking to override the actions then, for sfGuard, it's going to be under the modules\sfGuardUser\actions\actions.class.php b. Well written plugins will also have a base file - for sfGuard this is BasesfGuardUserActions.class.php - which allows easy overriding of your own functionality c. You'll need to change the require/require_once statement in the top of this copied file to point to the correct place as when you override the autoloader won't be able to find the class you're trying to include. d. This file will generally just be a placeholder - with all the work being done in the parent class. You'll need to refer to the base class or have a decent IDE that gives you code assist or exploring of the methods in the parent to determine what method signatures are available for you 4. Now you can implement your own functionality in the file - for an action start with something simple like overriding a method and putting die(hey - it worked! - Who's da man?!?!) 5. Clear your cache again and fire up your browser to load a page under the application you used above 6. Now you see your die statement is being hit - you can implement the actual code you want to happen That's interesting that you test the code by putting in a die() statement. I do the same thing. But that has not been a problem in this case. I was able to override the plugin classes without any trouble. I saw my die() statement fire as soon as I had overridden sfGuardAuth. My problems started after that. Regarding your specific issue of capturing the source page where the use has come from - you want to override the actions for the plugin and store the referrer before sfGuard starts its own redirects - otherwise you'll lose the information in the chain of redirects that happen. Most people append the referrer to the URL as a parameter Yes, of course, but that isn't working for us. As I explained in an earlier post: When I look in BasesfGuardAuthActions.class.php, I see this code: $this-form-bind($request-getParameter('signin')); if ($this-form-isValid()) { $values = $this-form-getValues(); $this-getUser()-signin($values['user'], array_key_exists ('remember', $values) ? $values['remember'] : false); // always redirect to a URL set in app.yml // or to the referer // or to the homepage $signinUrl = sfConfig::get ('app_sf_guard_plugin_success_signin_url', $user-getReferer ('@homepage')); return $this-redirect($signinUrl); } We want the page that the user was trying to get to, which isn't treated as the referer on my machine. For instance, if I am at the home page, and then I try go here: index.php/wiki/show/id/54 The home page is treated as the referer. But after the user signs in, I want them to end up here: index.php/wiki/show/id/54 The address I want is in getUri() instead of getReferer(). However, if I change this: return $this-redirect($signinUrl); to this: return $this-redirect($request-getUri()); then I end up with an infinite loop of redirection. If I embed getUri() in the login form, and then submit it, and capture it as a parameter, and then use it in the line above, I still get an infinite loop of redirection. Ideally I could use $this-forward(), but this forward usually takes a module and action like this: $this-forward('question', 'index'); I think it would be a lot of work for me to fetch the id and squeeze it in there. I could also drop out of Symfony and do this: header('Location: ' . $request-getUri()); I tried this but it
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 15, 5:23 am, David Ashwood da...@inspiredthinking.co.uk wrote: Most people append the referrer to the URL as a parameter for this because unless you're careful you'll lose the information if you try to store it in the session/cookie (logging in will create a new session - so you'll need to transfer the information from the existing session if you don't want to lose the data). Actually, I'm having trouble escaping the URL. I tried this: return $this-redirect('sfGuardAuth/proceedToUrl?redirect='. urlencode ($request-getUri())); Came up with this: public function executeProceedToUrl($request) { $redirect = $request-getParameter(redirect); } Not sure how to redirect to $redirect, but that doesn't matter, because I never get that far. Instead I get a 404 error: The requested URL /mybailiwick/web/frontend_dev.php/sfGuardAuth/ proceedToUrl/redirect/http://192.148.1.160/mybailiwick/web/ frontend_dev.php/login If I understand things correctly, Symfony/sfGuard works like this: 1.) You attempt to go to a secure page, but you are not logged in, so you get redirected to executeSignin(). 2.) You fill in the login form and hit submit. 3.) You are still not yet logged in, so the code again redirects you to executeSignin(). But the page you just came from was the login screen. 4.) Now you are logged in. The code now wants to send you some place. getUri() now points to the page you just came from, which was the login screen. Redirecting to getUri() will lead to an infinite loop. getReferer() is empty, so the only other option is to redirect to the homepage. Check out this line from BasesfGuardAuthActions: $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user-getReferer('@homepage')); This code will return the URL for the homepage everytime. I can not figure out how to break out of this cycle. -Original Message- From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com] On Behalf Of H. Tuttle Sent: 15 May 2009 03:49 To: symfony users Subject: [symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere? Yes, that's right. You can make your own sfGuardAuth module. The other question almost as important is how do you overload the sfGuardUser class? I have tried making my own sfGuardUser.php in the / lib/model directory but with no success. I'd like to be able to stay completely out of the plugin folders. On May 14, 7:42 pm, Sid Bachtiar sid.bacht...@gmail.com wrote: That should be the default behaviour of sfGuardPlugin But if you want to customize the signinSuccess.php, don't do it on the plugin directory. Do it be creating myproject/myapp/modules/sfGuardAuth/templates/signinSuccess.php (do this manually, don't use symfony command line, e.g.: don't use symfony init-module). This should override the plugin's signinSuccess.php On Fri, May 15, 2009 at 12:23 PM, nick lal...@teamlalala.com wrote: If someone tries to go to a secure page, and they are not logged in, they get redirected to the login page, which has this template: plugins/sfGuardPlugin/modules/sfGuardAuth/templates/signinSucess.php I'd like to remember where the user was coming from, and then send them there if they log in successfully. Do I directly edit signinSuccess.php, or do I override it somewhere else? -- Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 15, 2:59 pm, David Ashwood da...@inspiredthinking.co.uk wrote: Nick, You'll need to urlencode the string to use it when you append it to the post url. The variable from the form isn't really a problem. But that is not where the problem is. I did this: form action=?php echo url_for('@sf_guard_signin') ? method=post table ?php echo $form ? /table input type=submit value=sign in / input type=hidden name=redirect value=?php echo urlencode ($sf_request-getUri()) ? / /form So now I've got an urlencoded() version of getUri in the form. But this is useless. In actions.class.php, I could try something like this: return $this-redirect(urldecode($request-getParameter('redirect')); But this simply gives me an infinite loop of redirection. Somehow this redirect happens before Symfony is aware of me being logged in? So it keeps trying to log me in, and it keeps getting redirected? Anyway, is this an appropriate use of $this-redirect()? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] is symfony aware of the yaml file that an option is defined in?
Symfony depends on a lot of yaml files, such as security.yml and setttings.yml and routing.yml. Does Symfony know in which file a given option is defined in? I'm under the impression that the division of options into certain files is meant as a convenience to human programmers, but has no meaning inside of Symfony's code. Or do the various classes (like sfRouting) that offer access to those variables/ options look up specific files when loading their data? I ask out of simple curiosity. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 15, 2:48 pm, David Ashwood da...@inspiredthinking.co.uk wrote: Aye - so looking at the code you need to pass the referring URL to the form from executeSignin. In the form them append the referrer to the post request with something like referrer=url. Then in the isValid codeblock - pull out the param and use it in your redirect. Are you suggesting (at the end of the process) handing the entire urldecoded() url to $this-redirect()? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
Interesting. I feel like I'm getting closer. Instead of getUri() I switched to using getPathInfo() in the form: form action=?php echo url_for('@sf_guard_signin') ? method=post table ?php echo $form ? /table input type=submit value=sign in / input type=hidden name=redirect value=?php echo substr ($sf_request-getPathInfo(), 1) ? / /form I had to use substr() to remove the first / forward slash, otherwise the address was treated as absolute from the document root. I then changed actions.class.php like this: $this-finalRedirectInForm = $request-getParameter('redirect'); return $this-redirect($this-finalRedirectInForm); This allowed me to escape the problem that I'd been having before - the problem of falling into an infinite loop of redirection. Now if I try to go here: frontend_dev.php/sfStar/starit/model/BailiwickQuestion/id/55 I'm first redirected to the login screen, and then when that submits, I'm redirected here: frontend_dev.php/sfStar/starit I've now lost this part of the URL: model/BailiwickQuestion/id/55 So I end up with a fatal error: method called on a non-object. Any thoughts? I can not believe how hard this is. Seems like this is a fairly common thing, that most Symfony developers probably do on most sites. On May 15, 10:15 pm, nick lal...@teamlalala.com wrote: On May 15, 2:48 pm, David Ashwood da...@inspiredthinking.co.uk wrote: Aye - so looking at the code you need to pass the referring URL to the form from executeSignin. In the form them append the referrer to the post request with something like referrer=url. Then in the isValid codeblock - pull out the param and use it in your redirect. Are you suggesting (at the end of the process) handing the entire urldecoded() url to $this-redirect()? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Weird 500 error
The only times I run into a big difference between the two environments is when I've failed to clear the cache. Try: php symfony cc On May 14, 4:48 am, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: I got a weird problem: if I sign in (POST a form) in the production environment, I get a 500 server error screen. But, when I do it in the development environment, everything works fine! Problem is, I don't get an error message! Does someone know how to fix this of where I have to search for the problem? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Is there a better way to find a related record other than looping?
I'm assuming you also need all of the Entry objects, for some reason that you did not mention? Because, clearly, if you didn't need all of the Entry objects, you could just get the EntryMeta objects that you want with a JOIN statement. But, assuming you need the extra data for some other reason, you could use a built-in PHP function, like array_walk(), to look through the array of Entry objects that were returned from database. I think this still involves a loop, but the loop is no longer happening in your code, it gets moved to the innards of array-walk(). On May 13, 11:59 pm, joshuacoady j...@lovetoknow.com wrote: The schema for this is below, but say I'm working with the Entry object and the query that loads the Entry object also loads the related EntryMeta at the same time. Now, I want to find the Entry's MetaData record that has a particular value for type. Is there a better way to do this than to loop through all of the Entry's MetaData? foreach($entry-MetaData as $meta) { if($meta-type == EntryMeta::Superscript) { $superscript = $meta-value; break; } } Is there a way to do something more like the following? $superscript = $entry-MetaData-findOneByType(EntryMeta::Superscript)- value; And neither of these should query the DB since I've already loaded all the Entry's MetaData when I originally queried the DB for the Entry. Is there some way to do this that I'm missing? Thanks! Entry: columns: id: type: integer primary: true autoincrement: true notnull: true slug: type: string(255) notnull: true headword: type: string(255) notnull: true options: type: INNODB collate: utf8_unicode_ci charset: utf8 indexes: slug: fields: [slug] EntryMeta: columns: id: type: integer primary: true autoincrement: true notnull: true entry_id: type: integer notnull: true type: type: integer notnull: true value: type: string(2000) notnull: true indexes: uk_type: fields: [entry_id, type] type: unique relations: Entry: local: entry_id foreign: id foreignAlias: MetaData --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
If someone tries to go to a secure page, and they are not logged in, they get redirected to the login page, which has this template: plugins/sfGuardPlugin/modules/sfGuardAuth/templates/signinSucess.php I'd like to remember where the user was coming from, and then send them there if they log in successfully. Do I directly edit signinSuccess.php, or do I override it somewhere else? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
On May 14, 8:42 pm, Sid Bachtiar sid.bacht...@gmail.com wrote: That should be the default behaviour of sfGuardPlugin Yes, but somehow that is not working for us. When I look in BasesfGuardAuthActions.class.php, I see this code: $this-form-bind($request-getParameter('signin')); if ($this-form-isValid()) { $values = $this-form-getValues(); $this-getUser()-signin($values['user'], array_key_exists ('remember', $values) ? $values['remember'] : false); // always redirect to a URL set in app.yml // or to the referer // or to the homepage $signinUrl = sfConfig::get ('app_sf_guard_plugin_success_signin_url', $user-getReferer ('@homepage')); return $this-redirect($signinUrl); } I can see that the call to sfConfig::get() looks either for a URL set in the config, or it looks to a response to getReferer. But we don't want the referer, we want the page that the user was trying to get to, which isn't treated as the referer on my machine. So if I'm at the home page and I try go here: index.php/wiki/show/id/54 The home page is treated as the referer. But after the user signs in, I want them to end up here: index.php/wiki/show/id/54 If I change this: return $this-redirect($signinUrl); to this: return $this-redirect($request-getUri()); then I end up with an infinite loop of redirection. (Or rather, if I put getUri() in the login form that submits.) Ideally I could use $this-forward(), but this forward usually takes a module and action like this: $this-forward('question', 'index'); I think it would be a lot of work for me to fetch the id and squeeze it in there. I could also drop out of Symfony and do this: header('Location: ' . $request-getUri()); but that seems like a hack. All I want to know is how other Symfony developers handle this. I'd like to do this the standard Symfony way. But if you want to customize the signinSuccess.php, don't do it on the plugin directory. Do it be creating myproject/myapp/modules/sfGuardAuth/templates/signinSuccess.php (do this manually, don't use symfony command line, e.g.: don't use symfony init-module). This should override the plugin's signinSuccess.php On Fri, May 15, 2009 at 12:23 PM, nick lal...@teamlalala.com wrote: If someone tries to go to a secure page, and they are not logged in, they get redirected to the login page, which has this template: plugins/sfGuardPlugin/modules/sfGuardAuth/templates/signinSucess.php I'd like to remember where the user was coming from, and then send them there if they log in successfully. Do I directly edit signinSuccess.php, or do I override it somewhere else? -- Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: do i directly edit sfGuardAuth signinSucess.php if I want to customize the signing form, or do I override it elsewhere?
I noticed that this problem used to be common, a year ago, but it was supposedly fixed 6 months ago, in ticket #3212: http://trac.symfony-project.org/ticket/3212 So I tried changing this: $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user-getReferer('@homepage')); to this: $signinUrl = $user-getAttribute('referer') ? $user-getAttribute ('referer') : $this-getRequest()-getReferer(); But now I get Redirect Loop - Firefox has detected that the server is redirecting the request for this address in a way that will never complete. I'm using Symfony 1.2.7 and sfGuardPlugin, not sure of version, but the files themselves say: 12075 2008-10-08. On May 14, 11:23 pm, nick lal...@teamlalala.com wrote: On May 14, 8:42 pm, Sid Bachtiar sid.bacht...@gmail.com wrote: That should be the default behaviour of sfGuardPlugin Yes, but somehow that is not working for us. When I look in BasesfGuardAuthActions.class.php, I see this code: $this-form-bind($request-getParameter('signin')); if ($this-form-isValid()) { $values = $this-form-getValues(); $this-getUser()-signin($values['user'], array_key_exists ('remember', $values) ? $values['remember'] : false); // always redirect to a URL set in app.yml // or to the referer // or to the homepage $signinUrl = sfConfig::get ('app_sf_guard_plugin_success_signin_url', $user-getReferer ('@homepage')); return $this-redirect($signinUrl); } I can see that the call to sfConfig::get() looks either for a URL set in the config, or it looks to a response to getReferer. But we don't want the referer, we want the page that the user was trying to get to, which isn't treated as the referer on my machine. So if I'm at the home page and I try go here: index.php/wiki/show/id/54 The home page is treated as the referer. But after the user signs in, I want them to end up here: index.php/wiki/show/id/54 If I change this: return $this-redirect($signinUrl); to this: return $this-redirect($request-getUri()); then I end up with an infinite loop of redirection. (Or rather, if I put getUri() in the login form that submits.) Ideally I could use $this-forward(), but this forward usually takes a module and action like this: $this-forward('question', 'index'); I think it would be a lot of work for me to fetch the id and squeeze it in there. I could also drop out of Symfony and do this: header('Location: ' . $request-getUri()); but that seems like a hack. All I want to know is how other Symfony developers handle this. I'd like to do this the standard Symfony way. But if you want to customize the signinSuccess.php, don't do it on the plugin directory. Do it be creating myproject/myapp/modules/sfGuardAuth/templates/signinSuccess.php (do this manually, don't use symfony command line, e.g.: don't use symfony init-module). This should override the plugin's signinSuccess.php On Fri, May 15, 2009 at 12:23 PM, nick lal...@teamlalala.com wrote: If someone tries to go to a secure page, and they are not logged in, they get redirected to the login page, which has this template: plugins/sfGuardPlugin/modules/sfGuardAuth/templates/signinSucess.php I'd like to remember where the user was coming from, and then send them there if they log in successfully. Do I directly edit signinSuccess.php, or do I override it somewhere else? -- Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] how do I get the URL? the old $_SERVER[QUERY_STRING] doesn't work correctly in symfony
How do I get the URL? The old $_SERVER[QUERY_STRING] doesn't work correctly in symfony - it seems to think the weblog/index/id/15 are all folders. I'm looking for a helper like url_for(), but in reverse. --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] when a form is submitted, when is HTML stripped out?
I've got a simple form, generated with propel. I've used jQuery to make the textarea a rich text editor. However, when the form submits, the HTML is stripped out. I don't see anything like strip_tags in the actions.class.php or the form. Where does this probably happen? In the validators? Where should I look? --~--~-~--~~~---~--~~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---