File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212class AutoClosingCommand extends ContainerAwareCommand
1313{
14+ protected static $ defaultName = 'ticket:autoclosing ' ;
15+
1416 /**
1517 * {@inheritdoc}
1618 */
1719 protected function configure ()
1820 {
1921 $ this
20- ->setName (' ticket:autoclosing ' )
22+ ->setName (static :: $ defaultName ) // BC for symfony/console < 3.4.0
2123 ->setDescription ('Automatically close resolved tickets still opened ' )
2224 ->addArgument (
2325 'username ' ,
Original file line number Diff line number Diff line change 1111
1212class TicketManagerCommand extends ContainerAwareCommand
1313{
14+ protected static $ defaultName = 'ticket:create ' ;
15+
1416 /**
1517 * {@inheritdoc}
1618 */
1719 protected function configure ()
1820 {
1921 $ this
20- ->setName (' ticket:create ' )
22+ ->setName (static :: $ defaultName ) // BC for symfony/console < 3.4.0
2123 ->setDescription ('Create a new Ticket ' )
2224 ->addArgument (
2325 'subject ' ,
Original file line number Diff line number Diff line change @@ -17,9 +17,15 @@ class Configuration implements ConfigurationInterface
1717 */
1818 public function getConfigTreeBuilder ()
1919 {
20- $ treeBuilder = new TreeBuilder ();
20+ $ treeBuilder = new TreeBuilder ('hackzilla_ticket ' );
21+ if (method_exists ($ treeBuilder , 'getRootNode ' )) {
22+ $ rootNode = $ treeBuilder ->getRootNode ();
23+ } else {
24+ // BC layer for symfony/config 4.1 and older
25+ $ rootNode = $ treeBuilder ->root ('hackzilla_ticket ' );
26+ }
2127
22- $ treeBuilder -> root ( ' hackzilla_ticket ' )
28+ $ rootNode
2329 ->children ()
2430 ->scalarNode ('user_class ' )->isRequired ()->cannotBeEmpty ()->end ()
2531 ->scalarNode ('ticket_class ' )->cannotBeEmpty ()->defaultValue ('Hackzilla\Bundle\TicketBundle\Entity\Ticket ' )->end ()
Original file line number Diff line number Diff line change @@ -70,3 +70,13 @@ services:
7070 class : Hackzilla\Bundle\TicketBundle\EventListener\FileSubscriber
7171 tags :
7272 - { name: kernel.event_subscriber }
73+
74+ hackzilla_ticket.command.autoclosing :
75+ class : Hackzilla\Bundle\TicketBundle\Command\AutoClosingCommand
76+ tags :
77+ - { name: console.command, command: ticket:autoclosing }
78+
79+ hackzilla_ticket.command.create :
80+ class : Hackzilla\Bundle\TicketBundle\Command\TicketManagerCommand
81+ tags :
82+ - { name: console.command, command: ticket:create }
You can’t perform that action at this time.
0 commit comments