2009-09-11 23:50:48 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Entities;
|
|
|
|
|
|
|
|
/** @Entity @Table(name="addresses") */
|
2010-03-17 17:09:17 +03:00
|
|
|
class Address
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
/**
|
|
|
|
* @Id @Column(type="integer")
|
|
|
|
* @GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
/** @Column(type="string", length=255) */
|
|
|
|
private $street;
|
2009-10-09 21:51:06 +04:00
|
|
|
/** @OneToOne(targetEntity="User", mappedBy="address") */
|
2009-09-11 23:50:48 +04:00
|
|
|
private $user;
|
|
|
|
|
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 getStreet()
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
return $this->street;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function setStreet($street)
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
$this->street = $street;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function getUser()
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
return $this->user;
|
|
|
|
}
|
|
|
|
|
2010-03-17 17:09:17 +03:00
|
|
|
public function setUser(User $user)
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
if ($this->user !== $user) {
|
|
|
|
$this->user = $user;
|
|
|
|
$user->setAddress($this);
|
|
|
|
}
|
|
|
|
}
|
2010-03-17 17:09:17 +03:00
|
|
|
}
|