1
0
mirror of synced 2024-12-05 03:06:05 +03:00
doctrine2/tools/sandbox/Entities/Address.php

45 lines
810 B
PHP

<?php
namespace Entities;
/** @Entity @Table(name="addresses") */
class Address
{
/**
* @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
private $id;
/** @Column(type="string", length=255) */
private $street;
/** @OneToOne(targetEntity="User", mappedBy="address") */
private $user;
public function getId()
{
return $this->id;
}
public function getStreet()
{
return $this->street;
}
public function setStreet($street)
{
$this->street = $street;
}
public function getUser()
{
return $this->user;
}
public function setUser(User $user)
{
if ($this->user !== $user) {
$this->user = $user;
$user->setAddress($this);
}
}
}