Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0] Remove deprecated annotations #1471

Merged
merged 4 commits into from
Jan 15, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Reflect changes in the documentation
  • Loading branch information
malarzm committed Jan 15, 2017
commit 580eced657e4c687a1eaddd812230f44e1a9e562
306 changes: 0 additions & 306 deletions docs/en/reference/annotations-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,156 +38,6 @@ will be invoked with the first value found as its single argument.
For additional information on using `@AlsoLoad`_, see
:doc:`Migrations <migrating-schemas>`.

@Bin
----

Alias of `@Field`_, with "type" attribute set to "bin". Converts value to
`MongoBinData`_ with ``MongoBinData::GENERIC`` sub-type.

.. code-block:: php

<?php

/** @Bin */
private $data;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bin".

@BinCustom
----------

Alias of `@Field`_, with "type" attribute set to "bin\_custom". Converts
value to `MongoBinData`_ with ``MongoBinData::CUSTOM`` sub-type.

.. code-block:: php

<?php

/** @BinCustom */
private $data;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bin\_custom".

@BinFunc
--------

Alias of `@Field`_, with "type" attribute set to "bin\_func". Converts value to
`MongoBinData`_ with ``MongoBinData::FUNC`` sub-type.

.. code-block:: php

<?php

/** @BinFunc */
private $data;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bin\_func".

@BinMD5
-------

Alias of `@Field`_, with "type" attribute set to "bin\_md5". Converts value to
`MongoBinData`_ with ``MongoBinData::MD5`` sub-type.

.. code-block:: php

<?php

/** @BinMD5 */
private $password;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bin\_md5".

@BinUUID
--------

Alias of `@Field`_, with "type" attribute set to "bin\_uuid". Converts value to
`MongoBinData`_ with ``MongoBinData::UUID`` sub-type.

.. code-block:: php

<?php

/** @BinUUID */
private $uuid;

.. note::

Per the `BSON specification`_, this sub-type is deprecated in favor of the
RFC 4122 UUID sub-type. Consider using `@BinUUIDRFC4122`_ instead.

@BinUUIDRFC4122
---------------

Alias of `@Field`_, with "type" attribute set to "bin\_uuid\_rfc4122". Converts
value to `MongoBinData`_ with ``MongoBinData::UUID_RFC4122`` sub-type.

.. code-block:: php

<?php

/** @BinUUIDRFC4122 */
private $uuid;

.. note::

RFC 4122 UUIDs must be 16 bytes. The PHP driver will throw an exception if
the binary data's size is invalid.

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bin\_uuid\_rfc4122".

@Bool
-----

Alias of `@Field`_, with "type" attribute set to "bool". Internally it uses
exactly same logic as `@Boolean`_ annotation and "boolean" type.

.. code-block:: php

<?php

/** @Bool */
private $active;

.. note::

This annotation is deprecated because it uses a keyword that was reserved in
PHP 7. It will be removed in ODM 2.0. Please use the `@Field`_ annotation
with type "bool".


@Boolean
--------

Alias of `@Field`_, with "type" attribute set to "boolean".

.. code-block:: php

<?php

/** @Boolean */
private $active;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "bool".

@ChangeTrackingPolicy
---------------------

Expand All @@ -208,44 +58,6 @@ This annotation is used to change the change tracking policy for a document:

For a list of available policies, read the section on :ref:`change tracking policies <change_tracking_policies>`.


@Collection
-----------

Alias of `@Field`_, with "type" attribute set to "collection". Stores and
retrieves the value as a numerically indexed array.

.. code-block:: php

<?php

/** @Collection */
private $tags = array();

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "collection".

@Date
-----

Alias of `@Field`_, with "type" attribute set to "date". Values of any type
(e.g. integer, string, DateTime) will be converted to `MongoDate`_ for storage
in MongoDB. The property will be a DateTime when loaded from the database.

.. code-block:: php

<?php

/** @Date */
private $createdAt;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "date".

@DefaultDiscriminatorValue
--------------------------

Expand Down Expand Up @@ -656,18 +468,6 @@ that created the file.
/** @ReferenceOne(targetDocument="Documents\User") */
private $uploadedBy;

@Float
------

Alias of `@Field`_, with "type" attribute set to "float".

.. note::

This annotation is deprecated because it uses a keyword that was reserved in
PHP 7. It will be removed in ODM 2.0. Please use the `@Field`_ annotation
with type "float".


.. _haslifecyclecallbacks:

@HasLifecycleCallbacks
Expand All @@ -690,17 +490,6 @@ annotation will cause Doctrine to ignore the callbacks.
public function sendWelcomeEmail() {}
}

