Skip to content

Commit 3336069

Browse files
committed
Merge pull request #179 from symfony-cmf/sf-28
Fix deprecations
2 parents c569704 + 53905c8 commit 3336069

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

Admin/Extension/PublishTimePeriodExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct($formGroup = 'form.group_publish_workflow')
4040
*/
4141
public function configureFormFields(FormMapper $formMapper)
4242
{
43+
$dateType = method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ? 'Symfony\Component\Form\Extension\Core\Type\DateType' : 'date';
4344
$dateOptions = array(
4445
'empty_value' => '',
4546
'required' => false,
@@ -48,10 +49,10 @@ public function configureFormFields(FormMapper $formMapper)
4849
$formMapper->with($this->formGroup, array(
4950
'translation_domain' => 'CmfCoreBundle',
5051
))
51-
->add('publish_start_date', 'date', $dateOptions, array(
52+
->add('publish_start_date', $dateType, $dateOptions, array(
5253
'help' => 'form.help_publish_start_date',
5354
))
54-
->add('publish_end_date', 'date', $dateOptions, array(
55+
->add('publish_end_date', $dateType, $dateOptions, array(
5556
'help' => 'form.help_publish_end_date',
5657
))
5758
->end();

Admin/Extension/PublishableExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function configureFormFields(FormMapper $formMapper)
4343
$formMapper->with($this->formGroup, array(
4444
'translation_domain' => 'CmfCoreBundle',
4545
))
46-
->add('publishable', 'checkbox', array(
46+
->add('publishable', method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ? 'Symfony\Component\Form\Extension\Core\Type\CheckboxType' : 'checkbox', array(
4747
'required' => false,
4848
))
4949
->end();

Admin/Extension/TranslatableExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function configureFormFields(FormMapper $formMapper)
6565
$formMapper
6666
->with($this->formGroup)
6767
// do not set a translation_domain for this group or group_general will be translated by our domain.
68-
->add('locale', 'choice', array(
68+
->add('locale', method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ? 'Symfony\Component\Form\Extension\Core\Type\ChoiceType' : 'choice', array(
6969
'choices' => array_combine($this->locales, $this->locales),
7070
'empty_value' => '',
7171
), array('translation_domain' => 'CmfCoreBundle'))

Form/Type/CheckboxUrlLabelFormType.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ public function configureOptions(OptionsResolver $resolver)
8383
* {@inheritDoc}
8484
*/
8585
public function getName()
86+
{
87+
return $this->getBlockPrefix();
88+
}
89+
90+
/**
91+
* {@inheritdoc}
92+
*/
93+
public function getBlockPrefix()
8694
{
8795
return 'cmf_core_checkbox_url_label';
8896
}
@@ -92,7 +100,7 @@ public function getName()
92100
*/
93101
public function getParent()
94102
{
95-
return 'checkbox';
103+
return method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ? 'Symfony\Component\Form\Extension\Core\Type\CheckboxType' : 'checkbox';
96104
}
97105

98106
}

Tests/Functional/Form/CheckboxUrlLabelFormTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Cmf\Bundle\CoreBundle\Tests\Functional\Form;
1313

14+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1415
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
1516

1617
class CheckboxUrlLabelFormTypeTest extends BaseTestCase
@@ -31,7 +32,7 @@ public function testFormTwigTemplate()
3132
'routes' => array(
3233
'%a%' => array('parameters' => array('content_id' => '/test/content/a')),
3334
'%b%' => array('parameters' => array('content_id' => '/test/content/b')),
34-
'%c%' => array('name' => 'hello', 'parameters' => array('name' => 'world'), 'referenceType' => true),
35+
'%c%' => array('name' => 'hello', 'parameters' => array('name' => 'world'), 'referenceType' => UrlGeneratorInterface::ABSOLUTE_URL),
3536
)
3637
))
3738
->getForm()

Tests/Unit/Twig/Extension/CmfExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function setUp()
3333
)->disableOriginalConstructor()->getMock();
3434

3535
$this->cmfExtension = new CmfExtension($this->cmfHelper);
36-
$this->env = new \Twig_Environment();
36+
$this->env = new \Twig_Environment(new \Twig_Loader_Array(array()));
3737
$this->env->addExtension($this->cmfExtension);
3838
}
3939

0 commit comments

Comments
 (0)