[symfony-users] Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Fangzx
I play Symfony2 and Doctrine2 for two weeks, and I came from
Java(5years) and Python/Django(3years). My questions:
1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
that, for example, why not use pulic properties directly instead of
setter and getter in the entity class.
2. Symfony2 is more Java like than Django, all is class, I don't like
that, I think the function should be first class citizen.
3. Why every route want a name in Symfony2 ?

I switched to Lithium (li3) today, and hope Symfony2 can get something
useful from  Lithium .

Sorry for my bad English.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: mobile site strategy

2010-09-13 Thread popofr13
How do you manage the case which symfony actions are different between
mobile and not mobile website ?

Case Study : Home page

In the not mobile website, we could display 3 modules (each connected
to some data in database)
In the mobile, we could only display 1 module

Note: in this case, only the display is different, but we could
imagine that the data processing is different

Thanks.
Sébastien PORATI

On Sep 8, 8:06 pm, Gustavo Adrian  wrote:
> That's a nice tip that I didn't know. Thanks for mention it!
>
> On Wed, Sep 8, 2010 at 2:57 PM, Kevin  wrote:
> > I found also you can add .sf_format to a layout: layout.mobile.php to
> > automatically use that layout when sf_format is not html
>
> > (this was mentioned above my klemens_u)
>
> > On Sep 8, 1:48 pm, Gustavo Adrian  wrote:
> > > You could create a custom layout for mobile sites. Then, in the action:
>
> > > $this->setLayout( 'myMobileLayout' );
>
> > > You could create a custom "base" action that extends from sfActions,
> > where
> > > you check for the "sf_format" value for the request in the "preExecute"
> > > method. Then, based on that value, set the layout you need. Finally,
> > extend
> > > every action from this "base" action. For example:
>
> > > *class myBaseAction extends sfActions
> > > {
> > >     public function preExecute()
> > >     {
> > >         if ( $this->getRequest()->getParameter( 'sf_format' ) == 'mobile'
> > )
> > >         {
> > >             $this->setLayout( 'myMobileLayout' );
> > >         }
> > >     }}
>
> > > *
> > > Then in your action
>
> > > class myOwnAction extends myBaseAction
> > > {
> > >     public function preExecute()
> > >     {
> > >         parent::preExecute();
>
> > >         // More stuff
> > >     }
>
> > > }
>
> > > Regards.
>
> > > On Wed, Sep 8, 2010 at 2:26 PM, Kevin  wrote:
> > > > How do you get it to work for layouts?
>
> > > > On Sep 7, 8:40 am, Kevin  wrote:
> > > > > Thanks, this stuff is great.  Never thought of that.
>
> > > > > On Sep 7, 3:49 am, klemens_u  wrote:
>
> > > > > > Hi,
>
> > > > > > it's basically really just a question of view.
>
> > > > > > Here's an old blog post about creating an iphone view:
> > > >http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optim.
> > ..
> > > > > > Most of it is still valid and it works.
>
> > > > > > But there is one serious drawback: You have to provide amobile
> > > > > > template for each action.
> > > > > > That's why we created a tiny patch (for our "ullright" platform) to
> > > > > > provide a fallback to normal templates in case there is no
> > > > specialmobileone.
>
> > > > > > Here are the required parts:
>
> > > > > > Mobiledetection: This belongs into your project configuration:
> > > >http://trac.ullright.org/browser/trunk/plugins/ullCorePlugin/config/u.
> > ..
>
> > > > > > Symfony patch enabling fallback to html templates: (Patches
> > > > > > sfView.class.php)
> > > >http://trac.ullright.org/browser/trunk/plugins/ullCorePlugin/patch/sf.
> > ..
>
> > > > > > Finally provide amobiletemplate (or not):
> > > > > > Normaly you would put your template in
> > apps/frontend/modules/myModule/
> > > > > > templates/myActionSuccess.php
> > > > > > Now you can provide amobiletemplate by creating the following file:
> > > > > > apps/frontend/modules/myModule/templates/myActionSuccess.mobile.php
>
> > > > > > This also works for layouts, partials and components. Example:
> > apps/
> > > > > > frontend/modules/myModule/templates/_head.mobile.php
>
> > > > > > Have a nice day,
>
> > > > > > Klemens
>
> > > > > > On 6 Sep., 00:29, Alexandre Salomé 
> > wrote:
>
> > > > > > > It's just a question of view.
>
> > > > > > > You should create dedicated routes with a sf_format "mini"
>
> > > > > > > 2010/9/2 Dennis 
>
> > > > > > > > Rather than go the plugin route, why not use either a '.mobi'
> > tld,
> > > > or
> > > > > > > > '.movi' subdomain, and symlinnk any directories that you need
> > > > between
> > > > > > > > the two projects?
>
> > > > > > > > On Sep 1, 4:57 am, Benoit Montuelle <
> > benoit.montue...@gmail.com>
> > > > > > > > wrote:
> > > > > > > > > I've done it by adding specific layout, templates and
> > stylesheet
> > > > to the
> > > > > > > > existing app.
>
> > > > > > > > > You can trigger events in your project configuration upon
> > user
> > > > agent to
> > > > > > > > change templates and specific configuration.
>
> > > > > > > > > The strategy to use another app depends wether yourmobileapp
> > > > should
> > > > > > > > have the same functionnality as the 'classic' web app does, but
> > it
> > > > will be
> > > > > > > > easier if most code still shared.
>
> > > > > > > > > -Original Message-
> > > > > > > > > From: Kevin 
> > > > > > > > > Sent: mercredi 1 septembre 2010 12:51
> > > > > > > > > To: symfony users 
> > > > > > > > > Subject: [symfony-users]mobilesite strategy
>
> > > > > > > > > I am wondering what others have done to create amobilesite
> > for
> > > > their
> > > > > > > > > symfony

