Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
some updates
  • Loading branch information
Miliooo committed Oct 17, 2013
commit f21d3eaf0f628568de9c7a4ed3bed3d27b694c5b
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getConfigTreeBuilder()
->arrayNode('flash_messages')
->addDefaultsIfNotSet()
->children()
->booleanNode('show')->defaultValue(false)->end()
->booleanNode('enabled')->defaultFalse()->end()
->scalarNode('flash_key')->defaultNull()->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.

cannotBeEmpty looks weird as the code allows using an empty key

->scalarNode('service')->defaultValue('fos_message.flash_listener.default')->cannotBeEmpty()->end()
->end()
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/FOSMessageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function load(array $configs, ContainerBuilder $container)
$container->getDefinition('fos_message.recipients_data_transformer')
->replaceArgument(0, new Reference($config['user_transformer']));

if($config['flash_messages']['show'])
if($config['flash_messages']['enabled'])
Copy link
Member

Choose a reason for hiding this comment

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

missing space between if ()

Copy link
Member

Choose a reason for hiding this comment

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

This occurs in a few places

{
Copy link
Member

Choose a reason for hiding this comment

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

this curly brace should be on the previous line

$loader->load('flash.xml');
$container->setAlias('fos_message.flash_listener', $config['flash_messages']['service']);
Copy link
Member

Choose a reason for hiding this comment

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

the alias is useless as we will never reference it (it is an event listener, not a dependency for other services). The event dispatcher will use the service id itself when reading tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If @merk agrees I'll undo those changes. I also don't think it's really something users will want to overwrite. Then again there are always strange use cases...

Expand Down
4 changes: 2 additions & 2 deletions EventListener/FlashListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function addSuccessFlash(Event $event)
{
$eventName = $event->getname();

if (!isset(self::$successMessages[$eventName])) {
throw new \InvalidArgumentException('This event does not correspond to a known flash message');
if (!isset(self::$successMessages[$eventName])) {
throw new \InvalidArgumentException('This event does not correspond to a known flash message');
}
Copy link
Member

Choose a reason for hiding this comment

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

Spacing


$this->session->getFlashBag()->add($this->key, $this->trans(self::$successMessages[$eventName]));
Expand Down