#1265 DDC-3517 - moved test assets to separate models dir, namespaced table names
This commit is contained in:
parent
185f22668c
commit
9abbdb9e7f
4 changed files with 51 additions and 31 deletions
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\OneToOneSingleTableInheritance;
|
||||
|
||||
/** @Entity */
|
||||
class Cat extends Pet
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="LitterBox")
|
||||
*
|
||||
* @var LitterBox
|
||||
*/
|
||||
public $litterBox;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\OneToOneSingleTableInheritance;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="one_to_one_single_table_inheritance_litter_box")
|
||||
*/
|
||||
class LitterBox
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */
|
||||
public $id;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\OneToOneSingleTableInheritance;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="one_to_one_single_table_inheritance_pet")
|
||||
* @InheritanceType("SINGLE_TABLE")
|
||||
* @DiscriminatorMap({"cat" = "Cat"})
|
||||
*/
|
||||
abstract class Pet
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */
|
||||
public $id;
|
||||
}
|
|
@ -7,6 +7,9 @@ use Doctrine\Tests\Models\ECommerce\ECommerceShipping;
|
|||
use Doctrine\ORM\Mapping\AssociationMapping;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\Tests\Models\OneToOneSingleTableInheritance\Cat;
|
||||
use Doctrine\Tests\Models\OneToOneSingleTableInheritance\LitterBox;
|
||||
use Doctrine\Tests\Models\OneToOneSingleTableInheritance\Pet;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class OneToOneSingleTableInheritanceTest extends OrmFunctionalTestCase
|
||||
|
@ -47,34 +50,3 @@ class OneToOneSingleTableInheritanceTest extends OrmFunctionalTestCase
|
|||
$this->assertSame($cat->litterBox->id, $foundCat->litterBox->id);
|
||||
}
|
||||
}
|
||||
|
||||
/** @Entity @InheritanceType("SINGLE_TABLE") @DiscriminatorMap({"cat" = "Cat"}) */
|
||||
abstract class Pet
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */
|
||||
public $id;
|
||||
}
|
||||
|
||||
/** @Entity */
|
||||
class Cat extends Pet
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/**
|
||||
* @OneToOne(targetEntity="LitterBox")
|
||||
*
|
||||
* @var LitterBox
|
||||
*/
|
||||
public $litterBox;
|
||||
}
|
||||
|
||||
/** @Entity */
|
||||
class LitterBox
|
||||
{
|
||||
const CLASSNAME = __CLASS__;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */
|
||||
public $id;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue