/CheeseListingInput.php Secret
Last active
May 29, 2021 13:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Dto; | |
use App\Entity\User; | |
use Symfony\Component\Serializer\Annotation\Groups; | |
use Symfony\Component\Serializer\Annotation\SerializedName; | |
class CheeseListingInput | |
{ | |
#[Groups(['cheese:write', 'user:write'])] | |
public ?string $title = null; | |
#[Groups(['cheese:write', 'user:write'])] | |
public ?int $price = null; | |
#[Groups(['cheese:collection:post'])] | |
public ?User $owner = null; | |
#[Groups(['cheese:write'])] | |
public ?bool $isPublished = false; | |
public ?string $description = null; | |
/** | |
* The description of the cheese as raw text. | |
* @param string $description | |
* @return $this | |
*/ | |
#[ | |
Groups(['cheese:write', 'user:write']), | |
SerializedName('description') | |
] | |
public function setTextDescription(string $description): self | |
{ | |
$this->description = nl2br($description); | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment