Skip to content
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

ClearChunkCommand and ClearOrphansCommand changes to remove deprecations in Symfony 6.1 #430

Closed
artmit opened this issue Aug 12, 2022 · 4 comments
Assignees
Labels
Milestone

Comments

@artmit
Copy link

artmit commented Aug 12, 2022

Hi,
Would it be possible to change $defaultName property usage (overriding) in commands (ClearChunkCommand and ClearOrphansCommand) to attribute? Is this planned for future release?
I've upgraded my project to Symfony 6 and it shows now:
The "Symfony\Component\Console\Command\Command::$defaultName" property is considered final. You should not override it in "Oneup\UploaderBundle\Command\ClearChunkCommand".
The "Symfony\Component\Console\Command\Command::$defaultName" property is considered final. You should not override it in "Oneup\UploaderBundle\Command\ClearOrphansCommand".

Eg. in src/Command/ClearChunkCOmmand.php

+use Symfony\Component\Console\Attribute\AsCommand;
+#[AsCommand(name: 'oneup:uploader:clear-chunks', description: 'Clear chunks according to the max-age you defined in your configuration.')]
class ClearChunkCommand extends Command
{
-    protected static $defaultName = 'oneup:uploader:clear-chunks'; // Make command lazy load

    /**
     * @var ChunkManager
     */
    private $manager;

    public function __construct(ChunkManager $manager)
    {
        $this->manager = $manager;

        parent::__construct();
    }

-    protected function configure(): void
-    {
-        $this
-           ->setDescription('Clear chunks according to the max-age you defined in your configuration.')
-        ;
-    }

How to reproduce:
Compile project using OneupUploaderBundle in Symfony 6.1.3

|-------- | ------
| Version | 4.0.1
|Symfony|6.1.3

@bytehead bytehead added the bug label Aug 16, 2022
@bytehead bytehead self-assigned this Aug 16, 2022
@bytehead bytehead added this to the 4.x milestone Aug 16, 2022
@bytehead
Copy link
Member

Is this shown as an error (script execution fails) or just a (deprecation) notice?

@artmit
Copy link
Author

artmit commented Aug 30, 2022

Sorry for delay. It is just deprecation notice at the moment.

@joesenova
Copy link

Good day,

please see: #434

@bytehead
Copy link
Member

Fixed in #436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants