Skip to content

Commit

Permalink
Merge branch 'master' of github.com:doctrine/doctrine2 into ValueObjects
Browse files Browse the repository at this point in the history
Conflicts:
	UPGRADE.md
	lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
  • Loading branch information
schmittjoh committed Jan 4, 2014
2 parents f7f7c46 + 69cad40 commit 4f585a3
Show file tree
Hide file tree
Showing 220 changed files with 19,339 additions and 804 deletions.
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ php:
- 5.3
- 5.4
- 5.5
- hhvm

env:
- DB=mysql
- DB=pgsql
- DB=sqlite
- DB=mysql ENABLE_SECOND_LEVEL_CACHE=1
- DB=pgsql ENABLE_SECOND_LEVEL_CACHE=1
- DB=sqlite ENABLE_SECOND_LEVEL_CACHE=1
- DB=mysql ENABLE_SECOND_LEVEL_CACHE=0
- DB=pgsql ENABLE_SECOND_LEVEL_CACHE=0
- DB=sqlite ENABLE_SECOND_LEVEL_CACHE=0

before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi"
Expand All @@ -18,7 +22,11 @@ before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
- composer install --prefer-dist --dev

script: phpunit --configuration tests/travis/$DB.travis.xml
script: phpunit -v --configuration tests/travis/$DB.travis.xml

after_script:
- php vendor/bin/coveralls -v

matrix:
allow_failures:
- php: hhvm
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ unified and future proof.

## We only accept PRs to "master"

Our branching strategy is summed up with "everything to master first", even
Our branching strategy is "everything to master first", even
bugfixes and we then merge them into the stable branches. You should only
open pull requests against the master branch. Otherwise we cannot accept the PR.

Expand All @@ -33,7 +33,7 @@ with some exceptions/differences:

## Unit-Tests

Always add a test for your pull-request.
Please try to add a test for your pull-request.

* If you want to fix a bug or provide a reproduce case, create a test file in
``tests/Doctrine/Tests/ORM/Functional/Ticket`` with the name of the ticket,
Expand All @@ -50,6 +50,12 @@ take a look at the ``tests/travis`` folder for some examples. Then run:

phpunit -c mysql.phpunit.xml

Tips for creating unittests:

1. If you put a test into the `Ticket` namespace as described above, put the testcase and all entities into the same class.
See `https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php` for an
example.

## Travis

