Skip to content

Commit

Permalink
Handle null value job offer creation (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdequippe authored Nov 29, 2024
1 parent 508b67a commit b765dd3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Job/Command/PostJobOfferCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class PostJobOfferCommand
public string $location = '';

#[Assert\NotBlank]
public EmploymentType $employmentType = EmploymentType::FULLTIME;
public ?EmploymentType $employmentType = EmploymentType::FULLTIME;

#[Assert\NotBlank]
#[Assert\Length(max: 255)]
Expand Down Expand Up @@ -49,13 +49,16 @@ final class PostJobOfferCommand
public string $contactEmail = '';

#[Assert\NotBlank(allowNull: true)]
public LocationType $locationType = LocationType::REMOTE;
public ?LocationType $locationType = LocationType::REMOTE;

#[Assert\GreaterThanOrEqual(0)]
public ?int $donationAmount = null;

public function toEntity(): Job
{
\Webmozart\Assert\Assert::notNull($this->employmentType);
\Webmozart\Assert\Assert::notNull($this->locationType);

$job = new Job(
$this->title,
$this->location,
Expand Down

0 comments on commit b765dd3

Please sign in to comment.