Create DocumentManager::isOpen() accessor for $closed property

This provides a more consistent interface when dealing with various ObjectManagers.
Merge pull request #603
Fix preparation of trailing positional operator in query field
Merge pull request #661 from doctrine/prepare-positional-op

Fix preparation of trailing positional operator in query field
avoid file write race condition at generating Proxy and Hydrator classes
Make HydratorException and ProxyException classes consistent
Merge pull request #662
Fix major bug. Ensure filters always filter
cs fixes
Add query criteria merge function
Correct test names
Change to 5.3 array syntax
Add new critiera merging to FilterCollection
Revise BsonFilter docs/signature and corresponding test Filter
CriteriaMerger should combine criteria as $and clauses

Filter, mapping, reference, and userland query criteria is now combined as $and clauses. Conflicting criteria will not overwrite anything, so you are more likely to get no results rather than inadvertently circumvent a filter or mapping criteria.

CriteriaMerger::merge() is no longer static, so the CriteriaMerger object can be injected into FilterCollection or DocumentPersister (defaults to a new object of the base class).

GH596Test needed to be updated, among others, to expect the new prepared format.
Filter criteria should always be merged after discriminator criteria

Since merging of filter criteria may result in the original query being wrapped in "$and", the logic in addDiscriminatorToPreparedQuery() can not easily check whether the discriminator field is present in the original query. This can be mitigated by applying discriminator criteria before filter criteria.
Fix preparation of logical clauses and operators w/o typed args

DocumentPersister::prepareQueryOrNewObj() should not recurse on the array of clauses for logical operators, but rather the individual clauses.

Additionally, prepareQueryElement() should not perform identifier conversions for query operators whose arguments need no conversion (e.g. $exists). Other operators, such as $in, should still have their arguments prepared as identifier values.
Merge pull request #667
Introduced resolve target document listener
Test case: resolve target document listener