2009-09-11 23:50:48 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Entities;
|
|
|
|
|
2009-10-07 08:07:23 +04:00
|
|
|
/** @Entity @Table(name="users", indexes={@Index(name="name_idx", columns={"name", "test"})}) */
|
2009-09-11 23:50:48 +04:00
|
|
|
class User {
|
|
|
|
/**
|
|
|
|
* @Id @Column(type="integer")
|
|
|
|
* @GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
/** @Column(type="string", length=50) */
|
|
|
|
private $name;
|
2009-10-07 08:07:23 +04:00
|
|
|
/** @Column(type="string", length=50) */
|
|
|
|
private $test;
|
2009-09-11 23:50:48 +04:00
|
|
|
/**
|
|
|
|
* @OneToOne(targetEntity="Address")
|
2009-10-09 21:51:06 +04:00
|
|
|
* @JoinColumn(name="address_id", referencedColumnName="id")
|
2009-09-11 23:50:48 +04:00
|
|
|
*/
|
|
|
|
private $address;
|
|
|
|
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAddress() {
|
|
|
|
return $this->address;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setAddress(Address $address) {
|
|
|
|
if ($this->address !== $address) {
|
|
|
|
$this->address = $address;
|
|
|
|
$address->setUser($this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|