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

compatibility with doctrine/common 3.x and doctrine/persistence 2.x #334

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor
tests/mysql.local.neon
composer.lock
vendor
tests/mysql.local.neon
composer.lock
/nbproject/private/
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ addons:
- mysql

php:
- 7.1
- 7.2
- 7.3

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"issues": "https://github.com/kdyby/doctrine/issues"
},
"require": {
"php": "^7.1",
"php": "^7.2",
"doctrine/orm": "~2.7",
"doctrine/dbal": "~2.9",
"doctrine/dbal": "~2.10",
"doctrine/common": "^3.0",
"doctrine/persistence": "^2.0",
"kdyby/console": "^2.7.1",
"kdyby/annotations": "^3.0",
"kdyby/doctrine-cache": "^3.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/en/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Metadata drivers
There are several shortcuts for the driver implementations

- `annotations` for `Kdyby\Doctrine\Mapping\AnnotationDriver`
- `static` for `Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver`
- `static` for `Doctrine\Persistence\Mapping\Driver\StaticPHPDriver`
- `yaml` for `Doctrine\ORM\Mapping\Driver\YamlDriver`
- `xml` for `Doctrine\ORM\Mapping\Driver\XmlDriver`
- `db` for `Doctrine\ORM\Mapping\Driver\DatabaseDriver`
Expand Down
3 changes: 2 additions & 1 deletion src/Kdyby/Doctrine/Console/DbalDelegateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ protected function wrapCommand($connectionName)
*/
protected function configure()
{

$this->command = $this->createCommand();

$this->setName($this->command->getName());
$this->setHelp($this->command->getHelp());
$this->setDefinition($this->command->getDefinition());
$this->setDescription($this->command->getDescription());

$this->getDefinition()->setOptions([]);
$this->addOption('connection', NULL, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
}

Expand Down
8 changes: 4 additions & 4 deletions src/Kdyby/Doctrine/DI/OrmExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class OrmExtension extends Nette\DI\CompilerExtension
*/
public $metadataDriverClasses = [
self::ANNOTATION_DRIVER => Doctrine\ORM\Mapping\Driver\AnnotationDriver::class,
'static' => Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver::class,
'static' => Doctrine\Persistence\Mapping\Driver\StaticPHPDriver::class,
'yml' => Doctrine\ORM\Mapping\Driver\YamlDriver::class,
'yaml' => Doctrine\ORM\Mapping\Driver\YamlDriver::class,
'xml' => Doctrine\ORM\Mapping\Driver\XmlDriver::class,
Expand Down Expand Up @@ -243,7 +243,7 @@ protected function processEntityManager($name, array $defaults)
}

$metadataDriver = $builder->addDefinition($this->prefix($name . '.metadataDriver'))
->setClass(Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain::class)
->setClass(Doctrine\Persistence\Mapping\Driver\MappingDriverChain::class)
->setAutowired(FALSE);
/** @var \Nette\DI\ServiceDefinition $metadataDriver */

Expand Down Expand Up @@ -618,7 +618,7 @@ protected function processMetadataDriver(Nette\DI\ServiceDefinition $metadataDri
$serviceName = $this->prefix($prefix . '.driver.' . str_replace('\\', '_', $namespace) . '.' . str_replace('\\', '_', $impl) . 'Impl');

$this->getContainerBuilder()->addDefinition($serviceName)
->setClass(Doctrine\Common\Persistence\Mapping\Driver\MappingDriver::class)
->setClass(Doctrine\Persistence\Mapping\Driver\MappingDriver::class)
->setFactory($driver->getEntity(), $driver->arguments)
->setAutowired(FALSE);

Expand Down Expand Up @@ -853,7 +853,7 @@ private function isKdybyEventsPresent()
private function addCollapsePathsToTracy(Method $init)
{
$blueScreen = \Tracy\Debugger::class . '::getBlueScreen()';
$commonDirname = dirname(Nette\Reflection\ClassType::from(Doctrine\Common\Version::class)->getFileName());
$commonDirname = dirname(Nette\Reflection\ClassType::from(\Doctrine\ORM\Version::class)->getFileName());

$init->addBody($blueScreen . '->collapsePaths[] = ?;', [dirname(Nette\Reflection\ClassType::from(Kdyby\Doctrine\Exception::class)->getFileName())]);
$init->addBody($blueScreen . '->collapsePaths[] = ?;', [dirname(dirname(dirname(dirname($commonDirname))))]); // this should be vendor/doctrine
Expand Down
4 changes: 2 additions & 2 deletions src/Kdyby/Doctrine/Diagnostics/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Persistence\Proxy;
use Doctrine\Persistence\Proxy;
use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
Expand Down Expand Up @@ -97,7 +97,7 @@ public function startQuery($sql, array $params = NULL, array $types = NULL)
foreach (debug_backtrace(FALSE) as $row) {
if (isset($row['file']) && $this->filterTracePaths(realpath($row['file']))) {
if (isset($row['class']) && stripos($row['class'], '\\' . Proxy::MARKER) !== FALSE) {
if (!in_array(Doctrine\Common\Persistence\Proxy::class, class_implements($row['class']))) {
if (!in_array(Doctrine\Persistence\Proxy::class, class_implements($row['class']))) {
continue;

} elseif (isset($row['function']) && $row['function'] === '__load') {
Expand Down
2 changes: 1 addition & 1 deletion src/Kdyby/Doctrine/Mapping/RuntimeReflectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* @author Filip Procházka <[email protected]>
*/
class RuntimeReflectionService extends Doctrine\Common\Persistence\Mapping\RuntimeReflectionService
class RuntimeReflectionService extends Doctrine\Persistence\Mapping\RuntimeReflectionService
{

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Kdyby/Doctrine/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Kdyby\Doctrine;

use Doctrine\Common\Persistence\AbstractManagerRegistry;
use Doctrine\Persistence\AbstractManagerRegistry;
use Doctrine\ORM\ORMException;
use Kdyby;
use Nette;
Expand Down