Re: [symfony-users] Re: Tabs in Auto-Generated Code

2010-09-13 Thread Felix E. Klee
On Sun, Sep 12, 2010 at 2:20 PM, Davide Borsatto  wrote:
> Which generated file are you referring to? It may be a Propel or
> Doctrine issue.

The tabs are indeed in the model files, auto generated by Propel 1.4.2.

Thanks for pointing me in the right direction. Now it would be nice if
Propel could be told to not insert tabs...

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: How to display/get the info-related to the main form on the embedded form?

2010-09-13 Thread rdcklinux

$alumnos_internos = $this->getObject()->getgetAlumnoInternos();
$alumno_interno = $alumnos_internos[0];

Debes hacer eso porque en schema.yml no definiste la relación como uno
a uno
basta que con sólo definas:

type: one
foreignType: one
y cambia el foreignAlias a AlumnoInterno

en las relaciones asociadas y vuelvas a generar doctrine.
con eso solamente tendrás que hacer esto:

$alumnos_interno = $this->getObject()->getAlumnoInterno();
$alumno_interno_form = new AlumnoInternoForm($alumno_interno);
$this->embedForm('alumno_interno',$alumno_interno_form);

ahora esas 3 lineas están resumidas en el método embedRelation()

$this->embedRelation('AlumnoInterno');

donde AlumnoInterno es el nombre del foreignAlias

espero que esto te ayude a refactorizar tu codigo y que quede mas
depurado.
este ejempo esta hecho con Doctrine. en propel hay un plugin para usar
embedRelation pero
por lo que he leido no funciona muy bien


