Re: [symfony-users] question about filter forms and multiple select widgets

2010-11-21 Thread Sebastien Armand [Pink]
I've got a blog post on how to use the form filters here:
http://sf.khepin.com/2010/10/symfony-filter-forms-and-related-tables/
in the part where I explain how to use filters from related tables, I
explain how to override the generation of the query part for a certain field
or relation in order to avoid that issue you're having.

If not enough, post again here so I'll detail.

On Thu, Nov 18, 2010 at 11:36 PM, Stan McFarland  wrote:

> Hi,
>
> I've successfully created a filter form for my frontend app, but want
> to allow the user to select multiple values for a given attribute.
> After changing the widget to allow multiple values,  I can select a
> single value from the select widget, and the SQL appears to be
> generated correctly:
>
> Before:   (r.status_id = ?) - (1)
> After:  (r.status_id in ?) - (1)
>
> but if I select multiple values I get an error "Invalid parameter
> number: number of bound variables does not match number of tokens."
> I'd cut and paste the error log except I'm behind a firewall with no
> way to cut and paste.   Is what I'm wanting to do possible?
>
> Thanks,
>
> Stan
>
> --
> 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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Gustavo Adrian
Ok. Then I'll keep using the standard way.

Thanks guys!

On Sun, Nov 21, 2010 at 7:36 PM, Tim Nagel  wrote:

> You still have to define each field in the form component that will be used
> to bind data to the object, there is no magic plumbing.
>
>
>
> t
>
>
> On Mon, Nov 22, 2010 at 09:30, Gustavo Adrian  > wrote:
>
>> I thought on separate the setting field by field from my first example to
>> another simple class, so I encapsulate that functionality. Setting the
>> fields by hand on the controller means a lot of code if I'm using an entity
>> with lots of fields and, if I change my schema, I'd have to change again the
>> code on the controller accordingly.
>>
>> I don't know how the bind functionality from the Form Component works but
>> I guess is what I'm trying to do here. I just want to do the binding without
>> the other Form stuff.
>>
>> Is that possible? if that's not an option, what would be the better way of
>> doing this?
>>
>>
>>
>> Thanks!
>>
>>
>> On Sun, Nov 21, 2010 at 5:17 PM, Bernhard Schussek 
>> wrote:
>>
>>> 2010/11/21 Gustavo Adrian :
>>> > I was thinking on delegating the data binding to a separated component
>>> just
>>> > for convenience to make possible this:
>>> >
>>> > $dataBinder = new DataBinder( $myObject, $validator );
>>> > $dataBinder->bind( $data );
>>>
>>> NO. This makes your data immensely vulnerable - how do you restrict
>>> $data to only contain certain keys?
>>>
>>> Bernhard
>>> --
>>> Software Architect & Engineer
>>> Blog: http://webmozarts.com
>>> Twitter: http://twitter.com/webmozart
>>>
>>> --
>>> 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
>

-- 
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: 06-Advanced-Forms Some Questions.

2010-11-21 Thread guiguiboy
Hi,

1/ What do you mean with "Advertisement" ?

2/ If you want to change the labels of the form, simply use the
setLabel() method in yout form class. Example :
$this->widgetSchema->setLabel(%NAME%, %LABEL%);

3/ Well, I believe the tutorial is enough well coded to allow you
change the number of pictures you wish to upload. Just change the
value of size in the option array.

$form = new ProductPhotoCollectionForm(null, array(
  'product' => $this->getObject(),
  'size'=> 2,
));

Guillaume B.

On 21 nov, 13:54, Guychmyrat Amanmyradov 
wrote:
> Hi,
> Firstly thanks for advanced forms. It really saved my times.
>
> I was following this link :
>
> http://www.symfony-project.org/more-with-symfony/1_4/en/06-Advanced-F...
>
> 1) I do not want to show "Advertisement" text (in tutorial current photos) on 
> new form. How can i hide it ?
>
> 2) How can i change "advertisement" and "newphoto" texts (labels) ?
>
> 3) How can i limit easily photos with 6. If user has uploaded 6 photos, i 
> want to stop image upload.
>
> Thank you.

-- 
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: Is a good idea to handle error 503 when the server is too hight?

2010-11-21 Thread guiguiboy
Hi,

you may find this useful :

503 Service Unavailable

The server is currently unable to handle the request due to a
temporary overloading or maintenance of the server. The implication is
that this is a temporary condition which will be alleviated after some
delay. If known, the length of the delay MAY be indicated in a Retry-
After header. If no Retry-After is given, the client SHOULD handle the
response as it would for a 500 response.

  Note: The existence of the 503 status code does not imply that a
  server must use it when becoming overloaded. Some servers may
wish
  to simply refuse the connection.

(found on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)

Cheers,

Guillaume


