1
0
mirror of synced 2025-01-09 18:47:10 +03:00
doctrine2/tests/Doctrine/Tests/Models/Tweet/User.php
Michaël Gallego 0a6c2027f5 Update tests
2014-05-15 18:22:57 +02:00

41 lines
679 B
PHP

<?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);
}
}