On 10 sep, 15:51, Alejandro Gómez 
wrote:
> I don't know why but embedRelation('AlumnoInterno') did not work.
> Maybe the Propel version?
>
> Symfony throws me "Call to undefined method
> AlumnoForm::embedRelation."
>
> In the other hand, I used getAlumnoInternos() wich "Gets an array of
> AlumnoInterno objects which contain a foreign key that references this
> object.". Since every Alumno object has only one AlumnoInterno object
> I take the first element of getAlumnoInternos().
>
> The code is as follows:
>
> [code]
> public function configure() {
>         parent::configure();
>
>         /*code portion removed*/
>
>         $alumnos_internos = $this->getObject()-
>
> >getgetAlumnoInternos();
>
>         $alumno_interno = $alumnos_internos[0];
>
>         $alumno_interno_form = new AlumnoInternoForm($alumno_interno);
>
>         $this->embedForm('alumno_interno', $alumno_interno_form);
>
>         /*code portion removed*/}
>
> [/code]
>
> Well, It works. However I am not sure if It is the best approach, do
> you?
>
> Thank you.
>
> On Sep 10, 12:03 pm, jota  wrote:
>
> > Try this:
>
> > public function configure() {
> >                parent::configure();
>
> >                /*code portion removed*/
>
> >                $alumno_interno = $this->getObject()->AlumnoInterno(); //if
> > the object Alumno is new it gives you an empty AlumnoInterno object, else it
> > gives you the associated AlumnoInterno
>
> >                $alumno_interno_form = new
> > AlumnoInternoForm($alumno_interno);
>
> >                $this->embedForm('alumno_interno',
> > $alumno_interno_form);
>
> >                /*code portion removed*/
> >        }
>
> > another way is to use embedRelation('AlumnoInterno') so you don't have to
> > deal with the save and getting the relation object to construct the subform
>
> > Hope it works
>
> > saludos
>
> > 2010/9/10 Alejandro Gómez 
>
> > > Hi folks.
>
> > > The database has two tables: 'alumno' and 'alumno_interno'. The
> > > 'alumno' table contains general data about students: name, lastname,
> > > address, etc. The 'alumno_interno' table contains details about the
> > > student: grade, control number, etc.
>
> > > The relationship between tables is:
>
> > > alumno {id, /*more fields*/}
> > > alumno_interno {id, id_alumno, /*more fields*/}
>
> > > On Symfony I built the models and forms. In fact, AlumnoInternoForm is
> > > already embedded on AlumnoForm.
>
> > > [code]
>
> > > /* AlumnoForm.class.php */
>
> > >        public function configure() {
> > >                parent::configure();
>
> > >                /*code portion removed*/
>
> > >                $alumno_interno = new AlumnoInterno;
> > >                $alumno_interno->setAlumno($this->getObject());
>
> > >                $alumno_interno_form = new
> > > AlumnoInternoForm($alumno_interno);
>
> > >                $this->embedForm('alumno_interno',
> > > $alumno_interno_form);
>
> > >                /*code portion removed*/
> > >        }
>
> > > [/code]
>
> > > I'm able to save a new student and his or her details in 'alumno' and
> > > 'alumno_interno' respectively.
>
> > > The trouble is when I try to edit an 'alumno' object: the AlumnoForm
> > > renders well and shows the embedded form (AlumnoInternoForm). The
> > > student's data is retrieved from the 'alumno' table but not from the
> > > 'alumno_interno' table. So, the AlumnoForm is well populated but the
> > > AlumnoInteroForm isn't. It's populated with the defaults values.
>
> > > I think I need to override a AlumnoForm method, maybe
> > > updateDefaultsFromObject(). Well, I did. But It didn't work. :-(
>
> > > Basically, I need to retrieve the AlumnoInterno object related to the
> > > Alumno object from the main form -AlumnoForm-, put the AlumnoInterno
> > > object inside the AlumnoInternoForm and update the AlumnoInternoForm's
> > > values in order to show the data. :-D
>
> > > How to do that? Someone?
>
> > > Software:
> > >        Symfony: 1.4.6
> > >        PHP: 5.3.2
>
> > > Thank you.
>
> > > --
> > > If you want to report a vulnerability issue on sy

[symfony-users] sfValidatorDoctrineUnique

2010-09-13 Thread corneliusparkin
Hi

I have been struggling with this functionality for more than a week
now and really hope someone can help me.

In the doctrine/schema.yml file, I specify a column "code" to be
unique. i.e.
code:
  type: string(10)
  fixed: false
  unsigned: false
  primary: false
  default: ''
  notnull: true
  autoincrement: false
  unique: true

When generating a doctrine module i.e.
symfony doctrine:generate-module admn category_management Category

the following code is inserted into the BaseCategoryForm->setup
function "which according to my understanding is the correct way of
implelentingt the solution"

$this->validatorSchema->setPostValidator(
  new sfValidatorDoctrineUnique(array('model' => 'Category',
'column' => array('code')))
);

When I create a new category, it adds successful. Then, if I try to
create a new category with the same "code", it gives an error to state
the the category already exists "which is correct".
However, if I try update the category and keep the "code" the same, I
receive an error "An object with the same "code" already exist."

If someone can PLEASE help me resolve this problem, I will be most
thankful.

Regards
CAP

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] The module and action names are not present in the internal URI?

2010-09-13 Thread Felix E. Klee
In "Practical symfony" for Propel, it says:

  The /job/show/id/1 URL can be created from a template by using the
  following call to the url_for() helper:

url_for('job/show?id='.$job->getId())

  You can also use the route name by prefixing it by @:

url_for('@default?module=job&action=show&id='.$job->getId())

  Both calls are equivalent but the latter is much faster as the routing
  does not have to parse all routes to find the best match, and it is
  less tied to the implementation (the module and action names are not
  present in the internal URI).

Source: http://www.symfony-project.org/jobeet/1_4/Propel/en/05

I am confused. Why does it say "the module and action names are not
present in the internal URI"? After all, in the latter case, the
internal URI includes:

  module=job&action=show

Or is meant that the key-words "module" and "job" are not part of the
following code?

  'job/show?id='.$job->getId()

