Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added $options field and get() set() methods for it #191

Merged
merged 9 commits into from Nov 20, 2012
Merged

added $options field and get() set() methods for it #191

merged 9 commits into from Nov 20, 2012

Conversation

redexp
Copy link

@redexp redexp commented Nov 8, 2012

with this changes we can simply set form type option

$comment = new Model\Comment();
$type = new Type\CommentType();
$type->set('csrf_protection', false);
$form = $this->createForm($type, $comment);

I just think, maybe it will be better to name methods setOption() and getOption() or it's good enough?

@willdurand
Copy link

Yes please, could you change the name of these two methods?

@redexp
Copy link
Author

redexp commented Nov 8, 2012

added getOptions()

@redexp
Copy link
Author

redexp commented Nov 9, 2012

One more feature, I added "name" option and rewrote getName() method to return it.
If you don't want to wrap params in user[%s] like

[POST] /users?name=max&age=24

instead of

[POST] /users?user[name]=max&user[age]=24

you can just set

$type->setOption('name', '');

or if you want process many forms with one request

$type1->setOption('name', 'user1');
$type2->setOption('name', 'user2');
[POST] /users?user1[name]=max&user2[name]=max

@redexp
Copy link
Author

redexp commented Nov 9, 2012

Last modification - added class Propel\PropelBundle\Model\Form\BaseAbstractType (maybe it should be not in Model folder Propel\PropelBundle\Form\BaseAbstractType ?) with two more methods setOptions() and mergeOptions(), also there __construct($mergeOptions) so you can create type like here

$type = new Type\UserType(array(
     'name'            => '',
     'csrf_protection' => false,
));

@redexp
Copy link
Author

redexp commented Nov 10, 2012

changed namespace from Propel\PropelBundle\Model\Form\BaseAbstractType to Propel\PropelBundle\Form\BaseAbstractType

willdurand added a commit that referenced this pull request Nov 20, 2012
added $options field and get() set() methods for it
@willdurand willdurand merged commit 1aae1fc into propelorm:1.1 Nov 20, 2012
@c33s
Copy link

c33s commented Nov 21, 2012

wow, that was a lot of rewriting. thanks for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants