[symfony-users] Re: sfDoctrineGuardPlugin: automatically add new user to a group

2009-05-26 Thread FlyLM [ML]

2009/5/25 Campezzi campe...@gmail.com:

 Hi Fabien,

 Thanks for the answer. Since the group was supposed to be added
 automatically, I had the groups_list widget unset in my form. The
 function you pointed me to seems to take what was stored in that
 variable and link the values to the user being registered. I assume I
 can get this working by making the groups_list field a hidden one and
 setting the default value on the action or even on the form code
 itself - then the code line you pointed out would do ther rest.
 However, I'm unsure about how safe this is - couldn't an user
 deliberately change the value of my hidden groups_list field in an
 attempt to be added to another group, one with a different permission
 set?

Hi Campezzi,

I had a same behavior in my last project. When I create a new user,
the group is automaticaly associated, there is no choice in the form.
First, I had thought about used a hidden field for goup_list, but I
didn't keep this idea. I have override the doSave method of my form.

So, my doSave method looks like this :

class backendSfGuardUserAdminForm extends BasesfGuardUserAdminForm
{
  []

  /**
   * (non-PHPdoc)
   * @see 
lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserForm#doSave()
   */
  protected function doSave($con = null)
  {
$isNew = $this-isNew();

if( $isNew )
{
  $password = substr(md5(rand(10, 99)), 0, 8);
  $this-getObject()-setPassword($password);
}

parent::doSave($con);

if( $isNew )
{
  // Set the group, here customer
  $group = Doctrine::getTable('sfGuardGroup')-findOneByName('customer');

  $this-getObject()-link('groups', $group-getId());
}
  }

  []
}

Fabien


 Best Regards,
 Campezzi


 On May 25, 12:53 pm, FlyLM [ML] flylm...@gmail.com wrote:
 Hi,

 If you have always sfDoctrineGuardPlugin installed, take a look at
 this file line 84 (savegroupsList method)

 /lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesGuardUserForm.class.php

 = $this-object-link('groups', array_values($link));

 Fabien

 2009/5/25 Campezzi campe...@gmail.com:



  Hi there!

  I'm getting started with sfDoctrineGuardPlugin and after doing a few
  tutorials, I started to implement it in one of my projects. I have
  created a registration form and embedded the Profile class form. So
  far, so good - whenever a new user registers, both the sfGuardUser and
  Profile objects get saved to the database and are correctly
  associated.

  Now, I have a users sfGuardGroup with a set of permissions (its id
  is 1), and I'd like to put all members who sign up via this
  registration form automatically in this group. My first idea was to
  override the save() method of the Profile model to do that:

  class Profile extends BaseProfile
  {
         public function save(Doctrine_Connection $conn = null)
         {
                 $ret = parent::save($conn);

                 $relation = new sfGuardUserGroup();
                 $relation-user_id = $this-sf_guard_user_id;
                 $relation-group_id = 1;
                 $relation-save();

                 return $ret;
         }
  }

  However, when I try to add a new user through the form I get a SQL
  error:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  '5-1' for key 'PRIMARY'

  ... where 5 is the id of the newly created sfGuardUser and 1 is the id
  of the sfGuardGroup I'm trying to add the user to. Of course, I
  checked the database and there are no other sfGuardUserGroup objects
  with the 5-1 key combination, hence it's not a duplicate record thing.

  I tried searching around, but found nothing about this error other
  than a few complaints about the save() method not being called on
  objects saved through embedded forms. It seems that is the issue here
  - I'm trying to create a many-to-many relation, but the user is not
  yet saved to the database when I try saving the relation, so the
  database throws an error because I'm adding a reference to an object
  that does not exist. However, if that is really the problem, isn't it
  weird that my profile actually has its sf_guard_user_id property set?!

  So, the 64.5 million dollar question: how do I get this to act like I
  expect it to 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] Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread halla

Hi everybody,

I'm using different routes for my application, which also determine
the response format (xml or json for an REST-based web service).

This is an example rule in routing.yml:

user_me:
  url:  /user/me.:sf_format
  params:   { module: user, action: getUserMe }
  requirements: { sf_method: GET, sf_format: (?:xml|json) }

Is there a way to set sf_format to XML if NO .xml|json is given in the
URL (the Suffix should be optional)? So that this ressource can be
called via the  following URLs:

(1) /user/me.xml - XML-Response
(2) /user/me.json - JSON-Response
(3) /user/me - XML-Response

Actually, a 404 is raised by symfony if the ressource is called via
(3).

Thanks for your help in advance,
Daniel
--~--~-~--~~~---~--~~
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: Routing-Rules: use sf_format only as an optional value

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

This is how it's done in jobeet, day 15:

// apps/frontend/config/routing.yml
category:
  url: /category/:slug.:sf_format
  class:   sfPropelRoute
  param:   { module: category, action: show, sf_format: html }
  options: { model: JobeetCategory, type: object }
  requirements:
sf_format: (?:html|atom)


On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

 Hi everybody,

 I'm using different routes for my application, which also determine
 the response format (xml or json for an REST-based web service).

 This is an example rule in routing.yml:

 user_me:
  url:                  /user/me.:sf_format
  params:               { module: user, action: getUserMe }
  requirements: { sf_method: GET, sf_format: (?:xml|json) }

 Is there a way to set sf_format to XML if NO .xml|json is given in the
 URL (the Suffix should be optional)? So that this ressource can be
 called via the  following URLs:

 (1) /user/me.xml - XML-Response
 (2) /user/me.json - JSON-Response
 (3) /user/me - XML-Response

 Actually, a 404 is raised by symfony if the ressource is called via
 (3).

 Thanks for your help in advance,
 Daniel
 


--~--~-~--~~~---~--~~
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: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread halla

Yes, thats exactly the same way like I do it also :-) Except the
sfPropelRoute.
But, like I wrote: This raises a 404 if the URL is called without
suffix :-((

On 26 Mai, 12:19, Gábor Fási maerl...@gmail.com wrote:
 This is how it's done in jobeet, day 15:

 // apps/frontend/config/routing.yml
 category:
   url:     /category/:slug.:sf_format
   class:   sfPropelRoute
   param:   { module: category, action: show, sf_format: html }
   options: { model: JobeetCategory, type: object }
   requirements:
     sf_format: (?:html|atom)

 On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

  Hi everybody,

  I'm using different routes for my application, which also determine
  the response format (xml or json for an REST-based web service).

  This is an example rule in routing.yml:

  user_me:
   url:                  /user/me.:sf_format
   params:               { module: user, action: getUserMe }
   requirements: { sf_method: GET, sf_format: (?:xml|json) }

  Is there a way to set sf_format to XML if NO .xml|json is given in the
  URL (the Suffix should be optional)? So that this ressource can be
  called via the  following URLs:

  (1) /user/me.xml - XML-Response
  (2) /user/me.json - JSON-Response
  (3) /user/me - XML-Response

  Actually, a 404 is raised by symfony if the ressource is called via
  (3).

  Thanks for your help in advance,
  Daniel
--~--~-~--~~~---~--~~
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: Routing-Rules: use sf_format only as an optional value

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

No you don't, here's the difference :)

Yours: params:   { module: user, action: getUserMe }
Jobeet: param:   { module: category, action: show, sf_format: html }

On Tue, May 26, 2009 at 12:32, halla dha.maili...@googlemail.com wrote:

 Yes, thats exactly the same way like I do it also :-) Except the
 sfPropelRoute.
 But, like I wrote: This raises a 404 if the URL is called without
 suffix :-((

 On 26 Mai, 12:19, Gábor Fási maerl...@gmail.com wrote:
 This is how it's done in jobeet, day 15:

 // apps/frontend/config/routing.yml
 category:
   url:     /category/:slug.:sf_format
   class:   sfPropelRoute
   param:   { module: category, action: show, sf_format: html }
   options: { model: JobeetCategory, type: object }
   requirements:
     sf_format: (?:html|atom)

 On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

  Hi everybody,

  I'm using different routes for my application, which also determine
  the response format (xml or json for an REST-based web service).

  This is an example rule in routing.yml:

  user_me:
   url:                  /user/me.:sf_format
   params:               { module: user, action: getUserMe }
   requirements: { sf_method: GET, sf_format: (?:xml|json) }

  Is there a way to set sf_format to XML if NO .xml|json is given in the
  URL (the Suffix should be optional)? So that this ressource can be
  called via the  following URLs:

  (1) /user/me.xml - XML-Response
  (2) /user/me.json - JSON-Response
  (3) /user/me - XML-Response

  Actually, a 404 is raised by symfony if the ressource is called via
  (3).

  Thanks for your help in advance,
  Daniel
 


--~--~-~--~~~---~--~~
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: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread halla

 No you don't, here's the difference :)

 Yours: params:               { module: user, action: getUserMe }
 Jobeet: param:   { module: category, action: show, sf_format: html }

Sometimes small things can make a big difference :-)