On 19 nov, 15:37, Nei Rauni Santos  wrote:
> Hi Guys,
>
> I have many symfony's websites in a single server and I'm thinking to add a
> filter to monitor the load average of the server and when it's too hight
> like 60.0 the symfony return 503 service unavailable.
>
> I have others monitoring to prevent this situation, but it's a plus on the
> application.
>
> Do you think it's a good idea? The best way to do that is on filters system?
>
> I hope to receive some ideas about that.
>
> Thank you,
>
> --
> Nei Rauni Santos
>
> http://www.linkedin.com/in/neiraunisantoshttp://www.facebook.com/nei.santoshttp://www.twitter.com/nraunihttp://blog.inuar.com
>
> Curitiba - Paraná
> +55 41 85020985

-- 
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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Tim Nagel
You still have to define each field in the form component that will be used
to bind data to the object, there is no magic plumbing.



t


On Mon, Nov 22, 2010 at 09:30, Gustavo Adrian
wrote:

> I thought on separate the setting field by field from my first example to
> another simple class, so I encapsulate that functionality. Setting the
> fields by hand on the controller means a lot of code if I'm using an entity
> with lots of fields and, if I change my schema, I'd have to change again the
> code on the controller accordingly.
>
> I don't know how the bind functionality from the Form Component works but I
> guess is what I'm trying to do here. I just want to do the binding without
> the other Form stuff.
>
> Is that possible? if that's not an option, what would be the better way of
> doing this?
>
>
>
> Thanks!
>
>
> On Sun, Nov 21, 2010 at 5:17 PM, Bernhard Schussek wrote:
>
>> 2010/11/21 Gustavo Adrian :
>> > I was thinking on delegating the data binding to a separated component
>> just
>> > for convenience to make possible this:
>> >
>> > $dataBinder = new DataBinder( $myObject, $validator );
>> > $dataBinder->bind( $data );
>>
>> NO. This makes your data immensely vulnerable - how do you restrict
>> $data to only contain certain keys?
>>
>> Bernhard
>> --
>> Software Architect & Engineer
>> Blog: http://webmozarts.com
>> Twitter: http://twitter.com/webmozart
>>
>> --
>> 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


Re: [symfony-users] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Gustavo Adrian
I thought on separate the setting field by field from my first example to
another simple class, so I encapsulate that functionality. Setting the
fields by hand on the controller means a lot of code if I'm using an entity
with lots of fields and, if I change my schema, I'd have to change again the
code on the controller accordingly.

I don't know how the bind functionality from the Form Component works but I
guess is what I'm trying to do here. I just want to do the binding without
the other Form stuff.

Is that possible? if that's not an option, what would be the better way of
doing this?



Thanks!

On Sun, Nov 21, 2010 at 5:17 PM, Bernhard Schussek wrote:

> 2010/11/21 Gustavo Adrian :
> > I was thinking on delegating the data binding to a separated component
> just
> > for convenience to make possible this:
> >
> > $dataBinder = new DataBinder( $myObject, $validator );
> > $dataBinder->bind( $data );
>
> NO. This makes your data immensely vulnerable - how do you restrict
> $data to only contain certain keys?
>
> Bernhard
> --
> Software Architect & Engineer
> Blog: http://webmozarts.com
> Twitter: http://twitter.com/webmozart
>
> --
> 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: Problem with doctrine:build-schema

2010-11-21 Thread jake barnes


On Nov 16, 6:45 am, Pratik Mazumder  wrote:
> No Alex, I don't have tabs. These are white spaces only !!!


Do you have the correct number of spaces? Have you checked your
indenting?





>
> On Tue, Nov 16, 2010 at 5:11 PM, Dominik Tuleweit wrote:
>
>
>
>
>
>
>
> > You have tabs for idention, take whitespaces instead:
>
> > all:
> >   doctrine:
> >     class: sfDoctrineDatabase
> >     param:
> >       dsn: 'mysql:host=localhost;dbname=CHCISDB'
> >       username: root
> >       password: null
>
> > Am 16.11.2010 um 12:37 schrieb Pratik Mazumder:
>
> > Hi Alexander
>
> > Changed the indentions but still doesn't work :(
>
> > Pratik
>
> > On Tue, Nov 16, 2010 at 4:57 PM, Alexandre Salomé <
> > alexandre.sal...@gmail.com> wrote:
>
> >> It's about indentation :
>
> >> all:
> >>    doctrine:
> >>      class: sfDoctrineDatabase
> >>      param:
> >>        dsn: 'mysql:host=localhost;dbname=CHCISDB'
> >>        username: root
> >>        password: null
>
> >> 2010/11/16 Pratik 
>
> >>>  Hi
>
> >>> I am new to symfony. I have a database created in mysql. While trying
> >>> to build the schema.yml by running php symfony doctrine:build-schema I
> >>> get the following error:
>
> >>> >>doctrine generating yaml schema from database
>
> >>>  Missing class name.
>
> >>> The content of the databases.yml is:
>
> >>> all:
> >>>    doctrine:
> >>>    class: sfDoctrineDatabase
> >>>    param:
> >>>      dsn: 'mysql:host=localhost;dbname=CHCISDB'
> >>>      username: root
> >>>      password: null
>
> >>> Can anybody please help?
>
> >>> Thanks
>
> >>> Pratik
>
> >>> --
> >>> 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 >>>  legroups.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 >>  legroups.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 > legroups.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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Bernhard Schussek
2010/11/21 Gustavo Adrian :
> I was thinking on delegating the data binding to a separated component just
> for convenience to make possible this:
>
> $dataBinder = new DataBinder( $myObject, $validator );
> $dataBinder->bind( $data );

