Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First milestone reworking annotations for CouchDB

  • Loading branch information...
commit 9d8ae973cf1779a32dac795b0c16ba4e1d5d106c 1 parent 0205d37
@beberlei beberlei authored
Showing with 453 additions and 119 deletions.
  1. +2 −2 lib/Doctrine/ODM/CouchDB/Configuration.php
  2. +29 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Attachments.php
  3. +32 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Document.php
  4. +31 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbedMany.php
  5. +31 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbedOne.php
  6. +30 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbeddedDocument.php
  7. +31 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Field.php
  8. +32 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Id.php
  9. +30 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Index.php
  10. +27 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/MappedSuperclass.php
  11. +30 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Reference.php
  12. +31 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/ReferenceMany.php
  13. +30 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/ReferenceOne.php
  14. +31 −0 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Version.php
  15. +10 −13 lib/Doctrine/ODM/CouchDB/Mapping/Driver/AnnotationDriver.php
  16. +0 −85 lib/Doctrine/ODM/CouchDB/Mapping/Driver/DoctrineAnnotations.php
  17. +1 −1  lib/vendor/doctrine-common
  18. +24 −0 phpunit.xml.dist
  19. +4 −4 tests/Doctrine/Tests/Models/CMS/CmsAddress.php
  20. +2 −2 tests/Doctrine/Tests/Models/CMS/CmsArticle.php
  21. +1 −1  tests/Doctrine/Tests/Models/CMS/CmsGroup.php
  22. +3 −3 tests/Doctrine/Tests/Models/CMS/CmsUser.php
  23. +2 −2 tests/Doctrine/Tests/ODM/CouchDB/CouchDBFunctionalTestCase.php
  24. +2 −2 tests/Doctrine/Tests/ODM/CouchDB/Functional/BasicCrudTest.php
  25. +4 −3 tests/Doctrine/Tests/ODM/CouchDB/Mapping/AnnotationDriverTest.php
  26. +3 −1 tests/TestInit.php
