1
0
mirror of synced 2025-01-10 11:07:10 +03:00
doctrine2/tests/Doctrine/Tests/Models/Tweet/User.php

41 lines
679 B
PHP
Raw Normal View History

2014-02-21 13:30:41 +04:00
<?php
namespace Doctrine\Tests\Models\Tweet;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity
* @Table(name="tweet_user")
*/
class User
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
public $id;
/**
* @Column(type="string")
*/
public $name;
/**
* @OneToMany(targetEntity="Tweet", mappedBy="author", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
public $tweets;
public function __construct()
{
$this->tweets = new ArrayCollection();
}
public function addTweet(Tweet $tweet)
{
$tweet->setAuthor($this);
$this->tweets->add($tweet);
}
}