2009-09-11 23:50:48 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Entities;
|
|
|
|
|
2009-10-24 01:47:25 +04:00
|
|
|
/** @Entity @Table(name="users") */
|
2010-03-17 17:09:17 +03:00
|
|
|
class User
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
/**
|
|
|
|
* @Id @Column(type="integer")
|
|
|
|
* @GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
/** @Column(type="string", length=50) */
|
|
|
|
private $name;
|
|
|
|
/**
|
2010-09-15 23:22:26 +04:00
|
|
|
* @OneToOne(targetEntity="Address", inversedBy="user")
|
2009-10-09 21:51:06 +04:00
|
|
|
* @JoinColumn(name="address_id", referencedColumnName="id")
|
2009-09-11 23:50:48 +04:00
|
|
|
*/
|
|
|
|
private $address;
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function getId()
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function getName()
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function setName($name)
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
$this->name = $name;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function getAddress()
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
return $this->address;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function setAddress(Address $address)
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
if ($this->address !== $address) {
|
|
|
|
$this->address = $address;
|
|
|
|
$address->setUser($this);
|
|
|
|
}
|
|
|
|
}
|
2010-03-17 17:20:18 +03:00
|
|
|
}
|