Add more tests
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
use ApiPlatform\Metadata;
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
@@ -18,6 +19,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
||||
normalizationContext: ['groups' => ['post:collection:read', 'post:read']],
|
||||
)]
|
||||
#[GetCollection(normalizationContext: ['groups' => ['post:collection:read']])]
|
||||
#[Metadata\ApiFilter(filterClass: SearchFilter::class, properties: ['species' => 'exact'])]
|
||||
class Post
|
||||
{
|
||||
#[ORM\Id]
|
||||
@@ -149,6 +151,8 @@ class Post
|
||||
#[ORM\PreUpdate]
|
||||
public function setPublicationDateValue(): void
|
||||
{
|
||||
$this->publicationDate = new \DateTimeImmutable();
|
||||
if ($this->publicationDate === null) {
|
||||
$this->publicationDate = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user