1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

[2.0] Fixing coding standards of sandbox entities

This commit is contained in:
jwage 2010-03-17 14:09:17 +00:00
parent 90d2883937
commit 9b5968957d
2 changed files with 25 additions and 14 deletions

View file

@ -3,7 +3,8 @@
namespace Entities; namespace Entities;
/** @Entity @Table(name="addresses") */ /** @Entity @Table(name="addresses") */
class Address { class Address
{
/** /**
* @Id @Column(type="integer") * @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO") * @GeneratedValue(strategy="AUTO")
@ -14,27 +15,31 @@ class Address {
/** @OneToOne(targetEntity="User", mappedBy="address") */ /** @OneToOne(targetEntity="User", mappedBy="address") */
private $user; private $user;
public function getId() { public function getId()
{
return $this->id; return $this->id;
} }
public function getStreet() { public function getStreet()
{
return $this->street; return $this->street;
} }
public function setStreet($street) { public function setStreet($street)
{
$this->street = $street; $this->street = $street;
} }
public function getUser() { public function getUser()
{
return $this->user; return $this->user;
} }
public function setUser(User $user) { public function setUser(User $user)
{
if ($this->user !== $user) { if ($this->user !== $user) {
$this->user = $user; $this->user = $user;
$user->setAddress($this); $user->setAddress($this);
} }
} }
} }

View file

@ -3,7 +3,8 @@
namespace Entities; namespace Entities;
/** @Entity @Table(name="users") */ /** @Entity @Table(name="users") */
class User { class User
{
/** /**
* @Id @Column(type="integer") * @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO") * @GeneratedValue(strategy="AUTO")
@ -17,23 +18,28 @@ class User {
*/ */
private $address; private $address;
public function getId() { public function getId()
{
return $this->id; return $this->id;
} }
public function getName() { public function getName()
{
return $this->name; return $this->name;
} }
public function setName($name) { public function setName($name)
{
$this->name = $name; $this->name = $name;
} }
public function getAddress() { public function getAddress()
{
return $this->address; return $this->address;
} }
public function setAddress(Address $address) { public function setAddress(Address $address)
{
if ($this->address !== $address) { if ($this->address !== $address) {
$this->address = $address; $this->address = $address;
$address->setUser($this); $address->setUser($this);