Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
01f90256
Commit
01f90256
authored
Jan 08, 2017
by
HeahDude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the FormRegistry as a service to enable the extension point
parent
8ac290c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
src/Silex/Provider/FormServiceProvider.php
src/Silex/Provider/FormServiceProvider.php
+7
-6
tests/Silex/Tests/Provider/FormServiceProviderTest.php
tests/Silex/Tests/Provider/FormServiceProviderTest.php
+7
-0
No files found.
src/Silex/Provider/FormServiceProvider.php
View file @
01f90256
...
@@ -16,7 +16,8 @@ use Pimple\ServiceProviderInterface;
...
@@ -16,7 +16,8 @@ use Pimple\ServiceProviderInterface;
use
Symfony\Component\Form\Extension\Csrf\CsrfExtension
;
use
Symfony\Component\Form\Extension\Csrf\CsrfExtension
;
use
Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension
;
use
Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension
;
use
Symfony\Component\Form\Extension\Validator\ValidatorExtension
as
FormValidatorExtension
;
use
Symfony\Component\Form\Extension\Validator\ValidatorExtension
as
FormValidatorExtension
;
use
Symfony\Component\Form\Forms
;
use
Symfony\Component\Form\FormFactory
;
use
Symfony\Component\Form\FormRegistry
;
use
Symfony\Component\Form\ResolvedFormTypeFactory
;
use
Symfony\Component\Form\ResolvedFormTypeFactory
;
/**
/**
...
@@ -74,11 +75,11 @@ class FormServiceProvider implements ServiceProviderInterface
...
@@ -74,11 +75,11 @@ class FormServiceProvider implements ServiceProviderInterface
};
};
$app
[
'form.factory'
]
=
function
(
$app
)
{
$app
[
'form.factory'
]
=
function
(
$app
)
{
return
Forms
::
createFormFactoryBuilder
()
return
new
FormFactory
(
$app
[
'form.registry'
],
$app
[
'form.resolved_type_factory'
]);
->
addExtensions
(
$app
[
'form.extensions'
])
};
->
setResolvedTypeFactory
(
$app
[
'form.resolved_type_factory'
])
->
getFormFactory
()
$app
[
'form.registry'
]
=
function
(
$app
)
{
;
return
new
FormRegistry
(
$app
[
'form.extensions'
],
$app
[
'form.resolved_type_factory'
])
;
};
};
$app
[
'form.resolved_type_factory'
]
=
function
(
$app
)
{
$app
[
'form.resolved_type_factory'
]
=
function
(
$app
)
{
...
...
tests/Silex/Tests/Provider/FormServiceProviderTest.php
View file @
01f90256
...
@@ -34,6 +34,13 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
...
@@ -34,6 +34,13 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
$this
->
assertInstanceOf
(
'Symfony\Component\Form\FormFactory'
,
$app
[
'form.factory'
]);
$this
->
assertInstanceOf
(
'Symfony\Component\Form\FormFactory'
,
$app
[
'form.factory'
]);
}
}
public
function
testFormRegistryServiceIsFormRegistry
()
{
$app
=
new
Application
();
$app
->
register
(
new
FormServiceProvider
());
$this
->
assertInstanceOf
(
'Symfony\Component\Form\FormRegistry'
,
$app
[
'form.registry'
]);
}
public
function
testFormServiceProviderWillLoadTypes
()
public
function
testFormServiceProviderWillLoadTypes
()
{
{
$app
=
new
Application
();
$app
=
new
Application
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment