[symfony-users] Talking about performance, clustering etc.

2009-05-14 Thread Frank Stelzer

Hello,
I want to write an article about best practises for performance,  
clustering etc. in symfony. I think there isn't enough information out  
there, which is talking about these topics.
You all know the official performance documentation page 
(http://www.symfony-project.org/book/1_2/18-Performance 
), but you only get information about quite common stuff and not, what  
you have to do, when you are using more than one web server.
In the last months we discussed several mailings here, which included  
performance topics. But nevertheless, there is no central place, where  
all this information is written down.

I am developing in symfony since years now and i still do not know how  
to handle symfony in a web cluster the best way (although we are using  
symfony applications in a web cluster with more than 40 machines).

I am thinking about those topics:
- move file cache to memcached OR use a shared/mounted directory for  
file caching
- move session handling to memcached
- use  a web service for logging and get rid of normal file logging OR  
use syslog
- do not use ORM stuff in your web application and move it down a  
layer to a SOA application (REST or whatever)

So, feel free to list all your performance tweaks. I hope i'll get  
enough information here for detailed article(s).

Cheers,
Frank



--~--~-~--~~~---~--~~
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: Talking about performance, clustering etc.

2009-05-14 Thread Alexandru-Emil Lupu
HI!
this thread might provide you some cool info
http://groups.google.com/group/symfony-users/browse_thread/thread/853e0eaf964e1752?hl=en
Alecs

On Thu, May 14, 2009 at 10:10 AM, Frank Stelzer d...@bleedingmoon.de wrote:


 Hello,
 I want to write an article about best practises for performance,
 clustering etc. in symfony. I think there isn't enough information out
 there, which is talking about these topics.
 You all know the official performance documentation page (
 http://www.symfony-project.org/book/1_2/18-Performance
 ), but you only get information about quite common stuff and not, what
 you have to do, when you are using more than one web server.
 In the last months we discussed several mailings here, which included
 performance topics. But nevertheless, there is no central place, where
 all this information is written down.

 I am developing in symfony since years now and i still do not know how
 to handle symfony in a web cluster the best way (although we are using
 symfony applications in a web cluster with more than 40 machines).

 I am thinking about those topics:
 - move file cache to memcached OR use a shared/mounted directory for
 file caching
 - move session handling to memcached
 - use  a web service for logging and get rid of normal file logging OR
 use syslog
 - do not use ORM stuff in your web application and move it down a
 layer to a SOA application (REST or whatever)

 So, feel free to list all your performance tweaks. I hope i'll get
 enough information here for detailed article(s).

 Cheers,
 Frank



 



-- 
I am on twitter: http://twitter.com/alecslupu
I am on linkedIn: http://www.linkedin.com/in/alecslupu
Tel: (+4)0748.543.798

--~--~-~--~~~---~--~~
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: Talking about performance, clustering etc.

2009-05-14 Thread pixelmeister
Here are a view things fit to your planned article:

-
Move routinCache to memcache!
This is a often overlooked thing but higly improves performance.

-
Browsercaching.
Allow caching of css and js, how to handle eTags efficiently

-
Usage of lazy_routing
http://www.symfony-project.org/blog/2009/04/03/lazy-routing-deserialization


CU, pixelmeister

2009/5/14 Frank Stelzer d...@bleedingmoon.de


 Hello,
 I want to write an article about best practises for performance,
 clustering etc. in symfony. I think there isn't enough information out
 there, which is talking about these topics.
 You all know the official performance documentation page (
 http://www.symfony-project.org/book/1_2/18-Performance
 ), but you only get information about quite common stuff and not, what
 you have to do, when you are using more than one web server.
 In the last months we discussed several mailings here, which included
 performance topics. But nevertheless, there is no central place, where
 all this information is written down.

 I am developing in symfony since years now and i still do not know how
 to handle symfony in a web cluster the best way (although we are using
 symfony applications in a web cluster with more than 40 machines).

 I am thinking about those topics:
 - move file cache to memcached OR use a shared/mounted directory for
 file caching
 - move session handling to memcached
 - use  a web service for logging and get rid of normal file logging OR
 use syslog
 - do not use ORM stuff in your web application and move it down a
 layer to a SOA application (REST or whatever)

 So, feel free to list all your performance tweaks. I hope i'll get
 enough information here for detailed article(s).

 Cheers,
 Frank



 


