46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Download\Action\Input;
|
|
|
|
use App\Download\Action\Command\DownloadMediaCommand;
|
|
use OneToMany\RichBundle\Attribute\SourceRequest;
|
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
|
use OneToMany\RichBundle\Contract\InputInterface;
|
|
|
|
/** @implements InputInterface<DownloadMediaInput> */
|
|
class DownloadMediaInput implements InputInterface
|
|
{
|
|
public function __construct(
|
|
#[SourceRequest('url')]
|
|
public string $url,
|
|
|
|
#[SourceRequest('title')]
|
|
public string $title,
|
|
|
|
#[SourceRequest('filename')]
|
|
public string $filename,
|
|
|
|
#[SourceRequest('mediaType')]
|
|
public string $mediaType,
|
|
|
|
#[SourceRequest('imdbId')]
|
|
public string $imdbId,
|
|
|
|
public ?int $userId = null,
|
|
|
|
public ?int $downloadId = null,
|
|
) {}
|
|
|
|
public function toCommand(): CommandInterface
|
|
{
|
|
return new DownloadMediaCommand(
|
|
$this->url,
|
|
$this->title,
|
|
$this->filename,
|
|
$this->mediaType,
|
|
$this->imdbId,
|
|
$this->userId,
|
|
$this->downloadId,
|
|
);
|
|
}
|
|
} |