@Hash
-----

Alias of `@Field`_, with "type" attribute set to "hash". Stores and retrieves
the value as an associative array.

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "hash".

@Id
---

Expand Down Expand Up @@ -824,59 +613,6 @@ Examples:
// ...
}

@Int
----

Alias of `@Field`_, with "type" attribute set to "int".

.. code-block:: php

<?php

/** @Int */
private $columns;

.. note::

This annotation is deprecated because it uses a keyword that was reserved in
PHP 7. It will be removed in ODM 2.0. Please use the `@Field`_ annotation
with type "int".

@Integer
--------

Alias of `@Field`_, with "type" attribute set to "integer". Internally it uses
exactly same logic as `@Int`_ annotation and "int" type.

.. code-block:: php

<?php

/** @Integer */
private $columns;

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "int".

@Key
----

Alias of `@Field`_, with "type" attribute set to "key". The value will be
converted to `MongoMaxKey`_ or `MongoMinKey`_ if it is true or false,
respectively.

.. note::

The BSON MaxKey and MinKey types are internally used by MongoDB for indexing
and sharding. There is generally no reason to use these in an application.

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "key".

@MappedSuperclass
-----------------

Expand Down Expand Up @@ -1285,43 +1021,6 @@ for sharding the document collection.
//...
}


@String
-------

Alias of `@Field`_, with "type" attribute set to "string".

.. code-block:: php

<?php

/** @String */
private $username;

.. note::

This annotation is deprecated because it uses a keyword that was reserved in
PHP 7. It will be removed in ODM 2.0. Please use the `@Field`_ annotation
with type "string".


@Timestamp
----------

Alias of `@Field`_, with "type" attribute set to "timestamp". The value will be
converted to `MongoTimestamp`_ for storage in MongoDB.

.. note::

The BSON timestamp type is an internal type used for MongoDB's replication
and sharding. If you need to store dates in your application, you should use
the "date" type instead.

.. note::

This annotation is deprecated and will be removed in ODM 2.0. Please use the
`@Field`_ annotation with type "timestamp".

@UniqueIndex
------------

Expand Down Expand Up @@ -1362,12 +1061,7 @@ versioned document.
.. _DBRef: https://docs.mongodb.com/manual/reference/database-references/#dbrefs
.. _geoNear command: https://docs.mongodb.com/manual/reference/command/geoNear/
.. _GridFS: https://docs.mongodb.com/manual/core/gridfs/
.. _MongoBinData: http://php.net/manual/en/class.mongobindata.php
.. _MongoDate: http://php.net/manual/en/class.mongodate.php
.. _MongoGridFSFile: http://php.net/manual/en/class.mongogridfsfile.php
.. _MongoId: http://php.net/manual/en/class.mongoid.php
.. _MongoMaxKey: http://php.net/manual/en/class.mongomaxkey.php
.. _MongoMinKey: http://php.net/manual/en/class.mongominkey.php
.. _MongoTimestamp: http://php.net/manual/en/class.mongotimestamp.php
.. |FQCN| raw:: html
<abbr title="Fully-Qualified Class Name">FQCN</abbr>
11 changes: 8 additions & 3 deletions docs/en/reference/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,15 @@ more paths) and register the annotations for the driver:

<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

// ...

$config->setMetadataDriverImpl(AnnotationDriver::create(__DIR__ . '/Documents'));

AnnotationDriver::registerAnnotationClasses();
$loader = require_once('path/to/vendor/autoload.php');

AnnotationRegistry::registerLoader([$loader, 'loadClass']);

At this point, we have everything necessary to construct a ``DocumentManager``:

Expand All @@ -429,6 +433,7 @@ The final ``bootstrap.php`` file should look like this:

<?php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\MongoDB\Connection;
use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
Expand All @@ -441,6 +446,8 @@ The final ``bootstrap.php`` file should look like this:
$loader = require_once $file;
$loader->add('Documents', __DIR__);

AnnotationRegistry::registerLoader([$loader, 'loadClass']);

$connection = new Connection();

$config = new Configuration();
Expand All @@ -451,8 +458,6 @@ The final ``bootstrap.php`` file should look like this:
$config->setDefaultDB('doctrine_odm');
$config->setMetadataDriverImpl(AnnotationDriver::create(__DIR__ . '/Documents'));

AnnotationDriver::registerAnnotationClasses();

$dm = DocumentManager::create($connection, $config);

That is it! Your ``DocumentManager`` instance is ready to be used!
Expand Down
Loading