We automatically run your pull request through [Travis CI](http://www.travis-ci.org)
Expand Down
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Doctrine 2 ORM

Master: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=master)](http://travis-ci.org/doctrine/doctrine2)
2.4: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.4)](http://travis-ci.org/doctrine/doctrine2)
2.3: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.3)](http://travis-ci.org/doctrine/doctrine2)
2.2: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.2)](http://travis-ci.org/doctrine/doctrine2)
2.1: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.1.x)](http://travis-ci.org/doctrine/doctrine2)
Expand Down
9 changes: 9 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
This method generates the column name for fields of embedded objects. If you implement your custom NamingStrategy, you
now also need to implement this new method.

## Updates on entities scheduled for deletion are no longer processed

In Doctrine 2.4, if you modified properties of an entity scheduled for deletion, UnitOfWork would
produce an UPDATE statement to be executed right before the DELETE statement. The entity in question
was therefore present in ``UnitOfWork#entityUpdates``, which means that ``preUpdate`` and ``postUpdate``
listeners were (quite pointlessly) called. In ``preFlush`` listeners, it used to be possible to undo
the scheduled deletion for updated entities (by calling ``persist()`` if the entity was found in both
``entityUpdates`` and ``entityDeletions``). This does not work any longer, because the entire changeset
calculation logic is optimized away.

# Upgrade to 2.4

Expand Down
363 changes: 363 additions & 0 deletions docs/LICENSE.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Advanced Topics

* :doc:`Architecture <reference/architecture>`
* :doc:`Advanced Configuration <reference/advanced-configuration>`
* :doc:`Limitations and knowns issues <reference/limitations-and-known-issues>`
* :doc:`Limitations and known issues <reference/limitations-and-known-issues>`
* :doc:`Commandline Tools <reference/tools>`
* :doc:`Transactions and Concurrency <reference/transactions-and-concurrency>`
* :doc:`Filters <reference/filters>`
Expand All @@ -78,6 +78,8 @@ Advanced Topics
* :doc:`Change Tracking Policies <reference/change-tracking-policies>`
* :doc:`Best Practices <reference/best-practices>`
* :doc:`Metadata Drivers <reference/metadata-drivers>`
* :doc:`Batch Processing <reference/batch-processing>`
* :doc:`Second Level Cache <reference/second-level-cache>`

Tutorials
---------
Expand Down
14 changes: 13 additions & 1 deletion docs/en/reference/annotations-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Index

- :ref:`@Column <annref_column>`
- :ref:`@ColumnResult <annref_column_result>`
- :ref:`@Cache <annref_cache>`
- :ref:`@ChangeTrackingPolicy <annref_changetrackingpolicy>`
- :ref:`@DiscriminatorColumn <annref_discriminatorcolumn>`
- :ref:`@DiscriminatorMap <annref_discriminatormap>`
Expand Down Expand Up @@ -152,6 +153,17 @@ Required attributes:

- **name**: The name of a column in the SELECT clause of a SQL query

.. _annref_cache:

@Cache
~~~~~~~~~~~~~~
Add caching strategy to a root entity or a collection.

Optional attributes:

- **usage**: One of ``READ_ONLY``, ``READ_READ_WRITE`` or ``NONSTRICT_READ_WRITE``, By default this is ``READ_ONLY``.
- **region**: An specific region name

.. _annref_changetrackingpolicy:

@ChangeTrackingPolicy
Expand Down Expand Up @@ -519,7 +531,7 @@ details of the database join table. If you do not specify
@JoinTable on these relations reasonable mapping defaults apply
using the affected table and the column names.

Required attributes:
Optional attributes:


- **name**: Database name of the join-table
Expand Down
13 changes: 7 additions & 6 deletions docs/en/reference/basic-mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ default.
length: 140
postedAt:
type: datetime
name: posted_at
column: posted_at
When we don't explicitly specify a column name via the ``name`` option, Doctrine
assumes the field name is also the column name. This means that:
Expand Down Expand Up @@ -340,15 +340,16 @@ Here is the list of possible generation strategies:

- ``AUTO`` (default): Tells Doctrine to pick the strategy that is
preferred by the used database platform. The preferred strategies
are IDENTITY for MySQL, SQLite and MsSQL and SEQUENCE for Oracle
and PostgreSQL. This strategy provides full portability.
are IDENTITY for MySQL, SQLite, MsSQL and SQL Anywhere and SEQUENCE
for Oracle and PostgreSQL. This strategy provides full portability.
- ``SEQUENCE``: Tells Doctrine to use a database sequence for ID
generation. This strategy does currently not provide full
portability. Sequences are supported by Oracle and PostgreSql.
portability. Sequences are supported by Oracle, PostgreSql and
SQL Anywhere.
- ``IDENTITY``: Tells Doctrine to use special identity columns in
the database that generate a value on insertion of a row. This
strategy does currently not provide full portability and is
supported by the following platforms: MySQL/SQLite
supported by the following platforms: MySQL/SQLite/SQL Anywhere
(AUTO\_INCREMENT), MSSQL (IDENTITY) and PostgreSQL (SERIAL).
- ``TABLE``: Tells Doctrine to use a separate table for ID
generation. This strategy provides full portability.
Expand Down Expand Up @@ -391,7 +392,7 @@ besides specifying the sequence's name:
</id>
</entity>
</doctrine-mapping>
.. code-block:: yaml
Message:
Expand Down
27 changes: 26 additions & 1 deletion docs/en/reference/caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Memcache

In order to use the Memcache cache driver you must have it compiled
and enabled in your php.ini. You can read about Memcache
` on the PHP website <http://us2.php.net/memcache>`_. It will
` on the PHP website <http://php.net/memcache>`_. It will
give you a little background information about what it is and how
you can use it as well as how to install it.

Expand All @@ -82,6 +82,31 @@ driver by itself.
$cacheDriver->setMemcache($memcache);
$cacheDriver->save('cache_id', 'my_data');
Memcached
~~~~~~~~

Memcached is a more recent and complete alternative extension to
Memcache.

In order to use the Memcached cache driver you must have it compiled
and enabled in your php.ini. You can read about Memcached
` on the PHP website <http://php.net/memcached>`_. It will
give you a little background information about what it is and how
you can use it as well as how to install it.

Below is a simple example of how you could use the Memcached cache
driver by itself.

.. code-block:: php
<?php
$memcached = new Memcached();
$memcached->addServer('memcache_host', 11211);
$cacheDriver = new \Doctrine\Common\Cache\MemcachedCache();
$cacheDriver->setMemcached($memcached);
$cacheDriver->save('cache_id', 'my_data');
Xcache
~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions docs/en/reference/dql-doctrine-query-language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,9 @@ Given that there are 10 users and corresponding addresses in the database the ex
SELECT * FROM users;
SELECT * FROM address WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
.. note::
Changing the fetch mode during a query is only possible for one-to-one and many-to-one relations.


EBNF
----
Expand Down
19 changes: 19 additions & 0 deletions docs/en/reference/inheritance-mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,22 @@ Things to note:
- The "attribute override" specifies the overrides base on the property name.
- The column type *CANNOT* be changed. if the column type is not equals you got a ``MappingException``
- The override can redefine all the column except the type.

Query the Type
--------------

It may happen that the entities of a special type should be queried. Because there
is no direct access to the discriminator column, Doctrine provides the
``INSTANCE OF`` construct.

The following example shows how to use ``INSTANCE OF``. There is a three level hierarchy
with a base entity ``NaturalPerson`` which is extended by ``Staff`` which in turn
is extended by ``Technician``.

Querying for the staffs without getting any technicians can be achieved by this DQL:

.. code-block:: php
<?php
$query = $em->createQuery("SELECT staff FROM MyProject\Model\Staff staff WHERE staff INSTANCE OF MyProject\Model\Staff");
$staffs = $query->getResult();
Loading

0 comments on commit 4f585a3

Please sign in to comment.