--~--~-~--~~~---~--~~
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: how do I get the URL? the old $_SERVER[QUERY_STRING] doesn't work correctly in symfony

2009-05-14 Thread zwischenzeilen

have a look at this:

http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer#chapter_06_accessing_the_request

you are probably looking for the function $request-getPathInfo()


On 14 Mai, 03:48, nick lal...@teamlalala.com wrote:
 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] Re: Is there a better way to find a related record other than looping?

2009-05-14 Thread Thomas Rabaix
Hello,

If there is only one type per entry then you should use index by
feature. The key of the doctrine collection will be type ... so no
looping is needed

$entry-MetaData[EntryMeta::Superscript] will return the meta data model

On Thu, May 14, 2009 at 5:59 AM, 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

 



-- 
Thomas Rabaix
http://rabaix.net

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

2009-05-14 Thread pixelmeister
And what says the Apache Log?

2009/5/14 HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com


 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: Weird 500 error

2009-05-14 Thread Gábor Fási

Try changing the error_reporting level for the prod environment, and
you'll get an error message, just don't forget to set it back to the
default when you're done.

On Thu, May 14, 2009 at 10:48, 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: Admin Generator, Timestampable and I18N update

2009-05-14 Thread FlyLM [ML]

2009/5/13 FlyLM [ML] flylm...@gmail.com:
 Hello,

 I use Admin Generator to allow Admin users to update the local part of
 an object.

 The shema's object is defined like below :

 ubCgu:
    actAs:
     Timestampable: ~
     I18N:
      fields: [content]
      className: %CLASS%I18n
    columns:
      country_iso: { type:string(2), notnull:true }
      label: { type:string(64), notnull:true }
      content: { type:string, notnull:true }
    relations:
      ubCountry: { onDelete: CASCADE, local:country_iso, foreign: iso }

 When the user updates only the localized data (column named
 content), the Timestampable column named updated_at is not
 updated.

 Is it normal ??

I changed my schema to solve my problem. I set a Timestampable behavior on
the I18N fields.

ubCgu:
actAs:
 I18N:
  fields: [content]
  actAs:
Timestampable: ~
  className: %CLASS%I18n
columns:
  country_iso: { type:string(2), notnull:true }
  label: { type:string(64), notnull:true }
  content: { type:string, notnull:true }
relations:
  ubCountry: { onDelete: CASCADE, local:country_iso, foreign: iso }


 If the user modifies a column of the main table,  for example the
 column named label, the Timestampable column named updated_at is
 well updated.

 Thx
 Fabien


--~--~-~--~~~---~--~~
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: Talking about performance, clustering etc.

2009-05-14 Thread David Ashwood
I've used ipvs (http://www.linuxvirtualserver.org/software/ipvs.html)
effectively on a few sites for clients - it's more scalable than using
reverse proxies.

It's a handy  fast and efficient way to:
*   load balance
*   manage traffic to the cluster (allowing for transparently bringing
servers online/offline, migrations)
*   firewall the cluster and back-end services

I'm not a fan of moving the ORM layer - in terms of bang/buck it's just not
efficient or cost effective.
Logical separation is more important that physical separation.  It's enough
to use a dedicated db server and optimise the machine for the purpose.

