Address.php 810 Bytes
Newer Older
1 2 3 4 5
<?php

namespace Entities;

/** @Entity @Table(name="addresses") */
6 7
class Address
{
8 9 10 11 12 13 14
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;
    /** @Column(type="string", length=255) */
    private $street;
15
    /** @OneToOne(targetEntity="User", mappedBy="address") */
16 17
    private $user;

18 19
    public function getId()
    {
20 21 22
        return $this->id;
    }

23 24
    public function getStreet()
    {
25 26 27
        return $this->street;
    }

28 29
    public function setStreet($street)
    {
30 31 32
        $this->street = $street;
    }

33 34
    public function getUser()
    {
35 36 37
        return $this->user;
    }

38 39
    public function setUser(User $user)
    {
40 41 42 43 44
        if ($this->user !== $user) {
            $this->user = $user;
            $user->setAddress($this);
        }
    }
45
}