NO. This makes your data immensely vulnerable - how do you restrict
$data to only contain certain keys?

Bernhard
--
Software Architect & Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart

-- 
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] [Symfony2] Twig

2010-11-21 Thread Fabien Potencier

On 11/21/10 8:22 PM, noel guilbert wrote:

You can get it through the _view variable:

{{ _view.request.getParameter('page') }}


Never use _view. It's not documented and can be removed any time.

Fabien


++
Noel

On Sun, Nov 21, 2010 at 7:58 PM, Francis Besset mailto:francis.bes...@free.fr>> wrote:

Hi all,

I am currently creating my project with Symfony2.
I started making templates with PHP but I want to migrate on Twig.

How can I access at the instance Request in the twig template?
With PHP there is $view['request'].


Thanks,
Francis.

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




--
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

--
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] [Symfony2] Twig

2010-11-21 Thread noel guilbert
You can get it through the _view variable:

{{ _view.request.getParameter('page') }}

++
Noel

On Sun, Nov 21, 2010 at 7:58 PM, Francis Besset wrote:

> Hi all,
>
> I am currently creating my project with Symfony2.
> I started making templates with PHP but I want to migrate on Twig.
>
> How can I access at the instance Request in the twig template?
> With PHP there is $view['request'].
>
>
> Thanks,
> Francis.
>
> --
> 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
>



-- 
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

-- 
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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Gustavo Adrian
Hi Bernhard,

I was thinking on delegating the data binding to a separated component just
for convenience to make possible this:

$dataBinder = new DataBinder( $myObject, $validator );
$dataBinder->bind( $data );

if ( $dataBinder->isValid() )
{
   // ...
}

I'd use the same interface of the Form component for convenience too. And
with a separated component I would able to inject some logic in the binding
process if I need to.


What do you think?


Thanks!


On Sun, Nov 21, 2010 at 4:18 PM, Bernhard Schussek wrote:

> Hi Gustavo,
>
> You did exactly the right thing. Just call the setters of your object
> (that's all that a Form does really). Why do you need any more
> abstraction?
>
> Bernhard
> --
> Software Architect & Engineer
> Blog: http://webmozarts.com
> Twitter: http://twitter.com/webmozart
>
> --
> 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] [Symfony2] Twig

2010-11-21 Thread Fabien Potencier

Pass the request as an argument to the template.

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

On 11/21/10 7:58 PM, Francis Besset wrote:

Hi all,

I am currently creating my project with Symfony2.
I started making templates with PHP but I want to migrate on Twig.

How can I access at the instance Request in the twig template?
With PHP there is $view['request'].


Thanks,
Francis.



--
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] [Symfony2] Twig

2010-11-21 Thread noel guilbert
Ok, thanks for the advice

On Sunday, November 21, 2010, Fabien Potencier
 wrote:
> On 11/21/10 8:22 PM, noel guilbert wrote:
>
> You can get it through the _view variable:
>
> {{ _view.request.getParameter('page') }}
>
>
> Never use _view. It's not documented and can be removed any time.
>
> Fabien
>
>
> ++
> Noel
>
> On Sun, Nov 21, 2010 at 7:58 PM, Francis Besset  > wrote:
>
>     Hi all,
>
>     I am currently creating my project with Symfony2.
>     I started making templates with PHP but I want to migrate on Twig.
>
>     How can I access at the instance Request in the twig template?
>     With PHP there is $view['request'].
>
>
>     Thanks,
>     Francis.
>
>     --
>     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
>
>
>
>
> --
> Noël GUILBERT
> http://www.noelguilbert.com/
> Twitter : http://twitter.com/noelguilbert
> http://www.sensiolabs.com
> http://www.symfony-project.com
> Sensio Labs
> Tél: +33 1 40 99 80 80
>
> --
> 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
>

-- 
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

-- 
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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Bernhard Schussek
Hi Gustavo,

You did exactly the right thing. Just call the setters of your object
(that's all that a Form does really). Why do you need any more
abstraction?

Bernhard
--
Software Architect & Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart

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

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


[symfony-users] [Symfony2] Twig

2010-11-21 Thread Francis Besset
Hi all,

I am currently creating my project with Symfony2.
I started making templates with PHP but I want to migrate on Twig.

How can I access at the instance Request in the twig template?
With PHP there is $view['request'].


Thanks,
Francis.

-- 
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] [Symfony 2] Binding object and data without a form?

2010-11-21 Thread Gustavo Adrian
Hi!

I'm developing an ExtJS app and I don't use the Form component because I
need to create the forms in JS. My question is if there's a way to bind the
data coming from the request to the object, without using the Form. What I'm
currently doing is something like:

$validator = $this->container->get( 'validator' );
$data = $this->container->get( 'request' )->request->get( 'myEntity' );

$myObject = new MyEntity();
$myObject->setName( $data[ 'name' ] );

// Set all remaining values..

$result = $validator->validate( $myObject );


For that reason I'm planning to develop a simple data binder component for
such cases but I was wondering if anyone has a better way of doing this that
I don't know about.



Thanks in advance.

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

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


[symfony-users] [Symfony2] Questions about forms and EntityToIDTransformer

2010-11-21 Thread noel guilbert
Hi,

I'm trying to implement a simple search form, and I want to store the search
criterias in session to get them back later. I have 2 fields:
- a textfied "title"
- a choicefield "category"

In session, I store an array of values, for instance array('category' => 2,
'title' => 'foo').

The main issue comes when I want to instanciate the form with the search
criterias, I have this exception: "Warning: spl_object_hash() expects
parameter 1 to be object, integer given". This error is thrown by the
EntityToIDTransformer class.

To fix that, I've to tranform the "category" values into a persisted entity,
using Doctrine to fetch the data:
$data['category'] = $em
->getRepository('BlogBundle:Category')
->find($data['category_id']);

And then, it works. Is there a better way, or is it the right way to do
that?

Thanks,

-- 
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

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

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


[symfony-users] [Symfony2] Security Component: how to authenticate a user manually?

2010-11-21 Thread noel guilbert
Hi,

I have a subscribe form, and I want to log my user in just after the
subscription. How should I do?

Thanks

-- 
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

-- 
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: Simfony2 Forms and entities - Best Practices

2010-11-21 Thread HTC
I would be happy to hear your suggestions :), in the meantime if
someone
is landing here looking for Forms and Doctrine entities I have found
this useful stuff on the documentation:

http://docs.symfony-reloaded.org/master/guides/doctrine/orm/form.html

It's not on the Form section but within the Doctrine section (for this
reason I didn't find it before). Maybe it's useful to add a link to
this
page on the Form overview page.

Bye
--
Alberto


On Nov 20, 11:45 am, HTC  wrote:
> I'm sorry, read replacing "Simfony2" with "Symfony2" :-P
>
> On Nov 20, 11:41 am, HTC  wrote:
>
>
>
> > Hi all,
> >  I didn't find anything clear on how to use Forms and entities in
> > Simfony2.
>
> > Currently I'm using Doctrine to persist entities but this could change
> > (for
> > example using another framework or whatever solution the customer want
> > to implement).
>
> > I have just started with Simfony2 and looking to the simple Forms
> > documentation
> > on the web site.
>
> > I have an entity MyProduct that is composed by some simple stuff
> > (date, strings,
> > numbers) and some reference to other application entities (like
> > ProductType and
> > ProductCategory).
>
> > It's a good idea to extend the Form class in order to create a
> > MyProductForm (that
> > I can reuse in multiple places like Ajax controllers and others view
> > instead to re-instatiante
> > a basic Form and configure it on the fly) that is able to deal with my
> > own entities
> > (like MyProductType and MyProductCategory).
>
> > It's a good idea implement MyProductTypeField and MyProductCategory
> > fields
> > in order to do check on database for validations and to customize the 
> > ->render() of
>
> > the form (that in entities reference case will have an hidden input
> > with the ID and
> > a title/name to show it to the user?).
>
> > Thanks in advance for your feedbacks.
>
> > Bye
> > --
> > Alberto

-- 
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] 06-Advanced-Forms Some Questions.

2010-11-21 Thread Guychmyrat Amanmyradov

Hi,
Firstly thanks for advanced forms. It really saved my times.

I was following this link : 

http://www.symfony-project.org/more-with-symfony/1_4/en/06-Advanced-Forms

1) I do not want to show "Advertisement" text (in tutorial current photos) on 
new form. How can i hide it ?

2) How can i change "advertisement" and "newphoto" texts (labels) ?

3) How can i limit easily photos with 6. If user has uploaded 6 photos, i want 
to stop image upload.


Thank you.

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