Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / Models / Navigation / NavPointOfInterest.php
1 <?php
2
3 namespace Doctrine\Tests\Models\Navigation;
4
5 /**
6  * @Entity
7  * @Table(name="navigation_pois")
8  */
9 class NavPointOfInterest
10 {
11     /**
12      * @Id
13      * @Column(type="integer", name="nav_long")
14      */
15     private $long;
16
17     /**
18      * @Id
19      * @Column(type="integer", name="nav_lat")
20      */
21     private $lat;
22
23     /**
24      * @Column(type="string")
25      */
26     private $name;
27
28     /**
29      * @ManyToOne(targetEntity="NavCountry", inversedBy="pois")
30      */
31     private $country;
32
33      /**
34       * @ManyToMany(targetEntity="NavUser", cascade={"persist"})
35       * @JoinTable(name="navigation_pois_visitors",
36       *      inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
37       *      joinColumns={
38       *          @JoinColumn(name="poi_long", referencedColumnName="nav_long"),
39       *          @JoinColumn(name="poi_lat", referencedColumnName="nav_lat")
40       *      }
41       * )
42       */
43     private $visitors;
44
45     public function __construct($lat, $long, $name, $country)
46     {
47         $this->lat = $lat;
48         $this->long = $long;
49         $this->name = $name;
50         $this->country = $country;
51         $this->visitors = new \Doctrine\Common\Collections\ArrayCollection;
52     }
53
54     public function getLong() {
55         return $this->long;
56     }
57
58     public function getLat() {
59         return $this->lat;
60     }
61
62     public function getName() {
63         return $this->name;
64     }
65
66     public function getCountry() {
67         return $this->country;
68     }
69
70     public function addVisitor(NavUser $user)
71     {
72         $this->visitors[] = $user;
73     }
74
75     public function getVisitors()
76     {
77         return $this->visitors;
78     }
79 }