2009-09-11 23:50:48 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Entities;
|
|
|
|
|
2009-10-07 08:07:23 +04:00
|
|
|
/** @Entity @Table(name="users", indexes={@Index(name="name_idx", columns={"name", "test"})}) */
|
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;
|
2009-10-07 08:07:23 +04:00
|
|
|
/** @Column(type="string", length=50) */
|
|
|
|
private $test;
|
2009-09-11 23:50:48 +04:00
|
|
|
/**
|
|
|
|
* @OneToOne(targetEntity="Address")
|
2009-10-09 02:11:10 +04:00
|
|
|
* @JoinColumns({
|
|
|
|
* @JoinColumn(name="address_id", referencedColumnName="id"),
|
|
|
|
* @JoinColumn(name="address2_id", referencedColumnName="id")
|
|
|
|
* })
|
2009-09-11 23:50:48 +04:00
|
|
|
*/
|
|
|
|
private $address;
|
2009-10-09 02:11:10 +04:00
|
|
|
/**
|
|
|
|
* @ManyToMany(targetEntity="Group")
|
|
|
|
* @JoinTable(name="user_group",
|
|
|
|
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
|
|
|
|
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")
|
|
|
|
* })
|
|
|
|
*/
|
|
|
|
private $groups;
|
2009-09-11 23:50:48 +04:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|