1
0
mirror of synced 2024-12-14 15:16:04 +03:00
doctrine2/tests/Doctrine/Tests/Models/Cache/City.php
2013-12-16 11:05:04 -05:00

109 lines
2.0 KiB
PHP

<?php
namespace Doctrine\Tests\Models\Cache;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Cache
* @Entity
* @Table("cache_city")
*/
class City
{
const CLASSNAME = __CLASS__;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
protected $id;
/**
* @Column(unique=true)
*/
protected $name;
/**
* @Cache
* @ManyToOne(targetEntity="State", inversedBy="cities")
* @JoinColumn(name="state_id", referencedColumnName="id")
*/
protected $state;
/**
* @ManyToMany(targetEntity="Travel", mappedBy="visitedCities")
*/
public $travels;
/**
* @Cache
* @OrderBy({"name" = "ASC"})
* @OneToMany(targetEntity="Attraction", mappedBy="city")
*/
public $attractions;
public function __construct($name, State $state = null)
{
$this->name = $name;
$this->state = $state;
$this->travels = new ArrayCollection();
$this->attractions = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getState()
{
return $this->state;
}
public function setState(State $state)
{
$this->state = $state;
}
public function addTravel(Travel $travel)
{
$this->travels[] = $travel;
}
public function getTravels()
{
return $this->travels;
}
public function addAttraction(Attraction $attraction)
{
$this->attractions[] = $attraction;
}
public function getAttractions()
{
return $this->attractions;
}
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
include __DIR__ . '/../../ORM/Mapping/php/Doctrine.Tests.Models.Cache.City.php';
}
}