One of the hardest problems is dealing with assets in dynamic sites -
images, movies, etc - when you have multiple servers.
Shared file systems (ie NFS) just doesn't cut it.  For a couple of clients
I've used libs built on fuse but OS support can be patchy.
The handy thing about fuse is that you can use it fairly easily in
conjunction with CDN's but planning the financials is complex - and it's
something you need to consider in your architecture.
Fuse in local mode is easy to setup, scalable, fault tolerant and fast -
most hosting providers have gigabit local network connections (and local
network traffic isn't billable).  There's a couple of hosting providers that
implement local CDN's which they make available for clients - but these are
few and far between.  

Most projects I tend to recommend the VPS route rather than dedicated
machines.  It's cost effective, allows for growth, machines can be
provisioned in minutes rather than days and you can respond quickly if
traffic increases.  Allocating/de-allocating extra resources is usually just
a few clicks away and if you start exceeding your optimal utilisation you
can provision another machine, hot tweak the IPVS table and you suddenly
have another machine serving your users.  Good hosting providers even have
API's that allow your application to adjust its resources up/down from
within the app.  If it's a short term spike (due to a promotion, press, etc)
then when things calm down a few days later - you can hot tweak the ipvs
table, un-provision the machine and hey presto - you've only incurred costs
for the duration.  Implementing this type of approach means you need to
understand when it's best to scale up and when you scale out - and it's hard
to determine what strategy to take until you have optimised your environment
and have accurate metrics about how your application performs.  With this
you can set thresholds and with monitoring in-place the application can
notify you when these are exceeded.

The above tends to translate into the following architecture:


[Web
Server.1]
.net-  [IPVS]  -(private network)-[Web Server.2]  -(private
network)- [DB Server]
[Web
Server.n]
[Services
(DNS, monitoring, mail, etc)]




-Original Message-
From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com]
On Behalf Of Frank Stelzer
Sent: 14 May 2009 09:10
To: symfony users
Subject: [symfony-users] Talking about performance, clustering etc.


Hello,
I want to write an article about best practises for performance,  
clustering etc. in symfony. I think there isn't enough information out  
there, which is talking about these topics.
You all know the official performance documentation page
(http://www.symfony-project.org/book/1_2/18-Performance 
), but you only get information about quite common stuff and not, what  
you have to do, when you are using more than one web server.
In the last months we discussed several mailings here, which included  
performance topics. But nevertheless, there is no central place, where  
all this information is written down.

I am developing in symfony since years now and i still do not know how  
to handle symfony in a web cluster the best way (although we are using  
symfony applications in a web cluster with more than 40 machines).

I am thinking about those topics:
- move file cache to memcached OR use a shared/mounted directory for  
file caching
- move session handling to memcached
- use  a web service for logging and get rid of normal file logging OR  
use syslog
- do not use ORM stuff in your web application and move it down a  
layer to a SOA application (REST or whatever)

So, feel free to list all your performance tweaks. I hope i'll get  
enough information here for detailed article(s).

Cheers,
Frank




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

[symfony-users] Re: Weird 500 error

2009-05-14 Thread David Ashwood

Look at your php/apache logs and turn on symfony logging for the production
environment.

-Original Message-
From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com]
On Behalf Of HAUSa
Sent: 14 May 2009 10:49
To: symfony users
Subject: [symfony-users] Weird 500 error


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?

2009-05-14 Thread David Ashwood
Heh J

 

From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com] On 
Behalf Of Thomas Rabaix
Sent: 14 May 2009 10:53
To: symfony-users@googlegroups.com
Subject: [symfony-users] Re: Is there a better way to find a related record 
other than looping?

 

Hello,

If there is only one type per entry then you should use index by
feature. The key of the doctrine collection will be type ... so no
looping is needed

$entry-MetaData[EntryMeta::Superscript] will return the meta data model

On Thu, May 14, 2009 at 5:59 AM, 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






-- 
Thomas Rabaix
http://rabaix.net



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

2009-05-14 Thread David Ashwood

Depending on how the data is organised you can try:

$entry-MetaData[EntryMeta::Superscript]['value'] or
$entry-MetaData[EntryMeta::Superscript]-value


-Original Message-
From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com]
On Behalf Of joshuacoady
Sent: 14 May 2009 05:59
To: symfony users
Subject: [symfony-users] Is there a better way to find a related record
other than looping?


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] symfony at the sourceforge community choice awards

2009-05-14 Thread David Herrmann