View
4 lib/Doctrine/ODM/CouchDB/Configuration.php
@@ -160,8 +160,8 @@ public function setMetadataDriverImpl(Driver $driverImpl)
*/
public function newDefaultAnnotationDriver($paths = array())
{
- $reader = new \Doctrine\Common\Annotations\AnnotationReader();
- $reader->setDefaultAnnotationNamespace('Doctrine\ODM\CouchDB\Mapping\\');
+ $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
+ $reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations\\');
return new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader, (array) $paths);
}
View
29 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Attachments.php
@@ -0,0 +1,29 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class Attachments extends Reference
+{
+}
View
32 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Document.php
@@ -0,0 +1,32 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class Document extends Annotation
+{
+ public $type;
+ public $repositoryClass;
+ public $indexed = false;
+}
View
31 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbedMany.php
@@ -0,0 +1,31 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class EmbedMany extends Reference
+{
+ public $jsonName;
+ public $embedded = 'many';
+}
View
31 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbedOne.php
@@ -0,0 +1,31 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class EmbedOne extends Reference
+{
+ public $jsonName;
+ public $embedded = 'one';
+}
View
30 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/EmbeddedDocument.php
@@ -0,0 +1,30 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class EmbeddedDocument extends Annotation
+{
+ public $readOnly = false;
+}
View
31 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Field.php
@@ -0,0 +1,31 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+class Field extends Annotation
+{
+ public $jsonName;
+ public $type = 'mixed';
+}
View
32 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Id.php
@@ -0,0 +1,32 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class Id extends Field
+{
+ public $id = true;
+ public $type = 'string';
+ public $strategy = 'UUID';
+}
View
30 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Index.php
@@ -0,0 +1,30 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class Index extends Annotation
+{
+
+}
View
27 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/MappedSuperclass.php
@@ -0,0 +1,27 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class MappedSuperclass extends Annotation {}
View
30 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Reference.php
@@ -0,0 +1,30 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+class Reference extends Annotation
+{
+ public $targetDocument;
+}
View
31 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/ReferenceMany.php
@@ -0,0 +1,31 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class ReferenceMany extends Reference
+{
+ public $cascade = array();
+ public $mappedBy;
+}
View
30 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/ReferenceOne.php
@@ -0,0 +1,30 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class ReferenceOne extends Reference
+{
+ public $cascade = array();
+}
View
31 lib/Doctrine/ODM/CouchDB/Mapping/Annotations/Version.php
@@ -0,0 +1,31 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\ODM\CouchDB\Mapping\Annotations;
+
+use Doctrine\Common\Annotations\Annotation;
+
+/**
+ * @Annotation
+ */
+final class Version extends Field
+{
+ public $type = 'string';
+ public $jsonName = '_rev';
+}
View
23 lib/Doctrine/ODM/CouchDB/Mapping/Driver/AnnotationDriver.php
@@ -20,12 +20,9 @@
namespace Doctrine\ODM\CouchDB\Mapping\Driver;
use Doctrine\ODM\CouchDB\Mapping\ClassMetadata,
- Doctrine\Common\Annotations\AnnotationReader,
+ Doctrine\Common\Annotations\Reader,
Doctrine\ODM\CouchDB\Mapping\MappingException;
-// TODO: this is kinda ugly
-require __DIR__ . '/DoctrineAnnotations.php';
-
/**
* The AnnotationDriver reads the mapping metadata from docblock annotations.
*
@@ -70,7 +67,7 @@ class AnnotationDriver implements Driver
* @param $reader The AnnotationReader to use.
* @param string|array $paths One or multiple paths where mapping classes can be found.
*/
- public function __construct(AnnotationReader $reader, $paths = null)
+ public function __construct(Reader $reader, $paths = null)
{
$this->reader = $reader;
if ($paths) {
@@ -106,17 +103,17 @@ public function loadMetadataForClass($className, ClassMetadata $class)
$reflClass = $class->getReflectionClass();
$classAnnotations = $this->reader->getClassAnnotations($reflClass);
- if (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Document'])) {
- $documentAnnot = $classAnnotations['Doctrine\ODM\CouchDB\Mapping\Document'];
+ if (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\Document'])) {
+ $documentAnnot = $classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\Document'];
if ($documentAnnot->indexed) {
$class->indexed = true;
}
$class->setCustomRepositoryClass($documentAnnot->repositoryClass);
- } elseif (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\EmbeddedDocument'])) {
- $documentAnnot = $classAnnotations['Doctrine\ODM\CouchDB\Mapping\EmbeddedDocument'];
+ } elseif (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\EmbeddedDocument'])) {
+ $documentAnnot = $classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\EmbeddedDocument'];
$class->isEmbeddedDocument = true;
- } else if (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\MappedSuperclass'])) {
+ } else if (isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\MappedSuperclass'])) {
$class->isMappedSuperclass = true;
} else {
throw MappingException::classIsNotAValidDocument($className);
@@ -180,9 +177,9 @@ public function isTransient($className)
{
$classAnnotations = $this->reader->getClassAnnotations(new \ReflectionClass($className));
- return ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Document']) &&
- ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\MappedSuperclass']) &&
- ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\EmbeddedDocument']);
+ return ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\Document']) &&
+ ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\MappedSuperclass']) &&
+ ! isset($classAnnotations['Doctrine\ODM\CouchDB\Mapping\Annotations\EmbeddedDocument']);
}
/**
View
85 lib/Doctrine/ODM/CouchDB/Mapping/Driver/DoctrineAnnotations.php
@@ -1,85 +0,0 @@
-<?php
-
-namespace Doctrine\ODM\CouchDB\Mapping;
-
-use Doctrine\Common\Annotations\Annotation;
-
-final class Document extends Annotation
-{
- public $type;
- public $repositoryClass;
- public $indexed = false;
-}
-final class EmbeddedDocument extends Annotation
-{
- public $readOnly = false;
-}
-final class MappedSuperclass extends Annotation {}
-
-class Field extends Annotation
-{
- public $jsonName;
- public $type = 'mixed';
- public $indexed = false;
-}
-final class Id extends Field
-{
- public $id = true;
- public $type = 'string';
- public $strategy = 'UUID';
-}
-final class Version extends Field
-{
- public $type = 'string';
- public $jsonName = '_rev';
-}
-final class Boolean extends Field
-{
- public $type = 'boolean';
-}
-final class Int extends Field
-{
- public $type = 'int';
-}
-final class Float extends Field
-{
- public $type = 'float';
-}
-final class String extends Field
-{
- public $type = 'string';
-}
-final class Date extends Field
-{
- public $type = 'date';
-}
-final class ArrayField extends Field
-{
- public $type = 'array';
-}
-class Reference extends Annotation
-{
- public $targetDocument;
-}
-final class EmbedOne extends Reference
-{
- public $jsonName;
- public $embedded = 'one';
-}
-final class EmbedMany extends Reference
-{
- public $jsonName;
- public $embedded = 'many';
-}
-final class ReferenceOne extends Reference
-{
- public $cascade = array();
-}
-final class ReferenceMany extends Reference
-{
- public $cascade = array();
- public $mappedBy;
-}
-final class Attachments extends Reference
-{
-}
2  lib/vendor/doctrine-common
@@ -1 +1 @@
-Subproject commit 5f32048c8280eb33e43d73ae1e602f41359ec101
+Subproject commit b3b1e62b1c155beab0ca8c424e1cd70a54530a4d
View
24 phpunit.xml.dist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="false"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="./tests/TestInit.php"
+>
+ <php>
+ <var name="DOCTRINE_COUCHDB_DATABASE" value="doctrine_test_database" />
+ <var name="DOCTRINE_COUCHDB_CLIENT" value="Doctrine\CouchDB\HTTP\SocketClient" />
+ <var name="DOCTRINE_COUCHDB_PERFORMANCE_COUNT" value="3000" />
+ </php>
+
+ <testsuites>
+ <testsuite name="Doctrine ODM CouchDB Test Suite">
+ <directory>./tests/Doctrine/</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
View
8 tests/Doctrine/Tests/Models/CMS/CmsAddress.php
@@ -9,13 +9,13 @@ class CmsAddress
{
/** @ No Id for embedded */
public $id;
- /** @String */
+ /** @Field(type="string") */
public $country;
- /** @String */
+ /** @Field(type="string") */
public $zip;
- /** @String */
+ /** @Field(type="string") */
public $city;
- /** @String */
+ /** @Field(type="string") */
public $street;
public function getId() {
View
4 tests/Doctrine/Tests/Models/CMS/CmsArticle.php
@@ -9,9 +9,9 @@ class CmsArticle
{
/** @Id */
public $id;
- /** @String */
+ /** @Field(type="string") */
public $topic;
- /** @String */
+ /** @Field(type="string") */
public $text;
/** @ReferenceOne(targetDocument="CmsUser") */
public $user;
View
2  tests/Doctrine/Tests/Models/CMS/CmsGroup.php
@@ -13,7 +13,7 @@ class CmsGroup
{
/** @Id */
public $id;
- /** @String */
+ /** @Field(type="string") */
public $name;
/** @ReferenceMany(targetDocument="CmsUser", mappedBy="groups") */
View
6 tests/Doctrine/Tests/Models/CMS/CmsUser.php
@@ -11,11 +11,11 @@ class CmsUser
{
/** @Id */
public $id;
- /** @String(indexed=true) */
+ /** @Field(type="string")(indexed=true) */
public $status;
- /** @String(indexed=true) */
+ /** @Field(type="string")(indexed=true) */
public $username;
- /** @String(indexed=true) */
+ /** @Field(type="string")(indexed=true) */
public $name;
/** @EmbedOne */
View
4 tests/Doctrine/Tests/ODM/CouchDB/CouchDBFunctionalTestCase.php
@@ -48,8 +48,8 @@ public function createDocumentManager()
$httpClient->request('DELETE', '/' . $database);
$resp = $httpClient->request('PUT', '/' . $database);
- $reader = new AnnotationReader();
- $reader->setDefaultAnnotationNamespace('Doctrine\ODM\CouchDB\Mapping\\');
+ $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
+ $reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations\\');
$paths = __DIR__ . "/../../Models";
$metaDriver = new AnnotationDriver($reader, $paths);
View
4 tests/Doctrine/Tests/ODM/CouchDB/Functional/BasicCrudTest.php
@@ -199,7 +199,7 @@ class User
{
/** @Id(strategy="ASSIGNED") */
public $id;
- /** @String */
+ /** @Field(type="string") */
public $username;
}
@@ -210,6 +210,6 @@ class User2
{
/** @Id(strategy="ASSIGNED") */
public $id;
- /** @String */
+ /** @Field(type="string") */
public $username;
}
View
7 tests/Doctrine/Tests/ODM/CouchDB/Mapping/AnnotationDriverTest.php
@@ -9,7 +9,8 @@ class AnnotationDriverTest extends AbstractMappingDriverTest
public function testLoadMetadataForNonDocumentThrowsException()
{
$cm = new ClassMetadata('stdClass');
- $reader = new \Doctrine\Common\Annotations\AnnotationReader(new \Doctrine\Common\Cache\ArrayCache());
+ $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
+ $reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations\\');
$annotationDriver = new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader);
$this->setExpectedException('Doctrine\ODM\CouchDB\Mapping\MappingException');
@@ -59,8 +60,8 @@ protected function loadDriverForCMSDocuments()
protected function loadDriver()
{
$cache = new \Doctrine\Common\Cache\ArrayCache();
- $reader = new \Doctrine\Common\Annotations\AnnotationReader($cache);
- $reader->setDefaultAnnotationNamespace('Doctrine\ODM\CouchDB\Mapping\\');
+ $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
+ $reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations\\');
return new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader);
}
View
4 tests/TestInit.php
@@ -20,4 +20,6 @@
$classLoader->register();
$classLoader = new ClassLoader('Symfony\Component', __DIR__ . '/../lib/vendor');
-$classLoader->register();
+$classLoader->register();
+
+Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations');
Please sign in to comment.
Something went wrong with that request. Please try again.