Skip to content

Remove some deprecations #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion Command/AutoClosingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

class AutoClosingCommand extends ContainerAwareCommand
{
protected static $defaultName = 'ticket:autoclosing';

/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('ticket:autoclosing')
->setName(static::$defaultName) // BC for symfony/console < 3.4.0
->setDescription('Automatically close resolved tickets still opened')
->addArgument(
'username',
Expand Down
4 changes: 3 additions & 1 deletion Command/TicketManagerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

class TicketManagerCommand extends ContainerAwareCommand
{
protected static $defaultName = 'ticket:create';

/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('ticket:create')
->setName(static::$defaultName) // BC for symfony/console < 3.4.0
->setDescription('Create a new Ticket')
->addArgument(
'subject',
Expand Down
10 changes: 8 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder = new TreeBuilder('hackzilla_ticket');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('hackzilla_ticket');
}

$treeBuilder->root('hackzilla_ticket')
$rootNode
->children()
->scalarNode('user_class')->isRequired()->cannotBeEmpty()->end()
->scalarNode('ticket_class')->cannotBeEmpty()->defaultValue('Hackzilla\Bundle\TicketBundle\Entity\Ticket')->end()
Expand Down
10 changes: 10 additions & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,13 @@ services:
class: Hackzilla\Bundle\TicketBundle\EventListener\FileSubscriber
tags:
- { name: kernel.event_subscriber }

hackzilla_ticket.command.autoclosing:
class: Hackzilla\Bundle\TicketBundle\Command\AutoClosingCommand
tags:
- { name: console.command, command: ticket:autoclosing }

hackzilla_ticket.command.create:
class: Hackzilla\Bundle\TicketBundle\Command\TicketManagerCommand
tags:
- { name: console.command, command: ticket:create }