Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c15f204
fix of deprecated functions
DenysMedvid Feb 26, 2016
6c0d24a
fix deprecated security.context
DenysMedvid Feb 26, 2016
5a5aaf0
Add Czech translation
dfridrich Apr 2, 2016
f502d35
Fix a typo
dfridrich Apr 2, 2016
e7e0ca5
Merge pull request #276 from dfridrich/patch-2
tgalopin Apr 2, 2016
e8f7956
Merge pull request #277 from dfridrich/patch-1
tgalopin Apr 2, 2016
fd2752f
Fixing deprecations
bassrock Apr 16, 2016
c78c9a7
Fix a typo
dfridrich Apr 18, 2016
f824ef8
Merge pull request #279 from dfridrich/patch-4
tgalopin Apr 18, 2016
cd4d911
Merge pull request #1 from Klinche/master
ownede May 6, 2016
e3a8d89
Merge pull request #2 from FriendsOfSymfony/symfony3
ownede May 6, 2016
ce904d7
Removed use of ContainerAware (removed in Symfony 3.0)
May 6, 2016
1837ca1
Update scoped services to use request_stack
ubermuda May 11, 2016
d0c3481
Update services to use token storage instead of security context
ubermuda May 11, 2016
f5843ea
Switch from ContainerAware to ContainerAwareInterface
ubermuda May 11, 2016
e367a88
Make container property protected in message controller
ubermuda May 11, 2016
b865d10
Update form factory configuration
ubermuda May 11, 2016
946e99e
Update form handler to use handleRequest instead of bind
ubermuda May 11, 2016
77bf522
Update forms to use new type declaration
ubermuda May 11, 2016
0608251
Update forms to use configureOptions
ubermuda May 11, 2016
aa9eaf5
Merge branch 'symfony3' of https://github.com/ubermuda/FOSMessageBund…
Jul 7, 2016
c334607
Merge branch 'symfony3' of https://github.com/ubermuda/FOSMessageBund…
Jul 7, 2016
90912fc
Merge branch 'ubermuda-symfony3' into symfony3
Jul 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update form factory configuration
  • Loading branch information
ubermuda committed May 11, 2016
commit b865d10794906af19ff4b84c56cfa5297525373f
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getConfigTreeBuilder()
->addDefaultsIfNotSet()
->children()
->scalarNode('factory')->defaultValue('fos_message.new_thread_form.factory.default')->cannotBeEmpty()->end()
->scalarNode('type')->defaultValue('fos_message.new_thread_form.type.default')->cannotBeEmpty()->end()
->scalarNode('class')->defaultValue('FOS\MessageBundle\FormType\NewThreadMessageFormType')->cannotBeEmpty()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is clearly a bc break, we need a bc layer to keep supporting the old option

->scalarNode('handler')->defaultValue('fos_message.new_thread_form.handler.default')->cannotBeEmpty()->end()
->scalarNode('name')->defaultValue('message')->cannotBeEmpty()->end()
->scalarNode('model')->defaultValue('FOS\MessageBundle\FormModel\NewThreadMessage')->end()
Expand All @@ -61,7 +61,7 @@ public function getConfigTreeBuilder()
->addDefaultsIfNotSet()
->children()
->scalarNode('factory')->defaultValue('fos_message.reply_form.factory.default')->cannotBeEmpty()->end()
->scalarNode('type')->defaultValue('fos_message.reply_form.type.default')->cannotBeEmpty()->end()
->scalarNode('class')->defaultValue('FOS\MessageBundle\FormType\ReplyMessageFormType')->cannotBeEmpty()->end()
->scalarNode('handler')->defaultValue('fos_message.reply_form.handler.default')->cannotBeEmpty()->end()
->scalarNode('name')->defaultValue('message')->cannotBeEmpty()->end()
->scalarNode('model')->defaultValue('FOS\MessageBundle\FormModel\ReplyMessage')->end()
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/FOSMessageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('fos_message.message_class', $config['message_class']);
$container->setParameter('fos_message.thread_class', $config['thread_class']);

