OneupUploaderBundle icon indicating copy to clipboard operation
OneupUploaderBundle copied to clipboard

ClearChunkCommand and ClearOrphansCommand changes to remove deprecations in Symfony 6.1

Open artmit opened this issue 3 years ago • 3 comments

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

artmit avatar Aug 12 '22 16:08 artmit

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

bytehead avatar Aug 16 '22 14:08 bytehead

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

artmit avatar Aug 30 '22 21:08 artmit

Good day,

please see: #434

joesenova avatar Aug 02 '23 15:08 joesenova

Fixed in #436

bytehead avatar Mar 18 '24 13:03 bytehead