Skip to content

Commit

Permalink
Add created to Service entity
Browse files Browse the repository at this point in the history
This additional field will show us when a service is created.

See: https://www.pivotaltracker.com/story/show/187715470
  • Loading branch information
MKodde committed Jun 10, 2024
1 parent 8b910cd commit 142ba71
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
31 changes: 31 additions & 0 deletions migrations/Version20240610074359.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Surfnet\ServiceProviderDashboard\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Add the `created` datetime field on the service entity
*/
final class Version20240610074359 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->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');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 142ba71

Please sign in to comment.