I've nominated symfony in 3 categories at the sourceforge community 
choice awards (http://sourceforge.net/community/cca09/):

* symfony PHP framework for Best Tool or Utility for Developers
* symfony PHP framework for Best Project
* symfony PHP framework for Best Commercial Open Source Project

Follow this link to support the symfony nomination too:
http://sourceforge.net/community/cca09/nominate/?project_name=symfony 
PHP frameworkproject_url=http://www.symfony-project.org/

Could someone put this onto the symfony website? There's also an image 
for linking located at http://sourceforge.net/images/cca/cca_nominate.png

David

--~--~-~--~~~---~--~~
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 it possible to change database without loosing any data ?

2009-05-14 Thread Jason

When learning about sf doctrine migrations I found this page to be the
most informative:
http://www.doctrine-project.org/documentation/cookbook/1_0/en/symfony-and-doctrine-migrations

On May 13, 2:45 am, dziobacz aaabbbcccda...@gmail.com wrote:
 OK - I know :)))
 If we have files: 001_file1.class.php and 002_file2.class.php
 symfony doctrine:migrate 002 - migrate from 001 version
 (001_file1.class.php) to 002 version (002_file2.class.php)
 symfony doctrine:migrate 000 - migrate from 002 version - 001 version
 - 000 version (database at the beginning, not file)
 symfony doctrine:migrate 001 - migrate to 001 version

 WONDERFUL !! xD

 On 13 Maj, 08:27, dziobacz aaabbbcccda...@gmail.com wrote:

  You have written: 'Each class essentially represents a version of your
  database and the up() and down() methods allow you to walk backwards
  and forwards between versions of your database.' - so I can return in
  symfony to previous version database ? May I know how ? :)

  On 12 Maj, 22:55, Jonathan Wage jonw...@gmail.com wrote:

   Not at the same level of Doctrine.

   - Jon

   On Tue, May 12, 2009 at 3:47 PM, Craig cr...@pixelfusion.co.nz wrote:

Hi,

Is there something similar for migrating database schemas in Propel?

Cheers
Craig

On May 13, 5:17 am, dziobacz aaabbbcccda...@gmail.com wrote:
 WoW !! Thx so much !!

 I have one more question - If I have for example 100. files (I don't
 have but I am interested) migration class - can I choose file to
 migration, for example: 090_something.class.php ?

 So the solution for other people is:
 In \lib\migration\doctrine create new file - the name isn't important
 but the name must begin number, for example: 001_, 002_, 003 ...
 for example: 001_something.class.php, in this file write (the name of
 class isn't important):
 class Cheese extends Doctrine_Migration
 {
         public function up()
         {
                 $this-addColumn('table_name', 'new_column_name',
'string', array
 ('length' = '255'));
         }

         public function down()
         {

         }

 }

 And then write: symfony doctrine:migrate - and we have new column :)

 On 12 Maj, 18:51, Jonathan Wage jonw...@gmail.com wrote:

  bootstrap.php is something you would have seen earlier in the
documentation.
  The examples in the Doctrine documentation are for use outside of
symfony.
  You can simply place your migration class in lib/migrations/doctrine
and
  then run the command ./symfony doctrine:migrate

  - Jon

  On Tue, May 12, 2009 at 11:49 AM, dziobacz 
  aaabbbcccda...@gmail.com
wrote:

   my migrate.php file:
   require_once('bootstrap.php');
   $migration = new Doctrine_Migration('001_something.class');
   $migration-migrate();

   my 001_something.class.php file:
   class Something extends Doctrine_Migration
   {
          public function up()
          {
                  $this-addColumn('my_new_column', 'Kariera', 
   'string',
array
   ('length' = '255'));
          }

          public function down()
          {

          }
   }

   After wrote:
   C:\Program Files\WebServ\httpd\sf_sandboxphp 
   migrations/migrate.php

   Warning: require_once(bootstrap.php) 
   [http://www.php.net/manual/pl/
   function.requ
   ire-once]: failed to open stream: No such file or directory in C:
   \Program Files\
   WebServ\httpd\sf_sandbox\migrations\migrate.php on line 2

   Fatal error: require_once() [http://www.php.net/manual/pl/
   function.require]: Fai
   led opening required 'bootstrap.php' (include_path='.;C:\Program
Files
   \WebServ\p
   hp\pear') in C:\Program Files\WebServ\httpd\sf_sandbox\migrations
   \migrate.php on
    line 2

   I searched where is bootstrap.php but I found only in C:\Program
Files
   \WebServ\httpd\sf_sandbox\test\bootstrap files: functional.php and
   unit.php

  --
  Jonathan H. Wage (+1 415 992 5468)
  Open Source Software Developer  Evangelist
  sensiolabs.com | jwage.com | doctrine-project.org |
symfony-project.org

   --
   Jonathan H. Wage (+1 415 992 5468)
   Open Source Software Developer  Evangelist
   sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
--~--~-~--~~~---~--~~
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] segment_names options in sfPropelRouteCollection

2009-05-14 Thread pilot

What is the use of the segment_names option for
sfPropelRouteCollection in routing.yml ?

--~--~-~--~~~---~--~~
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] I uploaded a file, but only got a parameter?

2009-05-14 Thread Stephen

Request:
item: { category_id: '1', item_name: adsfa, item_detail: adfad,
item_price: '34', pic1: avatar.php.jpeg, pic2: '', pic3: '', pic4: '',
link: ''}

Globals:
files: {  }
===
That avatar.php.jpeg was the file I uploaded, supposed in the files
field.

The code of the Form:

$this-widgetSchema['pic1'] = new sfWidgetFormInputFileEditable(array(
  'label' = 'Picture 1',
  'file_src'  = '/uploads/item/'.$this-getObject()-getPic1(),
  'is_image'  = true,
  'edit_mode' = !$this-isNew(),
  'template'  = 'div%file%br /%input%br /%delete% 删除此文件/
div',
));

$this-validatorSchema['pic1'] = new sfValidatorFile(array(
  'required'   = false,
  'path'   = sfConfig::get('sf_upload_dir').'/item',
  'mime_types' = 'web_images',
));

Could anyone tell me what is 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] I uploaded a file, but only got a parameter?

2009-05-14 Thread Stephen

Request:
item: { category_id: '1', item_name: adsfa, item_detail: adfad,
item_price: '34', pic1: avatar.php.jpeg, pic2: '', pic3: '', pic4: '',
link: ''}

Globals:
files: {  }
===
That avatar.php.jpeg was the file I uploaded, supposed in the files
field.

The code of the Form:

$this-widgetSchema['pic1'] = new sfWidgetFormInputFileEditable(array(
  'label' = 'Picture 1',
  'file_src'  = '/uploads/item/'.$this-getObject()-getPic1(),
  'is_image'  = true,
  'edit_mode' = !$this-isNew(),
  'template'  = 'div%file%br /%input%br /%delete% Delete/
div',
));

$this-validatorSchema['pic1'] = new sfValidatorFile(array(
  'required'   = false,
  'path'   = sfConfig::get('sf_upload_dir').'/item',
  'mime_types' = 'web_images',
));

Could anyone tell me what is 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: I uploaded a file, but only got a parameter?

2009-05-14 Thread Stephen

I didn't use the tag enctype=multipart/form-data
Wasted a day of mine. So stupid...

On May 14, 9:41 pm, Stephen stephen.j.t...@gmail.com wrote:
 Request:
 item: { category_id: '1', item_name: adsfa, item_detail: adfad,
 item_price: '34', pic1: avatar.php.jpeg, pic2: '', pic3: '', pic4: '',
 link: ''}

 Globals:
 files: {  }
 ===
 That avatar.php.jpeg was the file I uploaded, supposed in the files
 field.

 The code of the Form:

 $this-widgetSchema['pic1'] = new sfWidgetFormInputFileEditable(array(
       'label'     = 'Picture 1',
       'file_src'  = '/uploads/item/'.$this-getObject()-getPic1(),
       'is_image'  = true,
       'edit_mode' = !$this-isNew(),
       'template'  = 'div%file%br /%input%br /%delete% Delete/
 div',
     ));

 $this-validatorSchema['pic1'] = new sfValidatorFile(array(
       'required'   = false,
       'path'       = sfConfig::get('sf_upload_dir').'/item',
       'mime_types' = 'web_images',
     ));

 Could anyone tell me what is 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: Symfony-Doctrine Migrations and Branches

2009-05-14 Thread Fabrice B

A less technical solution :

 - everybody has on its own computer the main branch and his own
branch, which share the same development database
 - the rule is to create migration files only in the main branch

As long as migrations only affect database structure in a non-
destructive way, this works pretty fine. This is less fine if you :
 - delete tables/columns that another developer is still using. But
that is a bad sign in general !
 - or if you want to include code that refers to the model in the
migration. But experience shows that this is also a bad idea to do
anything else than modifications to the database structure in
migrations.

Cheers,

Fabrice Bernhard
--
http://www.theodo.fr
http://www.allomatch.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] How to configure sfGuard?

2009-05-14 Thread Zap

Hi,

I wonder if it is possible to change default routes in sfGuard plugin?
I can easy customize the main route, which show list of defined users,
but action links on this page lead to
admin/sf_guard_user/new
admin/sf_guard_user/edit
etc.

Is there any way how to configure it in YML files or somehow to route
will be:
admin/users/new ?


And other question is:  I created a user profiles (fields name,
surname, e-mail) and I want to show whole name in User List page
(admin/sf_guard_user). I can do it with definet partial or add
function getName() in plugins/sfGuardPlugin/lib/model/sfGuardUser.php
and then simply edit generator.yml

[code]
list:
display: [username, name]
[/code]

But the column Name is not sortable. It is possible to make it
sortable somehow or not?

Could anyone help me solve this problems?
Thanks a lot.
--~--~-~--~~~---~--~~
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: How to configure sfGuard?

2009-05-14 Thread David Ashwood

The second of your questions can only be done by using DbFinder I think
(http://www.symfony-project.org/plugins/DbFinderPlugin) - checkout the
section Alternative Framework Components.


-Original Message-
From: symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com]
On Behalf Of Zap
Sent: 14 May 2009 18:13
To: symfony users
Subject: [symfony-users] How to configure sfGuard?


Hi,

I wonder if it is possible to change default routes in sfGuard plugin?
I can easy customize the main route, which show list of defined users,
but action links on this page lead to
admin/sf_guard_user/new
admin/sf_guard_user/edit
etc.

Is there any way how to configure it in YML files or somehow to route
will be:
admin/users/new ?


And other question is:  I created a user profiles (fields name,
surname, e-mail) and I want to show whole name in User List page
(admin/sf_guard_user). I can do it with definet partial or add
function getName() in plugins/sfGuardPlugin/lib/model/sfGuardUser.php
and then simply edit generator.yml

[code]
list:
display: [username, name]
[/code]

But the column Name is not sortable. It is possible to make it
sortable somehow or not?

Could anyone help me solve this problems?
Thanks a lot.


--~--~-~--~~~---~--~~
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] Doctrine schema file problems with generated forms

2009-05-14 Thread Gary Rojas

I'm working with Symfony 1.2 and Doctrine 1.0 and I'm getting errors
with the generated forms

Here is part of my schema.yml
##
pltProjectModule:
  tableName: plt_project_module
  columns:
project_id:
  type: integer(4)
  primary: true
module_id:
  type: integer(4)
  primary: true
  relations:
Project:
  class: pltProject
  foreignAlias: ProjectModules
  local: project_id
  onDelete: CASCADE
Module:
  class: pltModule
  foreignAlias: ProjectModules
  local: module_id
  onDelete: CASCADE

pltProjectModuleConfig:
  tableName: plt_project_module_config
  columns:
project_id:
  type: integer(4)
  primary: true
module_id:
  type: integer(4)
  primary: true
