Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / orm / tools / sandbox / Entities / Address.php
diff --git a/vendor/doctrine/orm/tools/sandbox/Entities/Address.php b/vendor/doctrine/orm/tools/sandbox/Entities/Address.php
new file mode 100644 (file)
index 0000000..717ea63
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+namespace Entities;
+
+/** @Entity @Table(name="addresses") */
+class Address
+{
+    /**
+     * @Id @Column(type="integer")
+     * @GeneratedValue(strategy="AUTO")
+     */
+    private $id;
+    /** @Column(type="string", length=255) */
+    private $street;
+    /** @OneToOne(targetEntity="User", mappedBy="address") */
+    private $user;
+
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    public function getStreet()
+    {
+        return $this->street;
+    }
+
+    public function setStreet($street)
+    {
+        $this->street = $street;
+    }
+
+    public function getUser()
+    {
+        return $this->user;
+    }
+
+    public function setUser(User $user)
+    {
+        if ($this->user !== $user) {
+            $this->user = $user;
+            $user->setAddress($this);
+        }
+    }
+}
\ No newline at end of file