Answer the question
In order to leave comments, you need to log in
How to get user after post creation?
Good afternoon.
The work is done under Easy admin. The point is simple. After creating the news (record in the database), you need to update some data in the table. I do it like this:
/**
* @ORM\Entity(repositoryClass=OrgNewsRepository::class)
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable
*/
class OrgNews
{
...
/**
* @ORM\PrePersist
*/
public function setValuesAfterCreate()
{
$this->updatedAt = new \DateTime('now');
}
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question