Skip to content

Commit ca95b0e

Browse files
committed
Merge branch '2.7' into 2.8.x
2 parents 4aa0986 + 20c4603 commit ca95b0e

File tree

20 files changed

+348
-254
lines changed

20 files changed

+348
-254
lines changed

UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Method `Doctrine\ORM\AbstractQuery#useResultCache()` which could be used for bot
1010
To optimize DB interaction, `Doctrine\ORM\Tools\Pagination\Paginator` no longer fetches identifiers to be able to
1111
perform the pagination with join collections when max results isn't set in the query.
1212

13+
## Minor BC BREAK: tables filtered with `schema_filter` are no longer created
14+
15+
When generating schema diffs, if a source table is filtered out by a `schema_filter` expression, then a `CREATE TABLE` was
16+
always generated, even if the table already existed. This has been changed in this release and the table will no longer
17+
be created.
18+
1319
## Deprecated number unaware `Doctrine\ORM\Mapping\UnderscoreNamingStrategy`
1420

1521
In the last patch of the `v2.6.x` series, we fixed a bug that was not converting names properly when they had numbers

build.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

build.properties.dev

Lines changed: 0 additions & 16 deletions
This file was deleted.

build.xml

Lines changed: 0 additions & 101 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"doctrine/event-manager": "^1.1",
2727
"doctrine/instantiator": "^1.3",
2828
"doctrine/persistence": "^1.2",
29+
"ocramius/package-versions": "^1.4",
2930
"symfony/console": "^3.0|^4.0|^5.0"
3031
},
3132
"require-dev": {

composer.lock

Lines changed: 53 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/en/reference/caching.rst

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,30 @@ This documentation does not cover every single cache driver included
4545
with Doctrine. For an up-to-date-list, see the
4646
`cache directory on GitHub <https://github.com/doctrine/cache/tree/master/lib/Doctrine/Common/Cache>`_.
4747

48-
APC
49-
~~~
50-
51-
In order to use the APC cache driver you must have it compiled and
52-
enabled in your php.ini. You can read about APC
53-
`in the PHP Documentation <http://us2.php.net/apc>`_. It will give
54-
you a little background information about what it is and how you
55-
can use it as well as how to install it.
56-
57-
Below is a simple example of how you could use the APC cache driver
58-
by itself.
59-
60-
.. code-block:: php
61-
62-
<?php
63-
$cacheDriver = new \Doctrine\Common\Cache\ApcCache();
64-
$cacheDriver->save('cache_id', 'my_data');
48+
PhpFileCache
49+
~~~~~~~~~~~~
6550

66-
APCu
67-
~~~~
51+
The preferred cache driver for metadata and query caches is ``PhpFileCache``.
52+
This driver serializes cache items and writes them to a file. This allows for
53+
opcode caching to be used and provides high performance in most scenarios.
6854

69-
In order to use the APCu cache driver you must have it compiled and
70-
enabled in your php.ini. You can read about APCu
71-
`in the PHP Documentation <http://us2.php.net/apcu>`_. It will give
72-
you a little background information about what it is and how you
73-
can use it as well as how to install it.
55+
In order to use the ``PhpFileCache`` driver it must be able to write to
56+
a directory.
7457

75-
Below is a simple example of how you could use the APCu cache driver
76-
by itself.
58+
Below is an example of how to use the ``PhpFileCache`` driver by itself.
7759

7860
.. code-block:: php
7961
8062
<?php
81-
$cacheDriver = new \Doctrine\Common\Cache\ApcuCache();
63+
$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache(
64+
'/path/to/writable/directory'
65+
);
8266
$cacheDriver->save('cache_id', 'my_data');
8367
68+
The PhpFileCache is not distributed across multiple machines if you are running
69+
your application in a distributed setup. This is ok for the metadata and query
70+
cache but is not a good approach for the result cache.
71+
8472
Memcache
8573
~~~~~~~~
8674

@@ -128,24 +116,6 @@ driver by itself.
128116
$cacheDriver->setMemcached($memcached);
129117
$cacheDriver->save('cache_id', 'my_data');
130118
131-
Xcache
132-
~~~~~~
133-
134-
In order to use the Xcache cache driver you must have it compiled
135-
and enabled in your php.ini. You can read about Xcache
136-
`here <http://xcache.lighttpd.net/>`_. It will give you a little
137-
background information about what it is and how you can use it as
138-
well as how to install it.
139-
140-
Below is a simple example of how you could use the Xcache cache
141-
driver by itself.
142-
143-
.. code-block:: php
144-
145-
<?php
146-
$cacheDriver = new \Doctrine\Common\Cache\XcacheCache();
147-
$cacheDriver->save('cache_id', 'my_data');
148-
149119
Redis
150120
~~~~~
151121

@@ -306,8 +276,11 @@ use on your ORM configuration.
306276
.. code-block:: php
307277
308278
<?php
279+
$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache(
280+
'/path/to/writable/directory'
281+
);
309282
$config = new \Doctrine\ORM\Configuration();
310-
$config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
283+
$config->setQueryCacheImpl($cacheDriver);
311284
312285
Result Cache
313286
~~~~~~~~~~~~
@@ -320,7 +293,11 @@ cache implementation.
320293
.. code-block:: php
321294
322295
<?php
323-
$config->setResultCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
296+
$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache(
297+
'/path/to/writable/directory'
298+
);
299+
$config = new \Doctrine\ORM\Configuration();
300+
$config->setResultCacheImpl($cacheDriver);
324301
325302
Now when you're executing DQL queries you can configure them to use
326303
the result cache.
@@ -337,7 +314,11 @@ result cache driver.
337314
.. code-block:: php
338315
339316
<?php
340-
$query->setResultCacheDriver(new \Doctrine\Common\Cache\ApcuCache());
317+
$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache(
318+
'/path/to/writable/directory'
319+
);
320+
$config = new \Doctrine\ORM\Configuration();
321+
$query->setResultCacheDriver($cacheDriver);
341322
342323
.. note::
343324

@@ -389,7 +370,11 @@ first.
389370
.. code-block:: php
390371
391372
<?php
392-
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
373+
$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache(
374+
'/path/to/writable/directory'
375+
);
376+
$config = new \Doctrine\ORM\Configuration();
377+
$config->setMetadataCacheImpl($cacheDriver);
393378
394379
Now the metadata information will only be parsed once and stored in
395380
the cache driver.
@@ -425,6 +410,12 @@ To clear the result cache use the ``orm:clear-cache:result`` task.
425410
All these tasks accept a ``--flush`` option to flush the entire
426411
contents of the cache instead of invalidating the entries.
427412

413+
.. note::
414+
415+
None of these tasks will work with APC, APCu, or XCache drivers
416+
because the memory that the cache is stored in is only accessible
417+
to the webserver.
418+
428419
Cache Chaining
429420
--------------
430421

lib/Doctrine/ORM/Query/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function getAST()
302302
*/
303303
public function match($token)
304304
{
305-
$lookaheadType = $this->lexer->lookahead['type'];
305+
$lookaheadType = $this->lexer->lookahead['type'] ?? null;
306306

307307
// Short-circuit on first condition, usually types match
308308
if ($lookaheadType === $token) {

0 commit comments

Comments
 (0)