config_id:
  type: integer(4)
  primary: true
value:
  type: string(250)
  notnull: true
  default: ''
  relations:
Config:
  class: pltConfig
  foreignAlias: ProjectModuleConfigs
  local: config_id
  onDelete: CASCADE
ProjectModule:
  class: pltProjectModule
  foreignAlias: ProjectModuleConfigs
  local: [project_id, module_id]
  onDelete: CASCADE
##

You can see i'm using a many-to-many relation and the primary key is
composed by two fields (local: [project_id, module_id] defined in
pltProjectModuleConfig model ). But when i go to see the form for
the model BasepltProjectModuleConfigForm i find an error in the
field value.

Here is BasepltProjectModuleConfigForm.class.php
##
public function setup()
  {
$this-setWidgets(array(
  'project_id' = new sfWidgetFormInputHidden(),
  'module_id'  = new sfWidgetFormInputHidden(),
  'config_id'  = new sfWidgetFormInputHidden(),
  'value'  = new
Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR
\symfony\plugins\sfDoctrinePlugin\lib\generator
\sfDoctrineColumn.class.php on line 230
sfWidgetFormInput(
Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR
\symfony\plugins\sfDoctrinePlugin\lib\generator
\sfDoctrineColumn.class.php on line 230
),
));

$this-setValidators(array(
  'project_id' = new sfValidatorDoctrineChoice(array('model' =
'pltProjectModuleConfig', 'column' = 'project_id', 'required' =
false)),
  'module_id'  = new sfValidatorDoctrineChoice(array('model' =
'pltProjectModuleConfig', 'column' = 'module_id', 'required' =
false)),
  'config_id'  = new sfValidatorDoctrineChoice(array('model' =
'pltProjectModuleConfig', 'column' = 'config_id', 'required' =
false)),
  'value'  = new
Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR
\symfony\plugins\sfDoctrinePlugin\lib\generator
\sfDoctrineColumn.class.php on line 230
sfValidatorString(
Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR
\symfony\plugins\sfDoctrinePlugin\lib\generator
\sfDoctrineColumn.class.php on line 230
array('max_length' = 250)),
));

$this-widgetSchema-setNameFormat('plt_project_module_config
[%s]');

$this-errorSchema = new sfValidatorErrorSchema($this-
validatorSchema);

parent::setup();
  }
##

I trying solve in many ways but I think the problem is local:
[project_id, module_id] because when i take it out forms are
generated fine.

Thanks so much



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

2009-05-14 Thread nick

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?

2009-05-14 Thread nick

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?

2009-05-14 Thread nick


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?

2009-05-14 Thread Sid Bachtiar

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 Development
http://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?

2009-05-14 Thread H. Tuttle

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?

2009-05-14 Thread Sid Bachtiar

I don't know how to do this without doing stuffs in the plugin folder

Why do you want to overload sfGuardUser?

On Fri, May 15, 2009 at 1:48 PM, H. Tuttle lacyrhoa...@gmail.com wrote:

 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
 




-- 
Blue Horn Ltd - System Development
http://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?

2009-05-14 Thread nick



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] Why the form isn't saved?

2009-05-14 Thread Reynier Perez Mira

Hi every:
I have a form which code is this one (soury for be to long):

?php use_stylesheet('form.css') ?
?php include_javascripts_for_form($form) ?
?php if ($form-hasGlobalErrors()): ?
  div id=msg_error?php echo $form-renderGlobalErrors() ?/div
?php endif; ?
?php echo form_tag('@reservacion_create', 
array('class'='formulario_nuevo_editar')) ?
?php echo $form['id_profesor'] ?
fieldset class=datos
  legend?php echo __('datos_profesor') ?/legend
  ul
li?php echo $form['nombre_profesor']-renderLabel(), 
$form['nombre_profesor'] ?/li
li?php echo $form['id_apartamento']-renderLabel(), 
$form['id_apartamento'] ?/li
  /ul
/fieldset

fieldset class=datos
  legend?php echo __('datos_visitante') ?/legend
  ul
li?php echo $form['carne_identidad']-renderLabel(), 
$form['carne_identidad'] ?/li
li?php echo $form['nombre_visitante']-renderLabel(), 
$form['nombre_visitante'] ?/li
li?php echo $form['id_parentezco']-renderLabel(), 
$form['id_parentezco'] ?/li
li?php echo $form['sexo']-renderLabel(), $form['sexo'] ?/li
  /ul
/fieldset

fieldset class=datos
  legend?php echo __('datos_reservacion') ?/legend
  ul
?php if($sf_context-getActionName() == NewSpecial): ?
li?php echo $form['motivo_reservacion']-renderLabel(), 
$form['motivo_reservacion'] ?/li
?php endif; ?
li?php echo $form['desayuno']-renderLabel(), $form['desayuno'] ?/li
li?php echo $form['almuerzo']-renderLabel(), $form['almuerzo'] ?/li
li?php echo $form['comida']-renderLabel(), $form['comida'] ?/li
?php if ($sf_user-hasCredential('administrador')): ?
li?php echo $form['estado_reservacion']-renderLabel(), 
$form['estado_reservacion'] ?/li
?php endif; ?
li?php echo $form['id_complejo_comedor']-renderLabel(), 
$form['id_complejo_comedor'] ?/li
li?php echo $form['fecha_entrada']-renderLabel(), 
$form['fecha_entrada'] ?/li
li?php echo $form['fecha_salida']-renderLabel(), $form['fecha_salida'] 
?/li
  /ul
/fieldset

pinput type=submit value=?php echo __('salvar') ? //p
/form

div class=links_bar_left
  ?php echo link_to(__('cancelar'), '@reservacion') ?
  ?php if (!$form-getObject()-isNew()): ?
  | ?php echo link_to(__('eliminar'), 
'@eliminar_reservacion?id='.$form-getObject()-getIdReservacion(), 
array('method'='delete','confirm'=__('alerta_eliminar'))) ?
  ?php endif; ?
/div

The module was generated using the task: symfony propel:generate-module. Then 
in the actions.class.php I have this code:

public function executeNew(sfWebRequest $request) {
$this-form = new TbReservacionForm();
}

protected function processForm(sfWebRequest $request, sfForm $form) {
$form-bind($request-getParameter($form-getName()), 
$request-getFiles($form-getName()));
if ($form-isValid()) {
  $tb_reservacion = $form-save();
  
$this-redirect('reservacion/edit?id_reservacion='.$tb_reservacion-getIdReservacion());
   }
}

When I try to insert the data nothing happen and I don't know why because none 
error appears. Any help or tip?

Cheers and thanks in advance
Ing. Reynier Pérez Mira
Dirección Técnica IP


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

2009-05-14 Thread nick


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] Re: Why the form isn't saved?

2009-05-14 Thread Frank Stelzer

Hi,
Your form is invalid, because your bind call is not correct. A missing  
array_merge call is missing there.
Try this one:


 protected function processForm(sfWebRequest $request, sfForm $form) {
$form-bind( array_merge($request-getParameter($form-getName(),  
 array() ), $request-getFiles($form-getName(;
if ($form-isValid()) {
  $tb_reservacion = $form-save();
  $this-redirect('reservacion/edit?id_reservacion='. 
 $tb_reservacion-getIdReservacion());
   }
 else
 {
// only for debugging
echo DAMN, THIS FORM IS NOT VALID;
  }

 }

- Frank



Am 15.05.2009 um 05:30 schrieb Reynier Perez Mira:

 protected function processForm(sfWebRequest $request, sfForm $form) {
$form-bind($request-getParameter($form-getName()), $request- 
 getFiles($form-getName()));
if ($form-isValid()) {
  $tb_reservacion = $form-save();
  $this-redirect('reservacion/edit?id_reservacion='. 
 $tb_reservacion-getIdReservacion());
   }
 }

 When I try to insert the data nothing happen and I don't know why  
 because none error appears. Any help or tip?


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