If the latter is the case, then - from the wording - I infer that
"@default[...]" is not an internal URI...

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sfValidatorDoctrineUnique

2010-09-13 Thread Daniel Lohse
You might have forgotten to output $form->renderHiddenFields(false); in your 
template? Please check that the ID of your object is there in your edit 
screen's HTML.

Cheers, Daniel

Sent from my iPhone4

On Sep 13, 2010, at 1:58 PM, corneliusparkin  wrote:

> Hi
> 
> I have been struggling with this functionality for more than a week
> now and really hope someone can help me.
> 
> In the doctrine/schema.yml file, I specify a column "code" to be
> unique. i.e.
> code:
>  type: string(10)
>  fixed: false
>  unsigned: false
>  primary: false
>  default: ''
>  notnull: true
>  autoincrement: false
>  unique: true
> 
> When generating a doctrine module i.e.
> symfony doctrine:generate-module admn category_management Category
> 
> the following code is inserted into the BaseCategoryForm->setup
> function "which according to my understanding is the correct way of
> implelentingt the solution"
> 
> $this->validatorSchema->setPostValidator(
>  new sfValidatorDoctrineUnique(array('model' => 'Category',
> 'column' => array('code')))
>);
> 
> When I create a new category, it adds successful. Then, if I try to
> create a new category with the same "code", it gives an error to state
> the the category already exists "which is correct".
> However, if I try update the category and keep the "code" the same, I
> receive an error "An object with the same "code" already exist."
> 
> If someone can PLEASE help me resolve this problem, I will be most
> thankful.
> 
> Regards
> CAP
> 
> -- 
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
> 
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] The module and action names are not present in the internal URI?

2010-09-13 Thread Alan Bem
@default route specify module and action names as parameters, thats why they
are present in that internal uri you paste