You're right - now it works great...!!
Thank you very much, Gábor :-)
--~--~-~--~~~---~--~~
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] Task generate-admin is not defined.

2009-05-26 Thread Vikaash

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] Re: The route x does not exist

2009-05-26 Thread Giselle Cantador
Humm... I got it...
I'm using synfony 1.0  :-(
But I'll verify my links, thanks a lot!

Giselle
On Mon, May 25, 2009 at 6:17 PM, Frank Stelzer d...@bleedingmoon.de wrote:


 This happens after the latest routing changes, i think. I still have
 to fight against those changes for myself, too :P

 Example:

 = sf 1.1(?)
 link_to( 'Some cool news', 'news' );
 -- would have generate a link to: news/index or only news


 sf 1.2
 link_to( 'Some cool news', 'news' );// same like link_to( 'Some cool
 news', '@news' );/
 -- This assumes, that you want to call the news route and the routing
 searches for it and throws your mentioned error.

 fix: link_to( 'Some cool news', 'news/index' );
 This would generate the link like in the first example.

 Frank



 Am 25.05.2009 um 21:43 schrieb gisellec:

 
  I've got this error in apache error log file:
 
  apache_www_error: [Fri May 22 12:26:19 2009] [error] [client
  --- The route news does not exist.
 
  Well this is true because I really don't have this route in my routing
  files. I have a module called news, so I don't understand how this
  error happens.
 
  The biggest problem is that it just happened once. I can't reproduce.
  But I still have to justify this error...
 
  Any suggestion?
 
  


 



-- 
*~*~*~*~*~*~*~*~*~*~*~*~*~
Giselle Cantador
Software Engineer
CiT - CMMI 5 and Beyond
*~*~*~*~*~*~*~*~*~*~*~*~*~

Esta mensagem, incluindo seus anexos, contém informações legais
privilegiadas e/ou confidenciais, não podendo ser retransmitida, arquivada,
divulgada ou copiada sem autorização do remetente. Caso tenha recebido esta
mensagem por engano, por favor informe o remetente respondendo imediatamente
a este e-mail, e em seguida apague-a do seu computador.

The information contained in this email message, including any attachment,
is privileged and/or confidential. This message may not be retransmitted,
archived, disclosed or copied without sender’s approval. If you have
received this email in error, please notify the sender by replying to this
message, and then delete it from your system.

--~--~-~--~~~---~--~~
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: Task generate-admin is not defined.

2009-05-26 Thread DEEPAK BHATIA

Hi,

Symfony 1.1 has the following

Initiating an Administration Module
With symfony, you build an administration on a per-module basis. A
module is generated based on a Propel object using the
propel:init-admin task:

 php symfony propel:init-admin backend article Article

Thanks

Deepak

On Tue, May 26, 2009 at 4:39 PM, 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] Re: ExtJs JSON response

2009-05-26 Thread Tonio

Hi,

There are pretty useful ff extension to view JSON response:

https://addons.mozilla.org/en-US/firefox/addon/10869

Tonio

https://addons.mozilla.org/en-US/firefox/addon/10869

On May 25, 3:20 pm, Lee Bolding l...@leesbian.net wrote:
 This is the correct solution.

 Your browser attempts to download the response as a file because it  
 doesn't know what to do with the mime type application/json

 If you set the headers to text/html for testing purposes you'll see  
 the response as plain text in your browser

 On 25 May 2009, at 06:00, Leon van der Ree wrote:



  My guess is your content-type.

  Try keeping it text/html instead of application/json

  On May 25, 10:21 am, santail nikolai.muh...@gmail.com wrote:
  Action executes of file upload. If that helps to find a bug.
--~--~-~--~~~---~--~~
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] sfDoctrineGuard: Problem with an Equal Nest Relation in the Admin-Backend

2009-05-26 Thread halla

Hi everybody,

I'm using the sfDoctrineGuardPlugin, for which I added an Equal Nest
Relation [1] in the sfGuardUser-Table Definition:

# this is added to the sfGuardUser-Table Definition
 relations:
Relationships:
  class: sfGuardUser
  local: user1
  foreign: user2
  refClass: Relationships
  equal: true

This is the Definition of the Relationships-Table:

Relationships:
  columns:
user1:  { type: integer(4), primary: true }
user2:  { type: integer(4), primary: true }
type:   { type: enum, length: 24, values: [friend,blocked] }

Looks quite right to me :-)

But now I've a problem with the Admin-Backend... When trying to create
or edit (list-View works fine) a User in the Backend, I'm receiving an
error-message:

SQLSTATE[42S22]: Column not found: 1054 Unknown column
'relationships.id' in 'field list'

Does anybody know what I can do to fix this?

Thank you in advance for any help

Daniel

==

[1]http://www.doctrine-project.org/documentation/manual/1_1/en/
defining-models#relationships:join-table-associations:self-referencing-
nest-relations:equal-nest-relations

(this is the default Admin-Generator generator.yml-File I'm currently
using)

generator:
  class: sfDoctrineGenerator
  param:
model_class:   sfGuardUser
theme: admin
non_verbose_templates: true
with_show: false
singular:  ~
plural:~
route_prefix:  sf_guard_user
with_doctrine_route: 1

config:
  fields:
password_again: { label: Password (again) }

  list:
title:   User list
display: [=username, created_at, updated_at, last_login]

  form:
class: sfGuardUserAdminForm
display:
  NONE:   [username, password,
password_again]
  Permissions and groups: [is_active, is_super_admin,
groups_list, permissions_list]

  edit:
title: Editing User %%username%%

  new:
title: New User
--~--~-~--~~~---~--~~
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: sfDoctrineGuardPlugin: automatically add new user to a group

2009-05-26 Thread Campezzi

Thanks Fabien, that's exactly what I wanted! I just didn't know
exactly which method to override. I'm still finding my way around
symfony ;)

Cheers!

Best Regards,
Campezzi


