hostnet / form-handler-bundle Goto Github PK
View Code? Open in Web Editor NEWProvide an easier way of handling forms in actions
License: MIT License
Provide an easier way of handling forms in actions
License: MIT License
I read this article https://ocramius.github.io/blog/fluent-interfaces-are-evil/, I agree that in most cases fluent interfaces are not good.
But configurator by nature is not supposed to return anything. So it can be either : void
or : self
. I think that fluent interface is more convenient as it gives you both usage possibilities.
@iltar , what do you think?
Currently we have to manually alias our services to the FQCN and interfaces to make autowiring possible.
Is it possible to get the current Form
-instance when I handle the post-processing in onSuccess
?
The reason I need the form is that I update a present entity using a DTO (which is defined as the data_class
-attribute of the form) and trigger the UniqueEntity
-validator.
The "app.handler.legacy.named" service is private, getting it from the container is
deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service
public, or stop using the container directly and use dependency injection instead
Using the KERNEL_DIR environment variable or the automatic guessing based on
the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the
KERNEL_CLASS environment variable to the fully-qualified class name of your
Kernel instead. Not setting the KERNEL_CLASS environment variable will throw
an exception on 4.0 unless you override the :createKernel() or :getKernelClass()
method
See https://travis-ci.org/hostnet/form-handler-bundle/jobs/264685602
Hi,
I'm in the process of upgrading my application to symfony 3.4 In the symfony standard installation, they use version 5.0.0 of the Sensio Framework Bundle.
The Form Handler bundle has a dependency of version 3.*
Would it be compatible with version 5.0 or are there changes needed?
Thank you!
In hostnet/form-handler-component#21 we have added the ability to create a custom submit processor to make manual submits possible, as requested by #39. This feature should still get some documentation.
Explained on: https://github.com/hostnet/form-handler-bundle/wiki/Using-the-onSuccess-and-onFailure
This information should probably be added to HandlerConfigInterface::onSuccess
and HandlerConfigInterface::onFailure
. Additionally we could add this to HandlerConfigInterface::setOptions
. HandlerConfigInterface::setFormSubmitProcessor
already has this information.
Currently we don't are not testing it on the master.
https://travis-ci.org/hostnet/form-handler-bundle/builds/226728473
See #33. The full signature of the onSuccess
& onFailure
methods is missing from the doc.
Service definitions, aliases and classes should be marked deprecated for the 2.0.0 release.
Also needs to be done for: https://github.com/hostnet/form-handler-component
The handlers are stateful, that's because it contains setters and the data object is integrated inside. There's no real way to prevent this without losing information about types. While the form handlers are services, you never use them like this as they get passed along with the action arguments.
Due to their stateful nature, I'd like to have the collector compiler pass add the shared option as false to all handlers during container compilation. It might be a slight behavioural change, but I consider this a bug because it gives unexpected results if the handlers are shared.
Would there be any implications when adding this option?
Currently the functional tests are a bit messy and contain a lot of duplication. Suggestion is to omit the phpunit.xml.dist constant for the kernel and simply use the getKernelClass
. Running the tests at the moment, requires you to remove the var dir after certain changes, which is quite cumbersome. Additionally, we can use options to pass along which config file to load.
As @xabbuh mentioned in #30 (comment), listeners and such would be automatically registered using the simple-phpunit
script provided by the symfony/phpunit-bridge
package that we use. Right now we are depending on this in our dev dependencies "phpunit/phpunit": "^4.7|^5.0",
. I think it's a viable alternative to check if we can use the bridge for this.
Hi guys,
I have a POST API endpoint. When I send request to this URL using POSTMAN
$handler->handle($request, $cardData)
function returns null as a result of form not being submitted. Without this bundle I used to manually submit data to the form using this example https://symfony.com/doc/current/form/direct_submit.html. Is there any workout how to manually submit data to the handler?
Currently we use the [ParameterConverter] to provide the handlers to the action, but this causes 2 side effects:
SensioFrameworkExtraBundle
, depending on bundles is usually not the best idea.Request->attributes
, this means that your request contains services which is not really nice.I would like to replace the converter by an ArgumentValueResolver. It would introduce a BC break, so perhaps we can let developers toggle for BC reasons. After updating, a parameter could be set to revert to the old behavior in case the symfony version is not 3.1. This way we could support both variants on demand and automatically until the majority of people starts using ^3.1.
Perhaps we could still support the parameter converter up until 3.4 is released and remove it afterwards, while making the composer dependency a suggests earlier.
Please verify that that this bundle works with Symfony 2.7
We should document the AbstractFormhandler
with at least 1 example.
Some usage examples in the README would be really helpful! I sorta get how to use this, but at the same time I don't.
Currently I have to add some config in all my applications where I define form handlers:
services:
_instanceof:
Hostnet\Component\Form\FormHandlerInterface:
tags: [{ name: form.handler }]
public: true
Hostnet\Component\FormHandler\HandlerTypeInterface:
tags: [{ name: form.handler }]
public: true
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.