48 lines
		
	
	
		
			897 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			897 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Entities;
 | 
						|
 | 
						|
/** @Entity @Table(name="users") */
 | 
						|
class User
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * @Id @Column(type="integer")
 | 
						|
     * @GeneratedValue(strategy="AUTO")
 | 
						|
     */
 | 
						|
    private $id;
 | 
						|
    /** @Column(type="string", length=50) */
 | 
						|
    private $name;
 | 
						|
    /**
 | 
						|
     * @OneToOne(targetEntity="Address", inversedBy="user")
 | 
						|
     * @JoinColumn(name="address_id", referencedColumnName="id")
 | 
						|
     */
 | 
						|
    private $address;
 | 
						|
 | 
						|
    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);
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |