コード例 #1
0
ファイル: Post.php プロジェクト: JonathanConner/SocialNet
 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;
     }
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function addPost(\User\Document\Post $post)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'addPost', array($post));
     return parent::addPost($post);
 }