-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[ResourceBundle] Generic autocomplete form type for resources #3951
Conversation
tuka217
commented
Jan 22, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Fixed tickets | #3831 |
License | MIT |
Doc PR | - |
bd40f72
to
482eec3
Compare
d8b63a2
to
83f3518
Compare
47cdc95
to
f3b6c83
Compare
public function transform($value) | ||
{ | ||
if (null === $value) { | ||
return array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All array
s should be changed to [...]
;)
$this->getParent()->shouldReturn('entity'); | ||
} | ||
|
||
function it_has_a_name($metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
f3f41dd
to
6b0a9a8
Compare
* @Transform /^taxon with "([^"]+)" name/ | ||
* @Transform /^taxon (?:|to |should be )"([^"]+)"$/ | ||
* @Transform /^"([^"]+)" (?:|as a parent |parent )taxon$/ | ||
* @Transform /^(?:a|an) "([^"]+)"$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this transformer. I bet it could cause a weird bugs or blow up a whole app if another similar transformer would be placed somewhere else...
6b0a9a8
to
5a46332
Compare
[ResourceBundle] Rename EntityHiddenType to ResourceToHiddenIdentifierType, refactor this class [ResourceBundle] Remove ObjectToIdentifierServicePass [ResourceBundle] Add MetadataInterface to ReosuceToHiddentIdentifier and ResourceToIdentifier types [SettingBundle] Rename ObjectToIdentifierTransformer to ReosurceToIdentifierTransformer and ObjectSelectionToIdentifierCollectionTransformer to ResourceSelectionToIdentifierCollectionTransformer [CoreBundle] Change entity_to_identifier to sylius_resourceName_from_identifier [UserBundle] Add configuration for from_identifier type for group [VariationBundle] Add configuration for from_identifier type for variant [AddressingBundle] Add configuration for from_identifier type for country [ResourceBundle] Add IdentifierToResourceType and IdentifierToResourceTransformer [ResourceBundle] remove ObjectCollectionToIdentifiersTransformer [ResourceBundle] rebulid ResourceChoiceType [ResourceBundle] Rename EntityHiddenType to ResourceToHiddenIdentifierType, refactor this class [ResourceBundle] Remove ObjectToIdentifierServicePass [ResourceBundle] Add MetadataInterface to ResouceToHiddentIdentifier and ResourceToIdentifier types [CoreBundle] Change entity_to_identifier to sylius_resourceName_from_identifier [UserBundle] Add configuration for from_identifier type for group [VariationBundle] Add configuration for from_identifier type for variant [AddressingBundle] Add configuration for from_identifier type for country [ResourceBundle] Add IdentifierToResourceType and IdentifierToResourceTransformer [ResourceBundle] remove ObjectCollectionToIdentifiersTransformer [ResourceBundle] rebulid ResourceChoiceType [ResourceBundle] Add ResourceAutocompleteType, ResourceAutocompleteToIdentifierTransformer [WebBundle] Add scripts for select2 and custom function about change src attribute in html element
[TaxonomyBundle] Add method in TaxonRepository for get all taxons (only id and name) [Grid]Fix StringFilter
50fae96
to
9b1bce5
Compare
Remove old implementation of autocomplete select
9b1bce5
to
eca3c19
Compare
Great work Ania! Thank you! 🎆 👍 |
so when are |
ResourceToIdentifier is used when we need to select a resource from list, but the end data should be identifier: for example on promotions, where we need to select a taxon, but in db we want to serialize only its code, not whole object. ResourceFromIdentifier is used when we want to use a hidden field with taxon code in the frontend (for autocomplete), but need real object to be the end data. (mainTaxon select field on Product) |
thanks @pjedrzejewski |
@pjedrzejewski Isn't it a better idea to use the doctrine types for this and add it on // would something like this be acceptable? It is easy to understand and hides it from rendering in the front-end, so no 100.000 variant lookups.
$builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) {
$event->getForm()->add('variant', 'sylius_product_variant_choice');
}); |
[ResourceBundle] Generic autocomplete form type for resources
[ResourceBundle] Generic autocomplete form type for resources
[ResourceBundle] Generic autocomplete form type for resources
[ResourceBundle] Generic autocomplete form type for resources