Symfony2 standalone Form component v2.3 - setting up a form - symfony-forms

This is the same question asked here: Symfony2 standalone form component - setting up a form. The answer to this question seems to fully address the issue.
Unfortunately back when this question was asked the version of the form component was 2.0.x, and several things have changed since, for example the form creation using the form factory is quite different now compare the old code vs the new one.
I looked around but didn't find any documentation or examples on how to do this with the latest versions.
any updated versions of a sample application using the form component outside of Symfony2?

I have a repository demonstrating the standalone usage of the Form component for Symfony 2.1+ with both Twig and PHP as templating engine (check the branches): https://github.com/bschussek/standalone-forms/blob/2.1%2Btwig/src/setup.php
The crucial part is that you shouldn't instantiate FormFactory objects manually anymore (to give us core developers more flexibility in changing its constructor), but use the Forms class instead:
$formFactory = Forms::createFormFactoryBuilder()
->addExtension(new CsrfExtension($csrfProvider))
->addExtension(new ValidatorExtension($validator))
->getFormFactory();
A nice side benefit is that your IDE will list you the setters of the form factory builder, showing you what you can configure and how.

Related

what does the model.generated.cs file do in Umbraco?

Exploring Umbraco 8 and playing around building a test site etc.
Building document types and content pages via the back office interface, and looking in the code itself I've noticed a files called models.generated.cs.
looking inside, it contains partial classes like public partial class AndyTestPage : PublishedContentModel { } and properties I've given it like
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.5.5")]
[ImplementPropertyType("andyProperty1")]
public string AndyProperty1 => this.Value<string>("andyProperty1");
my question is, what exactly is the point of this file? what does is do and how are these properties and classes created in here via the backoffice cms.
second question is, how would I go about creating a document type, and properties from code? my noob assumption is to simply add the classes in the this file, but that doesnt seem right?
Thanks,
Andy
It belongs to modelbuilder.
It depends on how you build your umbraco solution. If you use visual studio you can use something called strongly type, it helps building templates with VS.
By default, modelsbuilder is set to "PureLive", which is for users who builds within the umbraco backoffice system.
You can set modelsbuilder to different options, depending on how you build.
You should not edit the file, it is created and maintained by the system.
https://umbraco.tv/videos/umbraco-v7/implementor/working-with-umbraco-data/working-with-models-builder/
https://our.umbraco.com/documentation/reference/templating/modelsbuilder/
elitenet.dk has answered the first question
With regards to your second question Umbraco is database/content first so unfortunately you cant write documenttypes etc. from code first... not that i know of.
I beleive this is because Umbraco was designed to be used by almost anyone with a little html/css knowledge. E.g. You can create templates and views from the cms without having to know anything about serverside development.
Just a little tip if youre starting with Umbraco and plan on using multiple environments take a look at Kevin Jumps Usync package, essentually the package allows for document types/properties etc. to be pushed from environment to environment.Usync

Orbeon forms 2016.2 to 2016.2.1

I am using orbeon forms 2016.2 professional edition right now and I plan to switch to 2016.2.1 because the release notes highly recommend for the upgrade. When I perform the switch, can I use the same orbeon database that created with version 2016.2 without doing any patch works?
The data and table format hasn't changed between 2016.2 and 2016.2.1. (And in general, it shouldn't change in point releases, unless the change is really necessary to fix a bug.) So:
If you are using a relational database, and have already upgraded it to the 2016.2 format, or created it with the 2016.2 DDL, you're good to go, and can just switch to 2016.2.1.
If you're using the embedded eXist, you'll want to "copy" the WEB-INF/exist-data to the new version. For more on this, see point 2 in the When using Form Builder and Form Runner section of the documentation.

Orbeon 3.9.1PE upgrade to 4.1CE

Tomcat 7
Orbeon 4.1CE
After using 4.1CE, it cannot read the handwritten form in "orbeon/conf/resources/forms/"
Is there any new file need to define in 4.1 version?
Now, I know that the properties-local.xml affects this problem.
Is there any sample of properties-local.xml for 4.1CE?
First, if you're upgrading, I'd recommend you upgrade to the latest version (4.9 at the time of this writing), since 4.1 is already quite old.
Now, regarding your specific question, I can't remember Orbeon Forms ever using a orbeon/conf/resources/forms folder. Maybe orbeon/conf/resources was setup as a resource folder in your web.xml? If not, this must have been a directory your app was explicitly reading from.
About the properties-local.xml, you can define your own values for properties to configure the way Orbeon Forms works, and for more on this I'd recommend you go through the documentation about properties.

Access previous versions of form definitions with Orbeon

It appears that Orbeon does not support form versioning. When a change is made to a form definition, the form builder will only show the most recent version of the form. We are using MySql to store our data and I have noticed that the form definition is not overwritten in the database. A new line is added with a newer time stamp.
One requirement we have is that old revisions of a form must be trackable. At the very least we need to be able to view old versions of a form. How can this be done? The only way I can think of doing this is creating an instance of a form named with the revision everytime the form definition is updated. Has anyone found a better way to handle versioning in Orbeon?
At this time, and this includes the upcoming Orbeon Forms 4.0, there is no proper form versioning feature in Orbeon Forms (but we have some ideas as to how to implement this).
If what you want is that form data entered with a given version of a form definition is always loaded with that same version of the form definition, then unfortunately that feature isn't there.
Now, as you have noticed when using MySQL or Oracle, form data and form definitions are never actually deleted from the database. But this is more of an auditing feature rather than a versioning feature. With this, if you just want to find or restore an older version of a form, you can do this with a SQL query.

Using Form-Builder-Generated-Form with Java Application

I tried the approach of using Form-Builder-Generated-Form within Java application suggested here < Running Orbeon-Form-Builder-Generated-Form with Java Application > : downloaded Orbeon nightly build, created a sample form using Form Builder and copy & pasted it into JSP page in my app. However, when I try to access this JSP, it redirects me to: /myapp/fr/unauthorized . Can you please tell me what I maybe doing wrong? Or what is the right way of making Orbeon process Form Builder generated content in Java app?
For my deployment I followed separate deployment and configuration specified in Orbeon documentation. Thanks in advance.
You are not doing anything wrong, but Orbeon Forms doesn't support this type of form deployment.
The separate deployment mode runs the output of your JSP directly through the XForms engine.
Form Builder-generated forms OTOH expect pre-processing via the Form Runner runtime, in particular through the components.xsl XSLT transform. This is needed to support all the Form Runner features, including built-in persistence, error summary, internationalization, etc.
Currently the cleanest way to integrate such forms with your own app is to just run them side by side (Orbeon WAR + your own WAR) and navigate between each other via links and POSTs.
You could also use an iframe, although that is often a disliked solution.
You could also transform the form produced by Form Builder into plain XForms that doesn't assume Form Runner. It wouldn't be too hard to do but would be outside the scope of this StackOverflow question.

Resources