Skip to content

[Form] Rename CollectionType options type and options #13820

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

Closed
wants to merge 74 commits into from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Mar 1, 2015

type and options are extremely generic. Prefixing them with entry_ makes it clear what they are configuring.

About the property deprecation it is the same story as #13717 and I don't know which direction you want me to go.

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #7831
License MIT
Doc PR symfony/symfony-docs#5051

@Tobion
Copy link
Contributor

Tobion commented Mar 1, 2015

How about item_* as name?

@merk
Copy link
Contributor

merk commented Mar 1, 2015

@hacfi
Copy link
Contributor

hacfi commented Mar 2, 2015

Why make it more "complicated"? I don’t see any reason to change it.

@wouterj
Copy link
Member Author

wouterj commented Mar 10, 2015

@hacfi the problem with the current options is that they are very easy to misunderstand. Especially when you're new to the Form component or when you're quickly scanning through the Form builder:

$formBuilder
    ->add('name', 'text', array('label' => '...'))
    ->add(...)
    ->add('friends', 'collection', array(
        'type' => new FriendType(),
        'options' => array(...)
    ))
;

Calling them entry_* will remove this confusion, as it's then clear that these are related to each entry and not the main collection field.

@Tobion I was also about to use item_*, but it seems like entry is already used in the Form component, so I decided to be consistent.

@hacfi
Copy link
Contributor

hacfi commented Mar 15, 2015

@wouterj Alright..fine with me then.

fabpot and others added 23 commits April 10, 2015 10:55
* 2.7:
  [HttpKernel] fixed a regression when no exception listeners are registered
  renamed some confusing tests
  propel/propel1 is now useless
  bumped Symfony version to 2.7.0
  updated VERSION for 2.7.0-BETA1
  updated CHANGELOG for 2.7.0-BETA1
  [2.3] Fix @link annotations
  [2.7] For @link annotations
  [2.6] Fix @link annotations
  [2.7][Console] Count the  array instead of
  [Config][cache factory] check type of callback argument.
  Fix javascript
  [2.3][Translation] test refresh cache when resources File change.
  Added deprecation message and original color back
  [Translator] Cache does not take fallback locales into consideration
…ort number option. (aitboudad)

This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle][Server Command] add address port number option.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

This allow running server without repeating `127.0.0.1` each time, in the most of case we only change the port number.

* Before
```
app/console server:start 127.0.0.1:8080
```

* After
```
app/console server:start -p 8080
```

Commits
-------

fbe1a43 [FrameworkBundle][Server Command] add address port number option.
This PR was merged into the 2.8 branch.

Discussion
----------

[Translation] added FileLoader.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Commits
-------

3694e5e [Translation] added FileLoader.
This PR was merged into the 2.8 branch.

Discussion
----------

[VarDumper] Added support for SplFileInfo

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Before:
```
SplFileInfo {#3}
```

After:
```
SplFileInfo {#3
  path: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures"
  filename: "grisou.jpg"
  basename: "grisou.jpg"
  pathname: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures/grisou.jpg"
  extension: "jpg"
  realPath: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures/grisou.jpg"
  aTime: 2015-04-20 23:21:15
  mTime: 2014-08-17 15:37:36
  cTime: 2015-04-20 23:09:51
  inode: 12197643
  size: 966553
  perms: 0100750
  owner: 1000
  group: 1000
  type: "file"
  writable: true
  readable: true
  executable: true
  file: true
  dir: false
  link: false
}
```

For a link:

```
SplFileInfo {#3
  path: ""
  filename: "link"
  basename: "link"
  pathname: "link"
  extension: ""
  realPath: "/home/greg/dev/github.com/symfony/var-dumper/composer.json"
  aTime: 2015-04-20 23:39:15
  mTime: 2015-04-20 23:39:15
  cTime: 2015-04-20 23:39:15
  inode: 11272232
  size: 967
  perms: 0100644
  owner: 1000
  group: 1000
  type: "link"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: true
  linkTarget: "composer.json"
}
```

For a remote file:

```
SplFileInfo {#3
  path: "http://google.com"
  filename: "foobar.php"
  basename: "foobar.php"
  pathname: "http://google.com/foobar.php"
  extension: "php"
  realPath: false
  writable: false
  readable: false
  executable: false
  file: false
  dir: false
  link: false
}
```

For a CSV:
```
SplFileObject {#3
  path: ""
  filename: "test.csv"
  basename: "test.csv"
  pathname: "test.csv"
  extension: "csv"
  realPath: "/home/greg/dev/github.com/symfony/var-dumper/test.csv"
  aTime: 2015-04-21 12:55:07
  mTime: 2015-04-21 12:55:07
  cTime: 2015-04-21 12:55:07
  inode: 11272237
  size: 0
  perms: 0100644
  owner: 1000
  group: 1000
  type: "file"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: false
  csvControl: array:2 [
    0 => ","
    1 => """
  ]
  flags: SKIP_EMPTY|READ_CSV
  maxLineLen: 0
  fstat: array:7 [
    "dev" => 64513
    "ino" => 11272237
    "nlink" => 1
    "rdev" => 0
    "blksize" => 4096
    "blocks" => 0
    "…" => "…20"
  ]
  eof: false
  key: 0
}

Commits
-------

e75c233 [VarDumper] Added support for SplFileObject
eb50b13 [VarDumper] Added support for SplFileInfo
…d if possible (lyrixx)

This PR was merged into the 2.8 branch.

Discussion
----------

[Console] Bind the closure (code) to the Command if possible

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

This allow this kind of code:

```php
#!/usr/bin/env php
<?php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

$application = new Application();

$application->add((new Command('process')))
    ->setDescription('Play all other commands')
    ->setCode(function (InputInterface $input, OutputInterface $output) use ($application) {
        $application = $this->getApplication();
        $help = $application->find('help');
        $output->writeln($help->getHelp());
    })
;
$application->run();
```

Commits
-------

ff4424a [Console] Bind the closure (code) to the Command if possible
…rays (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[VarDumper] Allow preserving a subset of cut arrays

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

208ca94 [VarDumper] Allow preserving a subset of cut arrays
* 2.7: (40 commits)
  [Debug] Fix ClassNotFoundFatalErrorHandler candidates lookups
  [2.6][Translator] Extend, refactor and simplify Translator tests.
  Update DebugClassLoader.php
  inject asset packages in assets helper service
  [travis] Do not exclude legacy tests on 2.7
  [HttpFoundation] remove getExtension method
  [2.6][Translation] fix legacy tests.
  [Form] Removed remaining deprecation notices in the test suite
  [Form] Moved deprecation notice triggers to file level
  [Debug] Map PHP errors to LogLevel::CRITICAL
  [Routing][DependencyInjection] Support .yaml extension in YAML loaders
  [DX] improve file loader error for router/other resources in bundle
  [FrameworkBundle] Initialize translator with the default locale.
  [FrameworkBundle] Fix Routing\DelegatingLoader resiliency to fatal errors
  [2.7][Translation] remove duplicate code for loading catalogue.
  [2.6][Translation] remove duplicate code for loading catalogue.
  [HttpKernel] Cleanup ExceptionListener
  CS fixes
  [DependencyInjection] Show better error when the Yaml component is not installed
  [2.3] SCA for Components - reference mismatches
  ...
* 2.7:
  [Debug] Fix deprecated use of DebugClassLoader
  Revert "[HttpKernel] Throw a LogicException when kernel.exception does not led to a Response"
  [Validator] Fixed Choice when an empty array is used in the "choices" option
* 2.7:
  [FrameworkBundle] Fix test related to PSR-4
…g output (nicolasdewez)

This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes symfony#14473).

Discussion
----------

[DX] Minor improvement for the translation:debug output

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#13874

Commits
-------

b941bd3 Changed output for translation:debug command
…g:translation command symfony#14237 (sgehrig)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes symfony#14320).

Discussion
----------

[Translation] added an --all option to the debug:translation command symfony#14237

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#14237
| License       | MIT
| Doc PR        | -

- [ ] submit changes to the documentation

This PR adds an `--all` option the `debug:translation` command to enable debugging translations in all registered bundles *AND* the app directory.

Commits
-------

0e7fe79 added the --all option to the debug:translation command
Tobion and others added 6 commits June 9, 2015 20:34
…er on a Response (jakzal)

This PR was merged into the 2.8 branch.

Discussion
----------

[HttpFoundation] Postpone setting the date header on a Response

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#14906
| License       | MIT
| Doc PR        | -

The only risk of doing this is if someone called `getDate()` and the date header was not present, the date might be slightly different than the one sent with the headers.

`getDate()` could also set the date header first time it's requested (do a lazy initialisation).

Commits
-------

2ad3b0d [HttpFoundation] Postpone setting the date header on a Response
* 2.7:
  Fix test name
  fixed CS
  Allow new lines in Messages translated with transchoice() (replacement for symfony#14867)
  [Form] Swap new ChoiceView constructor arguments to ease migrating from the deprecated one
  [2.3] Fix tests on Windows
  [Yaml] remove partial deprecation annotation
  Silence invasive deprecation warnings, opt-in for warnings
  Documenting how to keep option value BC - see symfony#14377

Conflicts:
	src/Symfony/Bridge/Doctrine/composer.json
	src/Symfony/Bridge/Twig/composer.json
…imler)

This PR was merged into the 2.8 branch.

Discussion
----------

fix Merge branch '2.7' into 2.8 JsonFileLoader

This fix a merge commit see symfony@5593bdd. The `stream_is_local` and `file_exists` checks are all ready done in the parent `FileLoader` class.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

Commits
-------

692deff fix Merge branch '2.7' into 2.8 JsonFileLoader
This PR was merged into the 2.8 branch.

Discussion
----------

[Profiler][Translation] added filter.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | ~
| Tests pass?   | yes
| License       | MIT

![selection_017](https://cloud.githubusercontent.com/assets/1753742/8159914/c2c8ad68-135a-11e5-9ae3-f2e055ea3230.jpg)

Commits
-------

65f9291 [Profiler][Translation] added filter.
@webmozart webmozart added the Form label Jun 16, 2015
jaytaph and others added 6 commits June 17, 2015 10:08
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes symfony#12067).

Discussion
----------

[Form] Added the 'range' FormType

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11979
| License       | MIT
| Doc PR        |

Implemented the "range" FormType.

Commits
-------

b52e197 [Form] Added the 'range' FormType
…n type (kgilden)

This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes symfony#12314).

Discussion
----------

[Form] Add "prototype_data" option to collection type

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#5095
| License       | MIT
| Doc PR        | symfony/symfony-docs#4367

Makes it possible to have default data for collection prototypes.

Commits
-------

80b0a80 [Form] Add "prototype_data" option to collection type
This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Deprecated "cascade_validation"

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | symfony#11268 (requires explicit work though)
| License       | MIT
| Doc PR        | TODO

This is symfony#12237 rebased on 2.8.

The "cascade_validation" option was designed for a 1% use case and comparatively used way too often when the `Valid` constraint should have been used instead. Also, there seem to be bugs with that option (symfony#5204).

The option is now deprecated. When using the 2.5 Validator API, you can set the "constraints" option of the respective child to a `Valid` constraint instead. Alternatively, set the constraint in the model (as most people hopefully do).

Commits
-------

6c554c6 [Form] Deprecated "cascade_validation"
@@ -25,11 +25,15 @@ class ResizeFormListener implements EventSubscriberInterface
{
/**
* @var string
*
* @deprecated since version 2.7, will be replaced by a $entryType private property in 3.0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should rename the properties. Otherwise you'd have to add the new properties already and show deprecation notes when people use the old ones. I don't think the effort required to do this is worth it.

@webmozart
Copy link
Contributor

Thanks for working on this @wouterj! Looks good to me, apart from the issues I pointed out.

@webmozart webmozart changed the title Rename CollectionType options type and options [Form] Rename CollectionType options type and options Jun 18, 2015
BruceWouaigne and others added 3 commits June 18, 2015 16:15
… on preSubmit to ResizeFormListener (BruceWouaigne)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes symfony#13851).

Discussion
----------

[Form] [EventListener] fixed sending non array data on preSubmit to ResizeFormListener

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#13804
| License       | MIT
| Doc PR        |  -

Commits
-------

74d794b [Form] [EventListener] fixed sending non array data on submit to ResizeListener
@wouterj
Copy link
Member Author

wouterj commented Jun 18, 2015

Closing as rebased against 2.8

@wouterj wouterj closed this Jun 18, 2015
@wouterj wouterj deleted the issue_7831 branch June 18, 2015 15:00
@wouterj wouterj restored the issue_7831 branch June 18, 2015 15:01
fabpot added a commit that referenced this pull request Oct 11, 2015
… (WouterJ)

This PR was merged into the 2.8 branch.

Discussion
----------

[2.8] [Form] Rename CollectionType options for entries

Description
---

Replaces #13820 for the 2.8 branch.

Original description:

 > `type` and `options` are extremely generic. Prefixing them with `entry_` makes it clear what they are configuring.

 > About the property deprecation it is the same story as #13717 and I don't know which direction you want me to go.

I've tried to apply the comments in the previous PR, but got a bit lost in the normalizers/default closure stuff. I hope I did everything correctly, but please review :)

PR Info Table
---

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #7831
| License       | MIT
| Doc PR        | symfony/symfony-docs#5051

Commits
-------

942a237 Rename CollectionType options for entries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.