#1169 DDC-3343 - refactoring test to use pre-existing test models
This commit is contained in:
parent
24ebfb69cb
commit
7292920b15
34
tests/Doctrine/Tests/Models/Tweet/Tweet.php
Normal file
34
tests/Doctrine/Tests/Models/Tweet/Tweet.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Tweet;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="tweet_tweet")
|
||||
*/
|
||||
class Tweet
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
*/
|
||||
public $content;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="User", inversedBy="tweets")
|
||||
*/
|
||||
public $author;
|
||||
|
||||
public function setAuthor(User $user)
|
||||
{
|
||||
$this->author = $user;
|
||||
}
|
||||
}
|
42
tests/Doctrine/Tests/Models/Tweet/User.php
Normal file
42
tests/Doctrine/Tests/Models/Tweet/User.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Tweet;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="tweet_user")
|
||||
*/
|
||||
class User
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user