mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 10:18:56 +02:00
Fixed problem that all properties in snake_case style were considered readOnly by API Platform
This commit is contained in:
parent
f285061a76
commit
ccb94c8a13
2 changed files with 74 additions and 0 deletions
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -36,6 +37,7 @@ trait TimestampTrait
|
|||
* @var \DateTimeInterface|null the date when this element was modified the last time
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ApiProperty(writable: false)]
|
||||
#[ORM\Column(name: 'last_modified', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
protected ?\DateTimeInterface $lastModified = null;
|
||||
|
||||
|
@ -43,6 +45,7 @@ trait TimestampTrait
|
|||
* @var \DateTimeInterface|null the date when this element was created
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ApiProperty(writable: false)]
|
||||
#[ORM\Column(name: 'datetime_added', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
protected ?\DateTimeInterface $addedDate = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue