diff --git a/migrations/Version20240610074359.php b/migrations/Version20240610074359.php new file mode 100644 index 000000000..b0f86e740 --- /dev/null +++ b/migrations/Version20240610074359.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE service ADD created DATETIME NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE service DROP created'); + } +} diff --git a/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php b/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php index 908fe41cf..01b5618e5 100644 --- a/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php +++ b/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php @@ -18,9 +18,11 @@ namespace Surfnet\ServiceProviderDashboard\Domain\Entity; +use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Gedmo\Mapping\Annotation as Gedmo; use Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Repository\ServiceRepository; /** @@ -63,6 +65,13 @@ class Service #[ORM\GeneratedValue(strategy: 'AUTO')] private $id; + /** + * @var DateTime $created + */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(type: 'datetime')] + private DateTime $created; + /** * @var string */