On May 26, 6:09 am, FlyLM [ML] flylm...@gmail.com wrote:
 2009/5/25 Campezzi campe...@gmail.com:



  Hi Fabien,

  Thanks for the answer. Since the group was supposed to be added
  automatically, I had the groups_list widget unset in my form. The
  function you pointed me to seems to take what was stored in that
  variable and link the values to the user being registered. I assume I
  can get this working by making the groups_list field a hidden one and
  setting the default value on the action or even on the form code
  itself - then the code line you pointed out would do ther rest.
  However, I'm unsure about how safe this is - couldn't an user
  deliberately change the value of my hidden groups_list field in an
  attempt to be added to another group, one with a different permission
  set?

 Hi Campezzi,

 I had a same behavior in my last project. When I create a new user,
 the group is automaticaly associated, there is no choice in the form.
 First, I had thought about used a hidden field for goup_list, but I
 didn't keep this idea. I have override the doSave method of my form.

 So, my doSave method looks like this :

 class backendSfGuardUserAdminForm extends BasesfGuardUserAdminForm
 {
   []

   /**
    * (non-PHPdoc)
    * @see 
 lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserForm#doSave()
    */
   protected function doSave($con = null)
   {
     $isNew = $this-isNew();

     if( $isNew )
     {
       $password = substr(md5(rand(10, 99)), 0, 8);
       $this-getObject()-setPassword($password);
     }

     parent::doSave($con);

     if( $isNew )
     {
       // Set the group, here customer
       $group = Doctrine::getTable('sfGuardGroup')-findOneByName('customer');

       $this-getObject()-link('groups', $group-getId());
     }
   }

   []

 }

 Fabien



  Best Regards,
  Campezzi

  On May 25, 12:53 pm, FlyLM [ML] flylm...@gmail.com wrote:
  Hi,

  If you have always sfDoctrineGuardPlugin installed, take a look at
  this file line 84 (savegroupsList method)

  /lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesGuardUserForm.class.php

  = $this-object-link('groups', array_values($link));

  Fabien

  2009/5/25 Campezzi campe...@gmail.com:

   Hi there!

   I'm getting started with sfDoctrineGuardPlugin and after doing a few
   tutorials, I started to implement it in one of my projects. I have
   created a registration form and embedded the Profile class form. So
   far, so good - whenever a new user registers, both the sfGuardUser and
   Profile objects get saved to the database and are correctly
   associated.

   Now, I have a users sfGuardGroup with a set of permissions (its id
   is 1), and I'd like to put all members who sign up via this
   registration form automatically in this group. My first idea was to
   override the save() method of the Profile model to do that:

   class Profile extends BaseProfile
   {
          public function save(Doctrine_Connection $conn = null)
          {
                  $ret = parent::save($conn);

                  $relation = new sfGuardUserGroup();
                  $relation-user_id = $this-sf_guard_user_id;
                  $relation-group_id = 1;
                  $relation-save();

                  return $ret;
          }
   }

   However, when I try to add a new user through the form I get a SQL
   error:

   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
   '5-1' for key 'PRIMARY'

   ... where 5 is the id of the newly created sfGuardUser and 1 is the id
   of the sfGuardGroup I'm trying to add the user to. Of course, I
   checked the database and there are no other sfGuardUserGroup objects
   with the 5-1 key combination, hence it's not a duplicate record thing.

   I tried searching around, but found nothing about this error other
   than a few complaints about the save() method not being called on
   objects saved through embedded forms. It seems that is the issue here
   - I'm trying to create a many-to-many relation, but the user is not
   yet saved to the database when I try saving the relation, so the
   database throws an error because I'm adding a reference to an object
   that does not exist. However, if that is really the problem, isn't it
   weird that my profile actually has its sf_guard_user_id property set?!

   So, the 64.5 million dollar question: how do I get this to act like I
   expect it to 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: Many sites using the same application

2009-05-26 Thread Guilherme Veras


I casually create centralized applications.
Put in the folder WEB systems available thus gain a high rate of reuse
of classes and specific functions.
In addition, clear framework to keep my updated.
But the architecture of symfony is perfect and allows you to make
extensions or even mix the two architectures.

On 22 abr, 16:48, Rafael Vieira rafael.vie...@malapronta.com.br
wrote:
 Nei and all,

 About this kind of architecture, what do you guys think its the best
 option:

 a) Create a centralized application, shared by many websites or
 b) Create many applications, one for each website (and all the sites
 are the same, with some css customization and different content)?

 What you guys think its the best choice? We know that both formats
 have its pros and cons but we're in doubt about wich way to take.

 Any ideas?

 Rafael Vieira

 On 15 abr, 19:03, Nei Rauni Santos nra...@gmail.com wrote:

  Hi guys,

  Anyone here already created a Symfony's project where the frontend
  application is shared by many websites??
  I would be happy if you could share this experience with me.

  I need to recreate an application like this and I'm thinking to do
  this in the following way:

  - I already has a table called cms.sites..

  table: cms.sites
  columns: id, name, url, css, js,  created_at, updated_at

  my frontend:

  - an application frontend
  - a module home

  I have a filter where it gets the url of request and consult the table
  sites to get info about it, like js, css

  my server:

 www.example1.com.br
  server: host.test.com
  document_root: /home/example1/site

 www.example2.com.br
  server: host.test.com
  document_root: /home/example2/site

 www.example3.com.br
  server: host.test.com
  document_root: /home/example3/site

  some details:

  - some directories like js, images and css have a symbolic link to the
  same centralized directory.
  - I have an other application called admin installed in another place
  where I use it to manage the database and to configure the frontends.

  Some doubts are:

  - How is the better way to structure the project?
  - Is it better to configure each domain with its own document_root or
  to point all domains to the same document_root? some domains has more
  traffic than others. So, I need that to work fine because if one fail
  all them will also fail.

  Regards,

  NeiRauniSantoshttp://blog.inuar.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] Forms and post validators

2009-05-26 Thread Salim

Hi everybody

I'd like to know if it's possible to determine if a form has errors
when processing post validation.
The purpose is to have a conditional postValidator, which is launched
only if the classical validations passed.

Here is a small sample of what i'd like to have (http://pastie.org/
490290), but it doesn't work as the hasErrors() method always return
false.

Thank's in advance.
--~--~-~--~~~---~--~~
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 access the object of an embedded form

2009-05-26 Thread Tom Haskins-Vaughan

Perfect! Works like a charm. Looking forward to sf1.3 to get rid of the 
need for the work-around.

Tom Haskins-Vaughan wrote:
 Thanks, esion. I'll give it a go and let you know how I get on.
 
 esion wrote:
 Hi,

 First, I'm not sure that works  :

  ?php foreach($form as $cartItemForm): ?
  tr
td?php echo $cartItemForm['quantity']-renderLabel() ?/
 td
td?php echo $cartItemForm['quantity'] ?/td
td/td
  /tr
?php endforeach; ?

 It doesn't match with what you wrote in your form, what do you have in
 your action file?

 You should have in your view something like that :
 ?php foreach($form-getEmbeddedForms() as $cartItemForm): ?
  tr
td colspan=2?php echo $cartItemForm ?/td
   /tr
 ?php enforeach ?

 Second (this is a really special gift, I spend several weeks to find
 this tricks on the net, so I'm waiting for sf1.3 
 http://trac.symfony-project.org/ticket/5264)
 If you want to design your embedded forms you should use this code in
 the foreach :
 $nameFormat = $form-getWidgetSchema()-generateName($name) .
 '[%s]';
 $cartItemForm-getWidgetSchema()-setNameFormat($nameFormat);
 else the name used in fields will be the same, then the form can't
 work.

 Then you have now your array of sfForm, you can get the embedded forms
 of the embedded form.
 $cartItemForm-getEmbeddedForms()

 On May 21, 8:33 pm, Tom Haskins-Vaughan t...@templestreetmedia.com
 wrote:
 Hi,

 I have successfully embedded a form like so:

 class CartForm extends BaseCartForm
 {
public function configure()
{
  unset(
$this['id'],
$this['is_default'],
$this['buyer_id']
  );

  foreach($this-getObject()-getCartItems() as $cartItem)
  {
$this-embedForm(
  'cartitem_'.$cartItem-cart_id.'_'.$cartItem-harvest_id,
  new CartItemForm($cartItem)
);
  }
}

 }

 And I have managed to display it like so:

 form method=post action=?php echo url_for('@my_cart') ?
  tbody
?php foreach($form as $cartItemForm): ?
  tr
td?php echo $cartItemForm['quantity']-renderLabel() ?/td
td?php echo $cartItemForm['quantity'] ?/td
td/td
  /tr
?php endforeach; ?
  /tbody
/table
input type=submit value=Update cart /
 /form

 But I need to access some more information about each CartItem to
 display in the form, such as the Producer
 ($cartItem-Harvest-Producer). But in my example, it seems that
 $cartItemForm is not an sfForm but a sfFormField. So how do I access the
 Object of a form from a form field?

 Any help much appreciated.

 Thanks

 Tom

 
  
 

--~--~-~--~~~---~--~~
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: Database already exists and is populated

2009-05-26 Thread Atznt

Yes, All of you are truly right!!... Thank you!
--~--~-~--~~~---~--~~
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

2009-05-26 Thread nick

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] Re: Detecting required fields

2009-05-26 Thread Steve the Canuck

Thanks!

On May 21, 1:04 pm, gimler gordon.fra...@web.de wrote:
 http://blog.nevalon.de/en/wie-kann-ich-alle-formular-pflichtfelder-mi...

 greetings
 Gimler

 On May 21, 6:17 pm, Steve the Canuck steve.san...@gmail.com wrote:

  Hi,

  Is there an easy way to determine if a field isrequiredprior to
  rendering it?  I'd like to render it with an * beside the label tag if
  it isrequired.  I don't see a method like isRequired() built into the
  sfForm class, but I was wondering if anyone has a solution for this?

  If not, I will probably just create a helper to do this.

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