1
0
mirror of synced 2025-01-19 06:51:40 +03:00

123 lines
2.7 KiB
PHP
Raw Normal View History

<?php
namespace Doctrine\Tests\Models\CMS;
/**
* CmsAddress
*
* @author Roman S. Borschel
* @Entity
* @Table(name="cms_addresses")
2012-02-26 16:51:39 -03:00
*
* @NamedNativeQueries({
* @NamedNativeQuery(
* name = "find-all",
* resultSetMapping = "mapping-find-all",
* query = "SELECT id, country, city FROM cms_addresses"
2012-02-26 21:10:19 -03:00
* ),
* @NamedNativeQuery(
* name = "find-by-id",
* resultClass = "CmsAddress",
* query = "SELECT * FROM cms_addresses WHERE id = ?"
* ),
* @NamedNativeQuery(
* name = "count",
* resultSetMapping= "mapping-count",
* query = "SELECT COUNT(*) AS count FROM cms_addresses"
2012-02-26 16:51:39 -03:00
* )
* })
*
* @SqlResultSetMappings({
* @SqlResultSetMapping(
* name = "mapping-find-all",
* entities= {
* @EntityResult(
* entityClass = "CmsAddress",
* fields = {
* @FieldResult(name = "id", column="id"),
* @FieldResult(name = "city", column="city"),
* @FieldResult(name = "country", column="country")
* }
* )
* }
2012-02-26 21:10:19 -03:00
* ),
* @SqlResultSetMapping(
* name = "mapping-without-fields",
* entities= {
* @EntityResult(
* entityClass = "__CLASS__"
* )
* }
* ),
* @SqlResultSetMapping(
* name = "mapping-count",
* columns = {
* @ColumnResult(
* name = "count"
* )
* }
2012-02-26 16:51:39 -03:00
* )
* })
*
*/
class CmsAddress
{
/**
* @Column(type="integer")
2010-04-10 00:00:36 +02:00
* @Id @GeneratedValue
*/
public $id;
/**
2010-04-10 00:00:36 +02:00
* @Column(length=50)
*/
public $country;
/**
2010-04-10 00:00:36 +02:00
* @Column(length=50)
*/
public $zip;
/**
2010-04-10 00:00:36 +02:00
* @Column(length=50)
*/
public $city;
/**
* Testfield for Schema Updating Tests.
*/
public $street;
/**
2011-11-14 21:05:44 +01:00
* @OneToOne(targetEntity="CmsUser", inversedBy="address")
* @JoinColumn(referencedColumnName="id")
*/
public $user;
public function getId() {
return $this->id;
}
public function getUser() {
return $this->user;
}
public function getCountry() {
return $this->country;
}
public function getZipCode() {
return $this->zip;
}
public function getCity() {
return $this->city;
}
public function setUser(CmsUser $user) {
if ($this->user !== $user) {
$this->user = $user;
$user->setAddress($this);
}
}
}