Re: [symfony-users] Re: SF2 Beta2 - Date Field (3 Text Boxes instead of 1)

2011-05-24 Thread Bernhard Schussek
Try {{ form_field(form.myDate, { 'date_pattern': '{{ month }}/{{ year }}' }) }} Bernhard -- 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

Re: [symfony-users] [v2.0.0BETA1] Array data and validation with Forms

2011-05-18 Thread Bernhard Schussek
Hi Benjamin, You can use the collection constraint for this. use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\NotNull; $defaults = array('foo' => 'bar'); $form = $factory->create('form', $defaults, array( 'validation_cons

Re: [symfony-users] SF2 Forms - Cannot Store "0" in decimal field (0.0 works)

2011-05-18 Thread Bernhard Schussek
Hi Roger, Could you please create a ticket for this? https://github.com/symfony/symfony/issues Thanks, Bernhard -- 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 Group

Re: [symfony-users] [Symfony2] Form : check if it is a new record

2011-05-13 Thread Bernhard Schussek
2011/5/13 Christophe Willemsen : > What's the best way in the form type class to verify if it is a new > form or an update form ? You can't, you can only do so in listeners to the *SetData events. What are you trying to achieve? Bernhard -- If you want to report a vulnerability issue on symfony

Re: [symfony-users] Re: Symfony2 forms : can I show/hide fields

2011-05-05 Thread Bernhard Schussek
2011/5/5 Vincent Lechemin : > On Thu, May 5, 2011 at 9:41 AM, Manu wrote: >> How does Symfony2 handle inheritance ? > This also interests me, what's the best way to make a form with > inheritance having multiple possibilities for data_class? Do you mean for field guessing? Bernhard -- If you w

Re: [symfony-users] [Symfony2][Forms] Object value in Twig template

2011-05-05 Thread Bernhard Schussek
2011/5/5 Don Pinkster : > Awesome, thanks! Maybe possible to make a shortcut for this? Like: {{ > form.name.value }} No, this would break consistency. Better documentation should solve this problem. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security

Re: [symfony-users] [Symfony2 Forms] CollectionType - cannot display error messages with widget

2011-05-04 Thread Bernhard Schussek
Which errors are you talking about? Bernhard -- 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 symfon

Re: [symfony-users] ::buildForm() compatibility error with FormTypeInterface::buildForm()

2011-05-04 Thread Bernhard Schussek
You must have a typo somewhere. This is working for me. Bernhard -- 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,

Re: [symfony-users] Issues with Entity Fields in SF2 Form Component

2011-05-04 Thread Bernhard Schussek
Some of your questions were answered in the other thread already. As for completeness, you can decouple your type form EntityManager by using a closure in the "query_builder" option: 'class' => 'Entity:Cities', 'query_builder' => function (EntityRepository $repository) use ($state) {

Re: [symfony-users] Re: SF2 Forms -

2011-05-04 Thread Bernhard Schussek
Hi Roger, You should never rely on the form data in your type class (as you've just discovered). When the form is constructed, you can never be certain that the data is already available and won't be changed. In your case, I recommend to add an event listener to the preBind and preSetData events

Re: [symfony-users] Re: Comparison of fields in validation

2011-05-04 Thread Bernhard Schussek
Hi Daniel, If you could prepare a PR with such constraints, I'd be happy to merge it. I would prefer if the constraint had only a single option "properties" which is also the default option. In case of LessThan, each property in that array should be less than all properties after that. So in simp

Re: [symfony-users] [Symfony2][Forms] Object value in Twig template

2011-05-04 Thread Bernhard Schussek
Hi, Try form.vars.value. Bernhard -- 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@go

Re: [symfony-users] $form->getErrors() returns an empty array even $form->isValid() evaluates to false

2011-05-03 Thread Bernhard Schussek
Hi Ville, getErrors() only returns the errors of that specific Form instance, but not of any children. You can loop through the Form children and call getErrors() on them to receive their errors. Hope I helped, Bernhard -- If you want to report a vulnerability issue on symfony, please send it

Re: [symfony-users] attributes of form fields

2011-05-03 Thread Bernhard Schussek
Hi, You can pass custom attributes in the template: {{ form_widget(field, { 'attr': { 'class': 'foobar' } }) }} Cheers, Bernhard -- 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 t

Re: [symfony-users] FormComponent Question

2011-05-03 Thread Bernhard Schussek
Hi Geoff, Like with createBuilder(), you can pass the $product as second argument of create(): $form = $this->get('form.factory')->create(new ProductType(), $product); Could you fix the documentation in this regard? Thanks! Bernhard -- If you want to report a vulnerability issue on symfony,

Re: [symfony-users] New form system questions

2011-04-26 Thread Bernhard Schussek
2011/4/26 Vincent Lechemin : >> {% if form.field.errors|length > 0 %} > When I do that, I get "Method "errors" for object > "Symfony\Component\Form\FormView" does not exist." Oops, form.vars.errors, form.field.vars.errors etc. it has to be (like above). > I'm not using any object to populate the

Re: [symfony-users] New form system questions

2011-04-26 Thread Bernhard Schussek
2011/4/26 Gediminas Morkevicius : > And as we started about choice field, how to add @empty value into the > entity type choice list. > I need to be able to set the relation to NULL pointed. Set the 'required' option to false. Additionally you can overwrite the label of the empty value in the temp

Re: [symfony-users] New form system questions

2011-04-26 Thread Bernhard Schussek
Hi Vincent, 2011/4/26 Vincent Lechemin : > In twig, how can I test if a field has an error? {% if form.field.errors|length > 0 %} > Is there a replacement to the data option with choice field type? It > allowed to preset data. You have to set the correct data in your *object* which is used to p

Re: [symfony-users] Validation propagating to related entities in Symfony2

2011-04-17 Thread Bernhard Schussek
2011/4/17 Dennis Jacobfeuerborn : > I think the reference should be validated but not necessarily the whole > entity the reference points to. The reference would be validated anyway because the reference is a property of the main object. Bernhard -- If you want to report a vulnerability issue o

Re: [symfony-users] [Symfony2] validation of runtime generated object properties / dynamic forms

2011-04-17 Thread Bernhard Schussek
Hi Holger, You can use the Callback constraint for this purpose. You can see an example of its usage in DelegatingValidator::validateFormData(): https://github.com/symfony/symfony/blob/form/src/Symfony/Component/Form/Validator/DelegatingValidator.php What is necessary for this approach: - a commo

Re: [symfony-users] Validation propagating to related entities in Symfony2

2011-04-17 Thread Bernhard Schussek
Hi Matt, The problem is that by default the data of each field is validated. For the entity field this is the selected entity. Does it make sense to generally disable validation for entity fields? Bernhard Am 16.04.2011 21:38 schrieb "Matt Johnston" : I have two entities that are joined by a Ma

Re: [symfony-users] [Symfony2] [Form] Data object property is still updated, even after associated Field is removed.

2011-04-07 Thread Bernhard Schussek
Hi Donald, Can you verify whether this problem still occurs with the experimental Form branch: https://github.com/bschussek/symfony/tree/experimental Thanks, Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received thi

Re: [symfony-users] Symfony2 validation: file constraint and mime type

2011-04-01 Thread Bernhard Schussek
Hi Dmitry, What operating system do you use? Bernhard -- 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

Re: [symfony-users] Validation in Symfony

2011-03-30 Thread Bernhard Schussek
Hi Illya, 2011/3/30 Illya Klymov : > Another problem is binding some validation checks to corresponding form > fields. As far as i understand, getPropertyPath is used to retrieve data > from ConstraintViolations and to "bind" error to corresponding form field. I > have a method isClosureDateAfterL

Re: [symfony-users] [Symfony2] Forms/Doctrine empty string vs. NULL

2011-03-27 Thread Bernhard Schussek
Hi Dennis, The form framework normalizes empty values to null by default. Why would you allow empty strings but not null? Bernhard -- 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

Re: [symfony-users] Re: ChoiceField validation

2011-03-01 Thread Bernhard Schussek
2011/2/28 Brocco : > Did you have the time to look at it? I could confirm the erroneous behaviour, but the bug is not fixed yet. > Another question related to forms (I don't know if it's the right > place to ask): I can't find an easy way to get access to an uploaded > file from my request object

Re: [symfony-users] [Symfony 2]Validation on Form post: AssertsType like int, integer, decimal will always throw an error.

2011-03-01 Thread Bernhard Schussek
Hi Oscar, There is IntegerField for exactly that purpose. This field casts every input to an integer. I wouldn't recommend storing phone numbers as integers though. People may enter phone numbers with blanks in between which will result in a mess when converted. So instead I recommend to use a r

Re: [symfony-users] [Symfony 2] Custom "getter" validation method question

2011-02-28 Thread Bernhard Schussek
2011/2/28 Gustavo Adrian : > If I have the validation method named "isAddressValid", the resulting > property name is "addressValid". But in my case I'd it to be only "address" > so I can map the error to my form field. Is this possible? The answer is no. You'd have to do that mapping yourself. B

Re: [symfony-users] ChoiceField validation

2011-02-21 Thread Bernhard Schussek
-- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart 2011/2/21 Brocco : > The problem is that in the array returned by getValues(), the > validator doesn't look at the keys. What is the best way to make this > work? Should I create a new getValuesKey

Re: [symfony-users] No EntityToIDTransformer in PR6 ?

2011-02-18 Thread Bernhard Schussek
It was removed because its implementation was buggy/bad. You can copy the old implementation into your project and use it this way. A new version of it will come soon. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You rece

Re: [symfony-users] [Symfony2] DateField type error

2011-02-18 Thread Bernhard Schussek
Hi Lideln, The @Date constraint checks for date strings with format "-MM-DD". What you want is @AssertType("\DateTime"). Maybe we have a naming issue here. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received th

Re: [symfony-users] Re: Forms and validation

2011-02-16 Thread Bernhard Schussek
Oops, parentheses I mean. /** @validation:NotNull */ and /** @validation:NotNull() */ both are valid. Bernhard -- 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 Group

Re: [symfony-users] Re: Forms and validation

2011-02-15 Thread Bernhard Schussek
> Correct syntax for annotation-validators is to use parents in the end: > email(), NotBlank()... This is not true. You can leave away the parents just as well. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received t

Re: [symfony-users] [Symfony2] - Choicefield empty_value

2011-02-15 Thread Bernhard Schussek
Hi, This is intended behaviour. An empty value is only displayed if a field is not required. Through the "empty_value" option you can change the label of that empty value. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You

Re: [symfony-users] Re: [symfony2][PR6] - create form with setDataClass and multiple entities

2011-02-15 Thread Bernhard Schussek
> The validator returns "This value should not be blank" two times for > each field with @validation:NotBlank() if I submit the form empty > This behaviour occurs only with fields of the second entity > (translation). This is a known bug. Bernhard -- If you want to report a vulnerability issue

Re: [symfony-users] Re: - EntityChoicField

2011-02-15 Thread Bernhard Schussek
2011/2/14 Damon Jones : > Why not have a getFullname() accessor method in your user entity which > returns first and last name concatenated and use that property? This should work. If it doesn't, that's a bug. Bernhard -- If you want to report a vulnerability issue on symfony, please send it to

Re: [symfony-users] symfony2 RepeatedField

2011-02-15 Thread Bernhard Schussek
Hi Andras, Please don't cross post. I have answered your question in your previous thread already. Bernhard -- 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 "s

Re: [symfony-users] [S2PR6] Mapping a form for an entity

2011-02-09 Thread Bernhard Schussek
ned. > > > -- > Christophe > > > > Le 9 févr. 2011 à 12:47, Bernhard Schussek a écrit : > >> It already tells you the problem. BreveRequest need to be mapped. Try >> >> $ app/console doctrine:schema:info >> >> to find out whether the c

Re: [symfony-users] [S2PR6] Mapping a form for an entity

2011-02-09 Thread Bernhard Schussek
It already tells you the problem. BreveRequest need to be mapped. Try $ app/console doctrine:schema:info to find out whether the class is mapped. If it is not, consult the Doctrine documentation. Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/we

Re: [symfony-users] Re: Use compenents from symfony 2.0 in symfony 1.4

2011-02-09 Thread Bernhard Schussek
Not that I know, sorry. Maybe if you search on Google. 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 mess

Re: [symfony-users] [S2PR6] Mapping a form for an entity

2011-02-09 Thread Bernhard Schussek
Hi Christophe, In your configure() method, add the call $this->setDataClass('Name\Space\BreveRequest'); The namespace needs to be corrected, of course. Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart -- If you want to report a vu

Re: [symfony-users] Re: Use compenents from symfony 2.0 in symfony 1.4

2011-02-09 Thread Bernhard Schussek
Hi Soulfly, Yes, that should be possible if you use PHP 5.3. 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 th

Re: [symfony-users] [Symfony2] How to create Forms in PR6?

2011-02-08 Thread Bernhard Schussek
Strange. Could you try removing $this->getOptions() when creating the subforms? -- 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 t

Re: [symfony-users] [Symfony2] How to create Forms in PR6?

2011-02-08 Thread Bernhard Schussek
Hi Nikita, $form = UniversityRegistrationForm::create($this->get('form.context')); should be $form = UniversityRegistrationForm::create($this->get('form.context'), 'registration'); Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart -- I

Re: [symfony-users] [Symfony2] How to create Forms in PR6?

2011-02-08 Thread Bernhard Schussek
Ah you probably forgot to pass a name to Form::create(), right. This is fixed in trunk. Now an exception will be thrown when you bind an anonymous form. Sorry for the inconvenience. Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart -- If

Re: [symfony-users] [Symfony2] Instantiating a Form from within a template

2011-02-08 Thread Bernhard Schussek
Hi Dennis, Do you really need a Form instance for something as simple as a search form? 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-p

Re: [symfony-users] Re: The CSRF token is invalid

2011-02-08 Thread Bernhard Schussek
Could you please print the output of var_dump($form->getCsrfProvider())? In Symfony\Component\Form\CsrfProvider\DefaultCsrfProvider there is the line return sha1($this->secret.$pageId.$this->getSessionId()); within generateCsrfToken(). Please do also output the secret, page ID and session ID

Re: [symfony-users] [Symfony2] How to create Forms in PR6?

2011-02-07 Thread Bernhard Schussek
Hi Nikita, Yes, your field definitions go into configure(). If you want to group fields, just use a Form as well - FieldGroup doesn't exist anymore. There are two different ways to construct a form: 1) new Form(name, options) - this is for forms where you want to pass all options yourself 2) For

Re: [symfony-users] [Symfony2] The CSRF token is invalid

2011-02-07 Thread Bernhard Schussek
Can you show the code of your form and the template please? That sounds strange. 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.

Re: [symfony-users] Lost with Symfony2 forms

2011-02-06 Thread Bernhard Schussek
Hi Adrien, 2011/2/6 Adrien Mogenet : > What's the strategy here ? What should be the namespace of Form > classes and Domain Objects ? There's no best practice for this yet. It depends on how you organize your namespaces. If you organize them by your business domain (Contact, Sales, etc.) it makes

Re: [symfony-users] Re: (PR5) Int & Integer constraints

2011-01-28 Thread Bernhard Schussek
hen you would use asserttype integer > in a form then?  How would you make it pass as an integer if it is > automatically passing as '5'? > > Thanks in advance, > > ~Joseph Cooper > > On Jan 27, 11:17 pm, Bernhard Schussek wrote: >> Hi, >> >&

Re: [symfony-users] Please advise about Symfony2 Validation and Doctrine ODM/ORM

2011-01-28 Thread Bernhard Schussek
Hi Vladimir, Currently the validator is not integrated into Doctrine 2, so there is nothing to protect you from that. Sorry. You can make a feature request at doctrine-project.com and ask for Validator support. Cheers, Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter

Re: [symfony-users] Please advise about Symfony2 Validation and Doctrine ODM/ORM

2011-01-28 Thread Bernhard Schussek
Hi Vladimir, Why at all do you flush the entity/document when validation fails? 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.c

Re: [symfony-users] Re: Symfony 2 : Validate Doctrine ArrayCollection

2011-01-27 Thread Bernhard Schussek
Hi Donald, This is implemented now, although waiting to be pulled into Fabien's master. https://github.com/bschussek/symfony/commit/a2615de332480303a85b2499c4e40e33627787cf Traversable objects will be traversed by the @Valid constraint. Traversal can be disabled by setting the option "traverse" t

Re: [symfony-users] Re: Introducing Vespolina - the new sf2 based e-commerce platform

2011-01-27 Thread Bernhard Schussek
2011/1/28 Richard D Shank : > We have spent some time thinking about it, but I'm finding the more we think > about it, the more our ideas change :). I highly recommend analyzing other successful e-commerce projects (also in other programming languages). This can change your vision a lot to the bet

Re: [symfony-users] (PR5) Int & Integer constraints

2011-01-27 Thread Bernhard Schussek
Hi, First of all, please stop cross-posting the two lists. Second, this is intended behaviour. AssertType("integer") checks that the actual data type of the value is integer, so if you pass the string '5' this validation fails. Additionally, I recommend using @Max(9) in combination with

Re: [symfony-users] Symfony 2 : Any sort of automatic schema creation from models?

2011-01-25 Thread Bernhard Schussek
Yes. Execute ./app/console doctrine:schema:create respectively ./app/console doctrine:schema:update in the CLI. 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 i

Re: [symfony-users] Symfony 2 : Validate Doctrine ArrayCollection

2011-01-25 Thread Bernhard Schussek
2011/1/25 Donald : > I am trying to validate a collection using the @validation:Valid() > annotation, but it does not work with Doctrine 2's ArrayCollection > class. You are currently hitting a small case that's not supported yet, sorry. It'll be done :) Bernhard -- Software Architect & Engineer

Re: [symfony-users] Re: [Symfony 2] Custom validator is not called on validation

2011-01-20 Thread Bernhard Schussek
Could it be that the "namespace" definition of your Location class is wrong? -- 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 t

Re: [symfony-users] Re: [Symfony 2] Custom validator is not called on validation

2011-01-20 Thread Bernhard Schussek
2010/11/24 Ases : > From annotations works fine, but how I would have to call it from > validation.yml? > > #Application/MyBundle/Resources/config/validation.yml > Application\MyBundle\Entity\Anything: >  getters: >    address: >      - NotBlank: ~ >      - IpAddress: ~ BTW, you can now define nam

Re: [symfony-users] Re: Locale error when creating a form in Symfony 2

2011-01-08 Thread Bernhard Schussek
Do you have the intl extension installed? It's supposed to be shipped with PHP 5.3, but apparently it's not activated by default in some configurations. We're trying to decouple the Forms from intl, but that wasn't done yet. Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Tw

Re: [symfony-users] [Symfony 2] Questions about Forms and EntityManager

2010-12-29 Thread Bernhard Schussek
You can simply create a constructor that accepts the EntityManager as parameter, no? Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http://twitter.com/webmozart 2010/12/29 François : > Hi everyone, > > I'm in trouble with something in the example of the Form > do

Re: [symfony-users] [Symfony2] Adding non-model fields to a form and validating them

2010-12-15 Thread Bernhard Schussek
> it isn't).  This is trying with a basic NotBlank validation (but submitting > a blank value).  The subform is appearing as expected on the render, with > field names/IDs as expected. > > Thanks, > > Rich. > > On Wed, Dec 15, 2010 at 10:46 AM, Bernhard Schussek &g

Re: [symfony-users] [Symfony2] Adding non-model fields to a form and validating them

2010-12-15 Thread Bernhard Schussek
Hi Rich, You always need a domain model to process the data of the form. What you can do though is compose a form of different forms acting on different domain models. I.e. $form = new Form('base_form', $baseModel); $dispatcher->notify('...'); and in the event handler you can add a subform $be

Re: [symfony-users] [Symfony2] How to preselect ChoiceField?

2010-12-09 Thread Bernhard Schussek
Hi Dennis, Can you show me the generated HTML code for the choice field? Do you use Twig or PHP templating? Also, can you show me the output of both $form['rack']->getDisplayedData() and $server->rack? Thanks, Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com Twitter: http:/

Re: [symfony-users] [Symfony 2] Custom validator with a boolean option?

2010-11-26 Thread Bernhard Schussek
2010/11/26 Gustavo Adrian : > The Url constraint for instance. How could you make it optional? if you > don't enter any value on the field, it would complain because the only way > it returns true is if $value === null Ok, that's a bug. Can you file a ticket please? :) Bernhard -- Software Archit

Re: [symfony-users] [Symfony 2] Custom validator with a boolean option?

2010-11-26 Thread Bernhard Schussek
2010/11/26 Gustavo Adrian : > Thanks for clarify this point. But then there's a problem with this too. I > saw that validators check for null values like: > if ( $value === null ) > { > return true; > } > But they don't check for empty values. That's because many validators (f.i. Min) expect a

Re: [symfony-users] [Symfony 2] Custom validator with a boolean option?

2010-11-25 Thread Bernhard Schussek
2010/11/25 Gustavo Adrian : > The problem is if I just use @IpAddress on that field and I don't enter a > value, it will complain because is not a valid IP either. All validators except NotNull and NotBlank should treat NULL values (or empty values, in your case) as valid. Sorry, this is not docum

Re: [symfony-users] Re: [Symfony 2] Custom validator is not called on validation

2010-11-25 Thread Bernhard Schussek
> From annotations works fine, but how I would have to call it from > validation.yml? You currently have to provide the full namespace there. #Application/MyBundle/Resources/config/validation.yml Application\MyBundle\Entity\Anything: getters: address: - NotBlank: ~ - Aps\Namespace\P

Re: [symfony-users] [Symfony 2] Custom validator with a boolean option?

2010-11-25 Thread Bernhard Schussek
2010/11/24 Gustavo Adrian : > Hi everyone, > I've recently created a custom validator to validate IP. I have four fields > that need a mandatory IP, and one field in that the IP is optional. I'm not sure I understand the example. Can you put @NotBlank constraints on all fields, and additionally @I

Re: [symfony-users] [Symfony 2] Custom validator is not called on validation

2010-11-23 Thread Bernhard Schussek
Hi Gustavo, Sorry, the documentation is lacking in that part. You need to register your constraint namespace to use it with the validation driver. Add this to your config.yml validation: enabled: true annotations: namespaces: myvalidation: Applicati

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

2010-11-22 Thread Bernhard Schussek
2010/11/22 Gustavo Adrian : > Ok. Then I'll keep using the standard way. I really recommend this. BTW: If you ever need to dynamically inject or read data from object graphs, you can use the PropertyPath class. foreach (array('firstName', 'address.street', 'emails[0].address', ...) as $property)

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 res

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 vu

Re: [symfony-users] [Symfony2] some questions about forms

2010-11-11 Thread Bernhard Schussek
Hi Noel, > I have a User entity, and two forms: a subscribe form, and a "edit profile" > form. In the first one, I have two fields: the username, and the password. > In the second, username, password, first name and last name. > Actually, if I add the annotation "@validation:NotBlank" on the first

Re: [symfony-users] Does an input name necessarily match the database field name ?

2010-10-13 Thread Bernhard Schussek
Hi, Try to override the doUpdateObject() method in your form. It receives the values of the form as parameter and is responsible for saving them in $this->object (your record). protected function doUpdateObject($values) { parent::doUpdateObject($values); $this->object->from_city_name = $valu

Re: [symfony-users] [Symfony 2] Form, FileField and boundWithExtraFields error

2010-10-09 Thread Bernhard Schussek
Hi Gustavo, Can you show a snippet of your code so we can find out what might be wrong? Bernhard -- 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 user

Re: [symfony-users] SF2 : Add a property constraint to an object, who depends of another property of this object

2010-10-08 Thread Bernhard Schussek
Hi, Simply create a new custom method and annotate it with an AssertTrue validator: private function isValueBelowMaxLimit() { return $this->value < $this->maxLimit; } Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You r

Re: [symfony-users] Symfony2: ChoiceField() and Entities

2010-10-08 Thread Bernhard Schussek
Hi Dennis, I suppose $system->host is meant to contain a Doctrine proxy object? Bernhard -- 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

Re: [symfony-users] Re: Having a "web" layer for the "model"

2010-10-07 Thread Bernhard Schussek
I rather prefer to compose than to subclass here. class ProductView { public function __construct(Product $product) { $this->product = $product; } public function setSelected($selected)... public function getUrl()... etc. } Bernhard -- If you want to report a vulnerability is

Re: [symfony-users] Re: pagination template without repeat - like in Zend framework !!

2010-07-14 Thread Bernhard Schussek
Yes, you can do it like that. Bernhard -- 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-user

Re: [symfony-users] Re: symfony and Eclipse: I can not go to the function or class using F3.

2010-07-14 Thread Bernhard Schussek
Hi Javier, That's because the return type of getRoute() is defined as sfRoute[1], which doesn't have a getObject() method. Eclipse can't know that this method returns a sfObjectRoute in this specific case. Bernhard [1] http://trac.symfony-project.org/browser/branches/1.4/lib/action/sfAction.cla

Re: [symfony-users] pagination template without repeat - like in Zend framework !!

2010-07-14 Thread Bernhard Schussek
What about creating a _pagination.php partial with the shared code? Bernhard -- 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

Re: [symfony-users] Custom name for sfWidgetFormDate

2010-07-14 Thread Bernhard Schussek
Hi, Try $this->widgetSchema->setNameFormat('guest[%s]'); in the configure() method of your form.[1] Bernhard [1] http://www.symfony-project.org/forms/1_4/en/01-Form-Creation -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You re

Re: [symfony-users] Symfony2 : Load files under "Ressources/config" to the DI container

2010-07-11 Thread Bernhard Schussek
Hi, > i tried to load the ValidatorService, > add this to my config file, but it doesn't work, > web.config: >   validator: true This should be web.config: validation: true Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

Re: [symfony-users] csrf token required

2010-07-11 Thread Bernhard Schussek
Probably you forgot to render the hidden fields. Check the HTML source whether a hidden field with the name __csrf_token is present. If not, add the following in your template: renderHiddenField() ?> Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security

Re: [symfony-users] Symfony2 comments and questions

2010-07-11 Thread Bernhard Schussek
2010/7/11 Tarjei : > 8. Forms > One thing I see the form framework has addressed is grouping of > fields. What I still miss is simple widgets for adding html around a > set of elements or just at a point in the form. The purpose of the form framework is not to generate the HTML for the whole form,

Re: [symfony-users] form_tag_for + parameters for routing

2010-07-06 Thread Bernhard Schussek
Hi, If you want to use form_tag_for(), you should omit the '@' in the route name. Furthermore, the route is only a prefix - the actual routes must be named _create and _update, depending on whether the form creates/updates an object. Example: echo form_tag_for($form, 'user_doc', array('user_id' =

Re: [symfony-users] Re: Sending mail from a Form class.

2010-07-04 Thread Bernhard Schussek
I disagree that this is a good use case for the event dispatcher. The event dispatcher is good for providing hooks for additional, _optional_ functionality (like logging, profiling etc.) Sending a mail upon form submission is not optional. This has to happen. You want to be able to test that it ha

Re: [symfony-users] Re: Symfony2 validation in the sandbox

2010-07-04 Thread Bernhard Schussek
Hi, Unfortunately, the annotations driver doesn't work in the PR2. This is fixed in fabpot/symfony (http://github.com/fabpot/symfony). If you switch to that branch, you can enable the validator and the annotation driver with the following configuration: web.config: validation: enabled: tru

Re: [symfony-users] Symfony 2 - anything like grails?

2010-07-02 Thread Bernhard Schussek
Hi, As I am not familiar with Grails, could you explain what you would like to see in Symfony2? You can find both a quick tutorial for Symfony2 and more documentation on the new components on http://symfony-reloaded.org Bernhard -- If you want to report a vulnerability issue on symfony, please

Re: [symfony-users] Symfony2 validation in the sandbox

2010-06-30 Thread Bernhard Schussek
Hi, I just noticed that the documentation is not up to date. You need to enable the validator like this in config.yml: web.config: validation: true Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this messag

Re: [symfony-users] symfony 1.4 -> 2.0

2010-03-21 Thread Bernhard Schussek
The same question has already been posted on the developer ML: http://groups.google.com/group/symfony-devs/browse_thread/thread/667915859bc378e5 Bernhard -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message becau

Re: [symfony-users] Forms issue: Unknown "required" field

2010-03-03 Thread Bernhard Schussek
Print the error schema of the form which gives you more details about the required field: echo $form->getErrorSchema(); Bernhard -- 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

Re: [symfony-users] Nested set rendering

2010-02-01 Thread Bernhard Schussek
You could, for instance, write a recursive render helper: function render_nested_set(Doctrine_Collection $collection) { $output = "\n"; foreach ($collection as $record) { $output .= "".$record; // __toString(), or whatever you like if ($record->getNode()->hasChildren()) {

Re: [symfony-users] Re: sfForm > sfFormField without foreach

2010-01-27 Thread Bernhard Schussek
That's no problem the form framework can solve for you, it's a programmatic problem. You can either: 1. Output the fields manually echo $form['field'] 2. Add conditionals in the loop foreach ($form as $name => $field) { if (in_array($name, array('name', 'address'))) { ... } else if

Re: [symfony-users] Re: Complex conditional validation, symfony 1.3/4

2010-01-23 Thread Bernhard Schussek
Hi, I wouldn't even use a post validator in this case, but rather a pre validator with a callback validator: Example: class MyForm ... { public function configure() { ... $this->setPreValidator(new sfValidatorCallback(array( 'callback' => array($this, 'preValidate') )));

Re: [symfony-users] Re: Debugging forms ..

2010-01-06 Thread Bernhard Schussek
Just do print $form->getErrorSchema(); The error schema implements __toString(). Bernhard -- Software Architect & Engineer Blog: http://webmozarts.com -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfon

Re: [symfony-users] Parallel Testing Issues

2009-12-23 Thread Bernhard Schussek
Hi, >From my experience the best way to achieve this is to use in-memory databases (f.i. with SQLite). They are fast and are created seperately for every test process, so they don't interfere with each other. You also have to make sure that any other physical fixtures (f.i. files) are dealt with

Re: [symfony-users] Using extended class in functional tests

2009-11-30 Thread Bernhard Schussek
Did you check whether factories.yml is configured to use the correct user class in the test environment? Do you maybe have several myUser classes in your project and symfony is using the wrong one? Bernhard -- You received this message because you are subscribed to the Google Groups "symfony u

  1   2   3   >