public function __construct(User $user = null, $title = null, $body = null) { $this->created = new \DateTime(); if (isset($user)) { $this->author = $user; $user->addPost($this); } if (isset($title)) { $this->title = $title; } if (isset($body)) { $this->body = $body; } }
/** * {@inheritDoc} */ public function addPost(\User\Document\Post $post) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'addPost', array($post)); return parent::addPost($post); }