default:
  url:   /:module/:action/*

but in the end you can "hardcode" them in routing.yml

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] automated response

2010-09-13 Thread Saad Tazi | Twist Image
Merci de votre message.

Je suis présentement absent du bureau. Je serai de retour le 25 septembre. 
L'accès à mes courriels pourrait être limité durant cette période. 
En cas d’urgence, vous pouvez rejoindre notre équipe technique en envoyant un 
courriel à l’adresse suivante: supp...@twistimage.com.

Cordialement,

Saad Tazi

- - - - - - - - - - - - -

Thank you for your message.

I am currently out of the office and will return on September 25th. I will have 
limited access to my e-mail during this period. 
For urgent technical matters, please send an email to supp...@twistimage.com.

Best regards,

Saad Tazi | Senior Web Developer
Twist Image | www.twistimage.com
T - 514 987 9992 x.158
407, rue McGill, 2e étage, Montréal (Québec) H2Y 2G3

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] The module and action names are not present in the internal URI?

2010-09-13 Thread Alan Bem
...and ommit later on.

2010/9/13 Alan Bem 

> @default route specify module and action names as parameters, thats why
> they are present in that internal uri you paste
>
> default:
>   url:   /:module/:action/*
>
> but in the end you can "hardcode" them in routing.yml
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sfValidatorDoctrineUnique

2010-09-13 Thread Cornelius Parkin
Hi Daniel... Thank you so much!!

The problem was that I unset the id field in the form. I did not know that
it was supposed to be included in the form because it was present in the
URI. I hope this also helps someone else whom faces this problem...

Thanks again...

Regards
CAP

On Mon, Sep 13, 2010 at 2:57 PM, Daniel Lohse
wrote:

> You might have forgotten to output $form->renderHiddenFields(false); in
> your template? Please check that the ID of your object is there in your edit
> screen's HTML.
>
> Cheers, Daniel
>
> Sent from my iPhone4
>
> On Sep 13, 2010, at 1:58 PM, corneliusparkin 
> wrote:
>
> > Hi
> >
> > I have been struggling with this functionality for more than a week
> > now and really hope someone can help me.
> >
> > In the doctrine/schema.yml file, I specify a column "code" to be
> > unique. i.e.
> > code:
> >  type: string(10)
> >  fixed: false
> >  unsigned: false
> >  primary: false
> >  default: ''
> >  notnull: true
> >  autoincrement: false
> >  unique: true
> >
> > When generating a doctrine module i.e.
> > symfony doctrine:generate-module admn category_management Category
> >
> > the following code is inserted into the BaseCategoryForm->setup
> > function "which according to my understanding is the correct way of
> > implelentingt the solution"
> >
> > $this->validatorSchema->setPostValidator(
> >  new sfValidatorDoctrineUnique(array('model' => 'Category',
> > 'column' => array('code')))
> >);
> >
> > When I create a new category, it adds successful. Then, if I try to
> > create a new category with the same "code", it gives an error to state
> > the the category already exists "which is correct".
> > However, if I try update the category and keep the "code" the same, I
> > receive an error "An object with the same "code" already exist."
> >
> > If someone can PLEASE help me resolve this problem, I will be most
> > thankful.
> >
> > Regards
> > CAP
> >
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
> >
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/symfony-users?hl=en
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Warm Regards

C.A.Parkin

*~"When you innovate, you've got to be prepared for everyone telling you
you're nuts" - Larry Ellison~*

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Tabs in Auto-Generated Code

2010-09-13 Thread Massimiliano Arione
On 13 Set, 13:35, "Felix E. Klee"  wrote:
> On Sun, Sep 12, 2010 at 2:20 PM, Davide Borsatto  wrote:
> > Which generated file are you referring to? It may be a Propel or
> > Doctrine issue.
>
> The tabs are indeed in the model files, auto generated by Propel 1.4.2.
>
> Thanks for pointing me in the right direction. Now it would be nice if
> Propel could be told to not insert tabs...

Of course: just add "alternative_coding_standards" in your config/
propel.ini, in this row (near the end of file):

propel.behavior.default=
symfony,symfony_i18n,alternative_coding_standards

then rebuild

cheers
Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: Tabs in Auto-Generated Code

2010-09-13 Thread Felix E. Klee
Thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] The module and action names are not present in the internal URI?

2010-09-13 Thread Felix E. Klee
Shouldn't the documentation then read as follows?

  the module and action names may be omitted in the internal URI, if
  hardcoded in routing.yml

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Florian


On 12 sep, 16:23, Fangzx  wrote:
> I play Symfony2 and Doctrine2 for two weeks, and I came from
> Java(5years) and Python/Django(3years). My questions:
> 1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
> that, for example, why not use pulic properties directly instead of
> setter and getter in the entity class.

In doctrine2, your entites are Plain Old PHP Objects ( POPO ).
Hydration is done on mapped properties.
I don't think you need setters/getters ( or I am wrong ? ) , but it's
(IMHO) a good practice.


> 2. Symfony2 is more Java like than Django, all is class, I don't like
> that, I think the function should be first class citizen.

I think OO design gives OO flexibility to the application design.
It's truely a big advantage over sf1, for bundle overriding for
example:
http://groups.google.fr/group/symfony-users/browse_thread/thread/cb860c7dab7b74d6

> 3. Why every route want a name in Symfony2 ?

I Agree with that.

>
> I switched to Lithium (li3) today, and hope Symfony2 can get something
> useful from  Lithium .
>
> Sorry for my bad English.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Donald Tyler
I'm interested in trying Doctrine 2, but the setters / getters thing that
the OP mentions concerns me a little.

In my own ORM, I use the __set and __get methods to have a consistent access
method for properties on my entities. e.g.

class Entity {
  public function __set ($property, $value) {
$setter = 'set' . ucfirst($property);
if (!method_exists($this, $setter)) {
  throw new Exception ('Access of undefined property '
  . $this->getClass()->name . '::$' . $property);
}

$this->$setter($value);
  }

  public function __get ($property) {
$getter = 'get' . ucfirst($property);
if (!method_exists($this, $getter)) {
  throw new Exception ('Access of undefined property '
  . $this->getClass()->name . '::$' . $property);
}

return $this->$getter();
  }
}

// class with public property
class Book extends Entity {
  public $name;
}

// same class with completely private property
class Book extends Entity {
  protected $name;
}

// same class with read only property (allowing logic to occur at read if
necessary)
class Book extends Entity {
  protected $name;

  public function getName() {
return $this->name;
  }
}

// same class with full getter & setter (allowing logic to occur at read or
write if necessary)
class Book extends Entity {
  protected $name;

  public function getName() {
return $this->name;
  }

  public function setName($name) {
$this->name = $name;
  }
}



Does Doctrine 2 have this level of flexibility?



On Mon, Sep 13, 2010 at 8:28 AM, Florian wrote:

>
>
> On 12 sep, 16:23, Fangzx  wrote:
> > I play Symfony2 and Doctrine2 for two weeks, and I came from
> > Java(5years) and Python/Django(3years). My questions:
> > 1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
> > that, for example, why not use pulic properties directly instead of
> > setter and getter in the entity class.
>
> In doctrine2, your entites are Plain Old PHP Objects ( POPO ).
> Hydration is done on mapped properties.
> I don't think you need setters/getters ( or I am wrong ? ) , but it's
> (IMHO) a good practice.
>
>
> > 2. Symfony2 is more Java like than Django, all is class, I don't like
> > that, I think the function should be first class citizen.
>
> I think OO design gives OO flexibility to the application design.
> It's truely a big advantage over sf1, for bundle overriding for
> example:
>
> http://groups.google.fr/group/symfony-users/browse_thread/thread/cb860c7dab7b74d6
>
> > 3. Why every route want a name in Symfony2 ?
>
> I Agree with that.
>
> >
> > I switched to Lithium (li3) today, and hope Symfony2 can get something
> > useful from  Lithium .
> >
> > Sorry for my bad English.
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Alexandre Salomé
Have you read this :
http://propel.posterous.com/propel2-will-be-an-activerecord-implementatio ?

Doctrine2 ensure performances of DBAL and provides ORM tools. Propel2 would
be an Active Record implementation over this.

These solutions are in development, you cannot yet get a full-featured
bootstraped project yet. Some key features are missing : forms, admin-gen,
security, etc.

Must be the same for the model processing (from schema definition to full
featured objects).

2010/9/13 Donald Tyler 

> I'm interested in trying Doctrine 2, but the setters / getters thing that
> the OP mentions concerns me a little.
>
> In my own ORM, I use the __set and __get methods to have a consistent
> access method for properties on my entities. e.g.
>
> class Entity {
>   public function __set ($property, $value) {
> $setter = 'set' . ucfirst($property);
> if (!method_exists($this, $setter)) {
>   throw new Exception ('Access of undefined property '
>   . $this->getClass()->name . '::$' . $property);
> }
>
> $this->$setter($value);
>   }
>
>   public function __get ($property) {
> $getter = 'get' . ucfirst($property);
> if (!method_exists($this, $getter)) {
>   throw new Exception ('Access of undefined property '
>   . $this->getClass()->name . '::$' . $property);
> }
>
> return $this->$getter();
>   }
> }
>
> // class with public property
> class Book extends Entity {
>   public $name;
> }
>
> // same class with completely private property
> class Book extends Entity {
>   protected $name;
> }
>
> // same class with read only property (allowing logic to occur at read if
> necessary)
> class Book extends Entity {
>   protected $name;
>
>   public function getName() {
> return $this->name;
>   }
> }
>
> // same class with full getter & setter (allowing logic to occur at read or
> write if necessary)
> class Book extends Entity {
>   protected $name;
>
>   public function getName() {
> return $this->name;
>   }
>
>   public function setName($name) {
> $this->name = $name;
>   }
> }
>
>
>
> Does Doctrine 2 have this level of flexibility?
>
>
>
> On Mon, Sep 13, 2010 at 8:28 AM, Florian wrote:
>
>>
>>
>> On 12 sep, 16:23, Fangzx  wrote:
>> > I play Symfony2 and Doctrine2 for two weeks, and I came from
>> > Java(5years) and Python/Django(3years). My questions:
>> > 1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
>> > that, for example, why not use pulic properties directly instead of
>> > setter and getter in the entity class.
>>
>> In doctrine2, your entites are Plain Old PHP Objects ( POPO ).
>> Hydration is done on mapped properties.
>> I don't think you need setters/getters ( or I am wrong ? ) , but it's
>> (IMHO) a good practice.
>>
>>
>> > 2. Symfony2 is more Java like than Django, all is class, I don't like
>> > that, I think the function should be first class citizen.
>>
>> I think OO design gives OO flexibility to the application design.
>> It's truely a big advantage over sf1, for bundle overriding for
>> example:
>>
>> http://groups.google.fr/group/symfony-users/browse_thread/thread/cb860c7dab7b74d6
>>
>> > 3. Why every route want a name in Symfony2 ?
>>
>> I Agree with that.
>>
>> >
>> > I switched to Lithium (li3) today, and hope Symfony2 can get something
>> > useful from  Lithium .
>> >
>> > Sorry for my bad English.
>>
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Alexandre Salomé
http://alexandre-salome.fr

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Working with Symfony and Git (collaboration)

2010-09-13 Thread Grzegorz Śliwiński
It's not matter of git, but rather the matter of your development
strategy.
If your apps are supposed to work within one project, then one repo is
what you need, if these apps are in fact three different projects,
then second idea is right.

You can always have different branches for each developer, one branch
with all their work merged and one branch for only core changes (libs -
> model, installed plugins, general configuration for environments)

On 13 Wrz, 08:34, Darmen  wrote:
> Hello everyone,
>
> Suppose we have a Project with three applications — A, B and C. Our
> team: Jack, Susan and Martin. And one project leader — David. Each
> programmer is working on their own application:
>
> A - Jack
> B - Susan
> C - Martin
>
> So, there is a problem with source code management. How to effectively
> organize it with Git? I have several use-cases, but I'm not really
> sure if they are correct and effective. Here they are:
>
> 1) One repo for whole project.
> 2) Separates repositories for A, B and C apps (within their
> appropriate directories in "apps" folder).
>
> I really like second idea, but I'm not if it's really effective.
>
> What do you thing and how would you organize such things? Any help
> will be appreciated.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Tim Nagel
Doctrine2 does provide this flexibility, the only snag is that there
is a PHP limitation on public properties (When using Proxies for
partial loads, a public property will misbehave). Any mapped
properties must be protected or private.

http://www.doctrine-project.org/projects/orm/2.0/docs/reference/best-practices/en#don't-use-public-properties-on-entities

Tim


On Tue, Sep 14, 2010 at 00:42, Donald Tyler  wrote:
> I'm interested in trying Doctrine 2, but the setters / getters thing that
> the OP mentions concerns me a little.
> In my own ORM, I use the __set and __get methods to have a consistent access
> method for properties on my entities. e.g.
> class Entity {
>   public function __set ($property, $value) {
>     $setter = 'set' . ucfirst($property);
>     if (!method_exists($this, $setter)) {
>       throw new Exception ('Access of undefined property '
>           . $this->getClass()->name . '::$' . $property);
>     }
>     $this->$setter($value);
>   }
>   public function __get ($property) {
>     $getter = 'get' . ucfirst($property);
>     if (!method_exists($this, $getter)) {
>       throw new Exception ('Access of undefined property '
>           . $this->getClass()->name . '::$' . $property);
>     }
>     return $this->$getter();
>   }
> }
> // class with public property
> class Book extends Entity {
>   public $name;
> }
> // same class with completely private property
> class Book extends Entity {
>   protected $name;
> }
> // same class with read only property (allowing logic to occur at read if
> necessary)
> class Book extends Entity {
>   protected $name;
>   public function getName() {
>     return $this->name;
>   }
> }
> // same class with full getter & setter (allowing logic to occur at read or
> write if necessary)
> class Book extends Entity {
>   protected $name;
>   public function getName() {
>     return $this->name;
>   }
>   public function setName($name) {
>     $this->name = $name;
>   }
> }
>
>
> Does Doctrine 2 have this level of flexibility?
>
>
> On Mon, Sep 13, 2010 at 8:28 AM, Florian 
> wrote:
>>
>>
>> On 12 sep, 16:23, Fangzx  wrote:
>> > I play Symfony2 and Doctrine2 for two weeks, and I came from
>> > Java(5years) and Python/Django(3years). My questions:
>> > 1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
>> > that, for example, why not use pulic properties directly instead of
>> > setter and getter in the entity class.
>>
>> In doctrine2, your entites are Plain Old PHP Objects ( POPO ).
>> Hydration is done on mapped properties.
>> I don't think you need setters/getters ( or I am wrong ? ) , but it's
>> (IMHO) a good practice.
>>
>>
>> > 2. Symfony2 is more Java like than Django, all is class, I don't like
>> > that, I think the function should be first class citizen.
>>
>> I think OO design gives OO flexibility to the application design.
>> It's truely a big advantage over sf1, for bundle overriding for
>> example:
>>
>> http://groups.google.fr/group/symfony-users/browse_thread/thread/cb860c7dab7b74d6
>>
>> > 3. Why every route want a name in Symfony2 ?
>>
>> I Agree with that.
>>
>> >
>> > I switched to Lithium (li3) today, and hope Symfony2 can get something
>> > useful from  Lithium .
>> >
>> > Sorry for my bad English.
>>
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Symfony2 Sandbox database collation

2010-09-13 Thread Aleš
Thanks for the reply, but this is the configuration for Symfony1.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Are the design of Symfony2 and Doctrine2 in right direction?

2010-09-13 Thread Fabien Potencier

On 9/12/10 4:23 PM, Fangzx wrote:

I play Symfony2 and Doctrine2 for two weeks, and I came from
Java(5years) and Python/Django(3years). My questions:
1. Doctrine2  is so like Java Hibernate and is too heavy, I don't like
that, for example, why not use pulic properties directly instead of
setter and getter in the entity class.


This is not needed. You can just use public properties if you want.


2. Symfony2 is more Java like than Django, all is class, I don't like
that, I think the function should be first class citizen.


Just read the current discussion about implementing generic views as 
classes in Django.



3. Why every route want a name in Symfony2 ?

I switched to Lithium (li3) today, and hope Symfony2 can get something
useful from  Lithium .


Good luck!

Fabien


Sorry for my bad English.



--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] [sf2] Doctrine Schema

2010-09-13 Thread Craige
Hey guys,

I've been eagerly awaiting Symfony 2, but I see that the public site
now says it's not expected until March. Unfortunate, but no big deal.
I'd rather have the team do it right than do it fast.

Anyway, I've was planning (and still am planning) to program my new
project with Symfony 2. Given the recent change of events however,
I've decided to take this extra time to put towards Database/Model
structuring, as well as interface design and mockup;  I'm not one to
sit and twiddle my thumbs while I wait.

So, my question is as follows:

How does Symfony two handle Models between Applications. Ie, in
Symfony 1.4, all models were globally accessible by all applications
within a project.  Is this still the case with Symfony 2?

Also, where are the .yaml Schema files stored these days? I kind of
gathered that each application/bundle has it's own directory for them,
but what should I do with my global schema?

Thanks a lot, guys!  I figured this was a logical step to take given
the new time lapse.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: sfWidgetFormChoice and setDefault

2010-09-13 Thread Svetoslav Shterev
Glancing through the code, the default option(what setDefault() does
on a widget) doesn't seem to be used at all in the choice widgets.

At any rate, you should be using the form's "default" fields, instead
of the widget's.

$this->setDefault('priority', max(...));

The widget's default value(if used at all) should only be used if the
call to render() does not provide a value itself.

On Sep 10, 4:54 pm, torok84  wrote:
> I have this code in a doctrine form
>
>     $this->widgetSchema['priority'] = new sfWidgetFormChoice(
>         array(
>             'choices' => $pri_choices
>             ));
>     var_dump($pri_choices);
>     echo max(array_keys($pri_choices));
>     $this->widgetSchema['priority']-
>
> >setDefault( max(array_keys($pri_choices)) );
>
> the output is
> array
>   100 => string 'Problematica' (length=12)
>   200 => string 'Informazione' (length=12)
> 200
>
> I would expect to get the Informazione entry selected, while the HTML
> output is
>
> 
> Problematica
> Informazione
> 
>
> It seems a bug, or am I missing something?
>
> Thanks
> Paolo

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: How to display/get the info-related to the main form on the embedded form?

2010-09-13 Thread Svetoslav Shterev


On Sep 10, 10:51 pm, Alejandro Gómez
 wrote:
> I don't know why but embedRelation('AlumnoInterno') did not work.
> Maybe the Propel version?
>
> Symfony throws me "Call to undefined method
> AlumnoForm::embedRelation."
  Are you using Propel?
> In the other hand, I used getAlumnoInternos() wich "Gets an array of
> AlumnoInterno objects which contain a foreign key that references this
> object.". Since every Alumno object has only one AlumnoInterno object
> I take the first element of getAlumnoInternos().

  In Doctrine, you can set a relation to be one-to-one, thus
getAlumnoInterno() would give you one object, not an array. I don't
know if there's an equivalent in Propel. If there is one, that would
clean up the code a bit.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] [sf2] Doctrine Schema

2010-09-13 Thread Fabien Potencier
On 9/14/10 1:59 AM, Craige wrote:
> Hey guys,
> 
> I've been eagerly awaiting Symfony 2, but I see that the public site
> now says it's not expected until March. Unfortunate, but no big deal.
> I'd rather have the team do it right than do it fast.
> 
> Anyway, I've was planning (and still am planning) to program my new
> project with Symfony 2. Given the recent change of events however,
> I've decided to take this extra time to put towards Database/Model
> structuring, as well as interface design and mockup;  I'm not one to
> sit and twiddle my thumbs while I wait.
> 
> So, my question is as follows:
> 
> How does Symfony two handle Models between Applications. Ie, in
> Symfony 1.4, all models were globally accessible by all applications
> within a project.  Is this still the case with Symfony 2?

This document answers your question:

http://docs.symfony-reloaded.org/guides/symfony1.html

> Also, where are the .yaml Schema files stored these days? I kind of
> gathered that each application/bundle has it's own directory for them,
> but what should I do with my global schema?
> 
> Thanks a lot, guys!  I figured this was a logical step to take given
> the new time lapse.
> 

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en