Skip to content
This repository
Browse code

Implementing Doctrine\Common\Persistence interfaces.

  • Loading branch information...
commit 8d02e8439fb6737de1e23e1953a643858a8a6c68 1 parent e4dc2ad
Jonathan H. Wage authored February 15, 2011
5  lib/Doctrine/ODM/MongoDB/DocumentManager.php
@@ -28,7 +28,8 @@
28 28
     Doctrine\ODM\MongoDB\Proxy\ProxyFactory,
29 29
     Doctrine\Common\Collections\ArrayCollection,
30 30
     Doctrine\Common\EventManager,
31  
-    Doctrine\ODM\MongoDB\Hydrator\HydratorFactory;
  31
+    Doctrine\ODM\MongoDB\Hydrator\HydratorFactory,
  32
+    Doctrine\Common\Persistence\ObjectManager;
32 33
 
33 34
 /**
34 35
  * The DocumentManager class is the central access point for managing the
@@ -45,7 +46,7 @@
45 46
  * @author      Jonathan H. Wage <jonwage@gmail.com>
46 47
  * @author      Roman Borschel <roman@code-factory.org>
47 48
  */
48  
-class DocumentManager
  49
+class DocumentManager implements ObjectManager
49 50
 {
50 51
     /**
51 52
      * The Doctrine MongoDB connection instance.
4  lib/Doctrine/ODM/MongoDB/DocumentRepository.php
@@ -20,6 +20,8 @@
20 20
 
21 21
 namespace Doctrine\ODM\MongoDB;
22 22
 
  23
+use Doctrine\Common\Persistence\ObjectRepository;
  24
+
23 25
 /**
24 26
  * An DocumentRepository serves as a repository for documents with generic as well as
25 27
  * business specific methods for retrieving documents.
@@ -33,7 +35,7 @@
33 35
  * @author      Jonathan H. Wage <jonwage@gmail.com>
34 36
  * @author      Roman Borschel <roman@code-factory.org>
35 37
  */
36  
-class DocumentRepository
  38
+class DocumentRepository implements ObjectRepository
37 39
 {
38 40
     /**
39 41
      * @var string
20  lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
@@ -52,6 +52,13 @@ class ClassMetadata extends ClassMetadataInfo
52 52
     public $reflFields = array();
53 53
 
54 54
     /**
  55
+     * The prototype from which new instances of the mapped class are created.
  56
+     *
  57
+     * @var object
  58
+     */
  59
+    private $prototype;
  60
+
  61
+    /**
55 62
      * Initializes a new ClassMetadata instance that will hold the object-document mapping
56 63
      * metadata of the class with the given name.
57 64
      *
@@ -178,4 +185,17 @@ public function __wakeup()
178 185
             $this->reflFields[$field] = $reflField;
179 186
         }
180 187
     }
  188
+
  189
+    /**
  190
+     * Creates a new instance of the mapped class, without invoking the constructor.
  191
+     *
  192
+     * @return object
  193
+     */
  194
+    public function newInstance()
  195
+    {
  196
+        if ($this->prototype === null) {
  197
+            $this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
  198
+        }
  199
+        return clone $this->prototype;
  200
+    }
181 201
 }
35  lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php
@@ -21,6 +21,7 @@
21 21
 
22 22
 use Doctrine\ODM\MongoDB\MongoDBException,
23 23
     Doctrine\ODM\MongoDB\LockException,
  24
+    Doctrine\Common\Persistence\Mapping\ClassMetadata,
24 25
     ReflectionClass;
25 26
 
26 27
 /**
@@ -43,7 +44,7 @@
43 44
  * @author      Jonathan H. Wage <jonwage@gmail.com>
44 45
  * @author      Roman Borschel <roman@code-factory.org>
45 46
  */
46  
-class ClassMetadataInfo
  47
+class ClassMetadataInfo implements ClassMetadata
47 48
 {
48 49
     /* The Id generator types. */
49 50
     /**
@@ -211,13 +212,6 @@ class ClassMetadataInfo
211 212
     public $reflFields = array();
212 213
 
213 214
     /**
214  
-     * The prototype from which new instances of the mapped class are created.
215  
-     *
216  
-     * @var object
217  
-     */
218  
-    private $prototype;
219  
-
220  
-    /**
221 215
      * READ-ONLY: The inheritance mapping type used by the class.
222 216
      *
223 217
      * @var integer
@@ -405,7 +399,7 @@ public function isIdentifier($fieldName)
405 399
      * INTERNAL:
406 400
      * Sets the mapped identifier field of this class.
407 401
      *
408  
-     * @param array $identifier
  402
+     * @param string $identifier
409 403
      */
410 404
     public function setIdentifier($identifier)
411 405
     {
@@ -413,6 +407,16 @@ public function setIdentifier($identifier)
413 407
     }
414 408
 
415 409
     /**
  410
+     * Gets the mapped identifier field of this class.
  411
+     *
  412
+     * @return string $identifier
  413
+     */
  414
+    public function getIdentifier()
  415
+    {
  416
+        return $this->identifier;
  417
+    }
  418
+
  419
+    /**
416 420
      * Checks whether the class has a (mapped) field with a certain name.
417 421
      *
418 422
      * @return boolean
@@ -1449,17 +1453,4 @@ public function setLockField($lockField)
1449 1453
     {
1450 1454
         $this->lockField = $lockField;
1451 1455
     }
1452  
-
1453  
-    /**
1454  
-     * Creates a new instance of the mapped class, without invoking the constructor.
1455  
-     *
1456  
-     * @return object
1457  
-     */
1458  
-    public function newInstance()
1459  
-    {
1460  
-        if ($this->prototype === null) {
1461  
-            $this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
1462  
-        }
1463  
-        return clone $this->prototype;
1464  
-    }
1465 1456
 }
2  lib/vendor/doctrine-common
... ...
@@ -1 +1 @@
1  
-Subproject commit ecc8c938500809e3677a3167ff5cadb303c8da67
  1
+Subproject commit 59e6b8c6edcb271622923035b687a063c2b47ce8

0 notes on commit 8d02e84

Please sign in to comment.
Something went wrong with that request. Please try again.