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

Rework form options, download handler options #700

Merged
merged 1 commit into from
May 24, 2017

Conversation

Koc
Copy link
Contributor

@Koc Koc commented Apr 16, 2017

Notable changes:

  • form theme is automatically registered now - no config changes required (DX, also needed for Added VichUploaderBundle recipe symfony/recipes-contrib#22 )
  • VichFileType: download_link deprecated with download_uri, which supports callable
  • VichFileType: download_label now supports true (use original file name), callable and instances of PropertyPath
  • VichFileType: unified translation_domain option usage
  • VichImageType: added option image_uri
  • VichImageType: added optional integration with LiipImagineBundle
  • download handler now supports true (use original file name) as served file name
  • fixed phpdocs for StorageInterface, UploaderHelper, DownloadHandler
  • reorganized test suite: validate docs separately from unit tests

@@ -1,4 +1,4 @@
VichFileType
VichFileType Field
============
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should adapt length here to match title length

@Koc Koc force-pushed the minior-fixes branch 6 times, most recently from 3acf823 to 762cbab Compare April 23, 2017 15:48
@Koc
Copy link
Contributor Author

Koc commented Apr 23, 2017

@garak are minior bc-breaks in form types template acceptable for 1.6.0?

@Koc
Copy link
Contributor Author

Koc commented Apr 25, 2017

Also I can add integration with LiipImagineBundle for ImageType, wdyt?

@garak
Copy link
Collaborator

garak commented Apr 26, 2017

Please elaborate about BC breaks and LiipImagineBundle

@Koc
Copy link
Contributor Author

Koc commented Apr 26, 2017

BC-break - I've removed show_download_link view variable from fields.twig.

Integration: we can add option like imagine_pattern for getting images resized via LiipImagineBundle for VichImageType form type.

@garak
Copy link
Collaborator

garak commented Apr 26, 2017

We should keep the variable, even if unused, to avoid breaking bad (I mean, causing errors). If the only break is a change if behaviour, it could be feasible.
The integration sounds good to me, as long as it's optional

@Koc Koc force-pushed the minior-fixes branch 6 times, most recently from 1b121e1 to e92845e Compare May 10, 2017 13:04
```php
use Vich\UploaderBundle\Form\Type\VichFileType;

$builder->add('genericFile', VichFileType::class, [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copy-paste error, need to be VichImageType

$resolver->setAllowedTypes('error_bubbling', 'bool');

$downloadUriNormalizer = function (Options $options, $downloadUri) {
if (isset($options['download_link'])) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

need comparation with null, isset not works as expected

Copy link
Collaborator

Choose a reason for hiding this comment

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

What if key is not set? Maybe an empty could be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It always set because of setDefault call

@Koc Koc force-pushed the minior-fixes branch 5 times, most recently from 6fdeabd to 41f97cf Compare May 23, 2017 10:05
@Koc Koc closed this May 23, 2017
@Koc Koc reopened this May 23, 2017
@Koc Koc closed this May 23, 2017
@Koc Koc reopened this May 23, 2017
@Koc Koc changed the title [WIP] Rework form options, download handler options Rework form options, download handler options May 24, 2017
@Koc
Copy link
Contributor Author

Koc commented May 24, 2017

@garak tests pass, all new cases are covered with tests, docs updated, please review and merge.

class VichFileType extends AbstractType
{
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason for removing phpdoc blocks here (and in the following properties/methods)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This blocks are duplication of real typehints in constructor so there is no any benefit from they IMHO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure that every IDE is smart enough to pass the type after assignment. Anyway, phpdoc block could be used for other than autocompletion in IDEs (e.g. for doc auto-generation).
Anyway, it would be better to keep consistency between files (so, since other files do use phpdoc blocks, this file should use it as well)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

restored

…ation for image form type. Fix phpdocs for interfaces
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.

4 participants