More SubscriptionEvent optimization.

This commit is contained in:
Alexey Skobkin 2017-01-08 18:31:05 +03:00
parent c3d430e8f8
commit 366396a4c2

View file

@ -10,8 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Index(name="subscriber_idx", columns={"subscriber_id"}), * @ORM\Index(name="subscriber_idx", columns={"subscriber_id"}),
* @ORM\Index(name="date_idx", columns={"date"}) * @ORM\Index(name="date_idx", columns={"date"})
* }) * })
* @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionEventRepository") * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionEventRepository", readOnly=true)
* @ORM\HasLifecycleCallbacks
*/ */
class SubscriptionEvent class SubscriptionEvent
{ {
@ -68,16 +67,7 @@ class SubscriptionEvent
$this->author = $author; $this->author = $author;
$this->subscriber = $subscriber; $this->subscriber = $subscriber;
$this->action = $action; $this->action = $action;
} $this->date = new \DateTime();
/**
* @ORM\PrePersist
*/
public function onCreate()
{
if (!$this->date) {
$this->date = new \DateTime();
}
} }
public function getId(): int public function getId(): int