Timestamp comments automatically
This commit is contained in:
@@ -56,8 +56,6 @@ class CommentCrudController extends AbstractCrudController
|
|||||||
]);
|
]);
|
||||||
if(Crud::PAGE_EDIT === $pageName) {
|
if(Crud::PAGE_EDIT === $pageName) {
|
||||||
yield $createdAt->setFormTypeOption('disabled', true);
|
yield $createdAt->setFormTypeOption('disabled', true);
|
||||||
} else {
|
|
||||||
yield $createdAt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Doctrine\DBAL\Types\Types;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: CommentRepository::class)]
|
#[ORM\Entity(repositoryClass: CommentRepository::class)]
|
||||||
|
#[ORM\HasLifecycleCallbacks]
|
||||||
class Comment
|
class Comment
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
@@ -86,6 +87,12 @@ class Comment
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[ORM\PrePersist]
|
||||||
|
public function setCreatedAtValue()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTimeImmutable();
|
||||||
|
}
|
||||||
|
|
||||||
public function getConference(): ?Conference
|
public function getConference(): ?Conference
|
||||||
{
|
{
|
||||||
return $this->conference;
|
return $this->conference;
|
||||||
|
|||||||
Reference in New Issue
Block a user