$container->setParameter('fos_message.new_thread_form.class', $config['new_thread_form']['class']);
$container->setParameter('fos_message.new_thread_form.model', $config['new_thread_form']['model']);
$container->setParameter('fos_message.new_thread_form.name', $config['new_thread_form']['name']);
$container->setParameter('fos_message.reply_form.class', $config['reply_form']['class']);
$container->setParameter('fos_message.reply_form.model', $config['reply_form']['model']);
$container->setParameter('fos_message.reply_form.name', $config['reply_form']['name']);

Expand All @@ -51,10 +53,8 @@ public function load(array $configs, ContainerBuilder $container)
$container->setAlias('fos_message.spam_detector', $config['spam_detector']);
$container->setAlias('fos_message.twig_extension', $config['twig_extension']);

$container->setAlias('fos_message.new_thread_form.type', $config['new_thread_form']['type']);
$container->setAlias('fos_message.new_thread_form.factory', $config['new_thread_form']['factory']);
$container->setAlias('fos_message.new_thread_form.handler', $config['new_thread_form']['handler']);
$container->setAlias('fos_message.reply_form.type', $config['reply_form']['type']);
$container->setAlias('fos_message.reply_form.factory', $config['reply_form']['factory']);
$container->setAlias('fos_message.reply_form.handler', $config['reply_form']['handler']);

Expand Down
11 changes: 5 additions & 6 deletions FormFactory/AbstractMessageFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace FOS\MessageBundle\FormFactory;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormFactoryInterface;
use FOS\MessageBundle\FormModel\AbstractMessage;

Expand All @@ -21,11 +20,11 @@ abstract class AbstractMessageFormFactory
protected $formFactory;

/**
* The message form type
* The message form class
*
* @var AbstractType
* @var string
*/
protected $formType;
protected $formClass;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a bc break as well


/**
* The name of the form
Expand All @@ -41,10 +40,10 @@ abstract class AbstractMessageFormFactory
*/
protected $messageClass;

public function __construct(FormFactoryInterface $formFactory, AbstractType $formType, $formName, $messageClass)
public function __construct(FormFactoryInterface $formFactory, $formClass, $formName, $messageClass)
{
$this->formFactory = $formFactory;
$this->formType = $formType;
$this->formClass = $formClass;
$this->formName = $formName;
$this->messageClass = $messageClass;
}
Expand Down
2 changes: 1 addition & 1 deletion FormFactory/NewThreadMessageFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function create()
{
$message = $this->createModelInstance();

return $this->formFactory->createNamed($this->formName, $this->formType, $message);
return $this->formFactory->createNamed($this->formName, $this->formClass, $message);
}
}
2 changes: 1 addition & 1 deletion FormFactory/ReplyMessageFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function create(ThreadInterface $thread)
$message = $this->createModelInstance();
$message->setThread($thread);

return $this->formFactory->createNamed($this->formName, $this->formType, $message);
return $this->formFactory->createNamed($this->formName, $this->formClass, $message);
}
}
8 changes: 2 additions & 6 deletions Resources/config/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@

<services>

<service id="fos_message.new_thread_form.type.default" class="FOS\MessageBundle\FormType\NewThreadMessageFormType" public="false" />

<service id="fos_message.new_thread_multiple_form.type" class="FOS\MessageBundle\FormType\NewThreadMultipleMessageFormType" public="false" />

<service id="fos_message.reply_form.type.default" class="FOS\MessageBundle\FormType\ReplyMessageFormType" public="false" />

<service id="fos_message.new_thread_form.factory.default" class="FOS\MessageBundle\FormFactory\NewThreadMessageFormFactory" public="false">
<argument type="service" id="form.factory" />
<argument type="service" id="fos_message.new_thread_form.type" />
<argument>%fos_message.new_thread_form.class%</argument>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be managed in a compiler pass

<argument>%fos_message.new_thread_form.name%</argument>
<argument>%fos_message.new_thread_form.model%</argument>
</service>

<service id="fos_message.reply_form.factory.default" class="FOS\MessageBundle\FormFactory\ReplyMessageFormFactory" public="false">
<argument type="service" id="form.factory" />
<argument type="service" id="fos_message.reply_form.type" />
<argument>%fos_message.reply_form.class%</argument>
<argument>%fos_message.reply_form.name%</argument>
<argument>%fos_message.reply_form.model%</argument>
</service>
Expand Down