2009-09-11 23:50:48 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Entities;
|
|
|
|
|
2009-10-24 01:47:25 +04:00
|
|
|
/** @Entity @Table(name="users") */
|
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;
|
|
|
|
/**
|
|
|
|
* @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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|