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 upgrade #340

Open
wants to merge 23 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
20 changes: 9 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ addons:
- mysql

php:
- 7.1
- 7.2
- 7.3
- 7.4

env:
- # dev
Expand All @@ -26,31 +24,31 @@ env:
matrix:
fast_finish: true
include:
- php: 7.3
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-stable" COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.3
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-stable" PHPSTAN=1
exclude:
- php: 7.3
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-stable"
allow_failures:
- env:
- php: 7.3
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-stable" COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"

install:
- if [ "$PHPSTAN" = "1" ]; then composer require --dev --no-update phpstan/phpstan-shim:^0.9; fi
# - if [ "$PHPSTAN" = "1" ]; then composer require --dev --no-update phpstan/phpstan-shim:^0.9; fi
- travis_retry composer update --no-interaction --no-suggest --no-progress --prefer-dist $COMPOSER_EXTRA_ARGS
- travis_retry composer create-project --no-interaction jakub-onderka/php-parallel-lint /tmp/php-parallel-lint
# - travis_retry composer create-project --no-interaction php-parallel-lint/PHP-Parallel-Lint /tmp/php-parallel-lint
# - travis_retry composer create-project --no-interaction kdyby/code-checker /tmp/code-checker
- if [ "$COVERAGE" != "" ]; then travis_retry wget -O /tmp/coveralls.phar https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; fi

script:
- vendor/bin/tester $COVERAGE -s -p ${TESTER_RUNTIME:-php} -c ./tests/php.ini-unix ./tests/KdybyTests/
- php /tmp/php-parallel-lint/parallel-lint.php -e php,phpt --exclude vendor .
# - php /tmp/php-parallel-lint/parallel-lint.php -e php,phpt --exclude vendor .
# - php /tmp/code-checker/src/code-checker.php --short-arrays
# - if [ "$PHPSTAN" = "1" ]; then php vendor/phpstan/phpstan-shim/phpstan.phar -v; fi
- if [ "$PHPSTAN" = "1" ]; then php vendor/phpstan/phpstan-shim/phpstan.phar analyse --ansi --no-progress -l7 -c phpstan.neon src tests/KdybyTests; fi
# - if [ "$PHPSTAN" = "1" ]; then php vendor/phpstan/phpstan-shim/phpstan.phar analyse --ansi --no-progress -l7 -c phpstan.neon src tests/KdybyTests; fi

after_script:
- if [ "$COVERAGE" != "" ]; then php /tmp/coveralls.phar --verbose --config tests/.coveralls.yml || true; fi
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Kdyby/Doctrine
dek-cz/Doctrine
======

[![Build Status](https://travis-ci.org/Kdyby/Doctrine.svg?branch=master)](https://travis-ci.org/Kdyby/Doctrine)
[![Downloads this Month](https://img.shields.io/packagist/dm/kdyby/doctrine.svg)](https://packagist.org/packages/kdyby/doctrine)
[![Latest stable](https://img.shields.io/packagist/v/kdyby/doctrine.svg)](https://packagist.org/packages/kdyby/doctrine)
[![Coverage Status](https://coveralls.io/repos/github/Kdyby/Doctrine/badge.svg?branch=master)](https://coveralls.io/github/Kdyby/Doctrine?branch=master)
[![Build Status](https://travis-ci.com/dek-cz/Doctrine.svg?branch=master)](https://travis-ci.com/dek-cz/Doctrine)
[![Downloads this Month](https://img.shields.io/packagist/dm/dek-cz/doctrine.svg)](https://packagist.org/packages/dek-cz/doctrine)
[![Latest stable](https://img.shields.io/packagist/v/dek-cz/doctrine.svg)](https://packagist.org/packages/dek-cz/doctrine)
[![Coverage Status](https://coveralls.io/repos/github/dek-cz/doctrine/badge.svg?branch=master)](https://coveralls.io/github/dek-cz/doctrine?branch=master)


Installation
------------

The best way to install Kdyby/Doctrine is using [Composer](http://getcomposer.org/):
The best way to install dek-cz/Doctrine is using [Composer](http://getcomposer.org/):

```sh
$ composer require kdyby/doctrine
$ composer require dek-cz/doctrine
```

Documentation
Expand Down
126 changes: 65 additions & 61 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
{
"name": "kdyby/doctrine",
"type": "library",
"description": "Doctrine integration into Nette Framework",
"keywords": ["nette", "kdyby", "doctrine", "orm", "dbal"],
"homepage": "http://kdyby.org",
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"authors": [
{
"name": "Filip Procházka",
"homepage": "http://filip-prochazka.com",
"email": "[email protected]"
}
],
"support": {
"email": "[email protected]",
"issues": "https://github.com/kdyby/doctrine/issues"
},
"require": {
"php": "^7.1",
"doctrine/orm": "~2.7",
"doctrine/dbal": "~2.9",
"kdyby/console": "^2.7.1",
"kdyby/annotations": "^3.0",
"kdyby/doctrine-cache": "^3.0",
"kdyby/strict-objects": "^2.0",
"nette/di": "^3.0",
"nette/utils": "^3.0",
"nette/finder": "^2.5"
},
"suggest": {
"kdyby/doctrine-magic-accessors": "Fast-prototyping magic accessors trait for Doctrine entities",
"kdyby/doctrine-collections-readonly": "Read-only collection wrapper for easier work with Doctrine entity collections",
"kdyby/doctrine-collections-lazy": "Lazy collection for doctrine/collections",
"kdyby/doctrine-dbal-batchimport": "Batch import & execute utils for effective processing of SQL Imports from files and strings"
},
"require-dev": {
"kdyby/events": "^3.1.1@dev",
"nette/bootstrap": "^3.0",
"nette/caching": "^3.0",
"nette/http": "^3.0",
"tracy/tracy": "^2.5",
"nette/tester": "^2.2"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": {
"Kdyby\\Doctrine\\": "src/",
"Kdyby\\Persistence\\": "src/"
"name": "dek-cz/doctrine",
"type": "library",
"description": "Doctrine integration into Nette Framework",
"keywords": ["nette", "kdyby", "doctrine", "orm", "dbal"],
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"authors": [
{
"name": "Filip Procházka",
"homepage": "http://filip-prochazka.com",
"email": "[email protected]"
}
],
"require": {
"php": "^7.4 || ^8.0",
"psr/cache": "^1.0.1",
"doctrine/orm": "^2.7.1",
"doctrine/dbal": "~2.10",
"doctrine/common": "^2.13",
"kdyby/annotations": "^3.0",
"kdyby/doctrine-cache": "^3.0",
"kdyby/strict-objects": "^2.0",
"nette/di": "^3.0",
"nette/utils": "^3.0",
"nette/finder": "^2.5",
"contributte/console": "0.10.x-dev"
},
"suggest": {
"kdyby/doctrine-magic-accessors": "Fast-prototyping magic accessors trait for Doctrine entities",
"kdyby/doctrine-collections-readonly": "Read-only collection wrapper for easier work with Doctrine entity collections",
"kdyby/doctrine-collections-lazy": "Lazy collection for doctrine/collections",
"kdyby/doctrine-dbal-batchimport": "Batch import & execute utils for effective processing of SQL Imports from files and strings"
},
"require-dev": {
"kdyby/events": "^3.1.1@dev",
"nette/bootstrap": "^3.0",
"nette/caching": "^3.0",
"nette/http": "^3.0",
"tracy/tracy": "^2.8",
"nette/tester": "^2.4",
"phpstan/phpstan": "^0.12.69",
"phpstan/phpstan-nette": "^0.12.14",
"spaze/phpstan-disallowed-calls": "^1.1",
"phpunit/php-code-coverage": "^9.2",
"php-coveralls/php-coveralls": "^2.4",
"ninjify/qa": "^0.12.1",
"phpstan/phpstan-strict-rules": "^0.12.9"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": {
"Kdyby\\Doctrine\\": "src/",
"Kdyby\\Persistence\\": "src/"
},
"classmap": [
"src/Kdyby/Doctrine/exceptions.php"
]
},
"autoload-dev": {
"classmap": [
"tests/KdybyTests"
]
},
"classmap": [
"src/Kdyby/Doctrine/exceptions.php"
]
},
"autoload-dev": {
"classmap": [
"tests/KdybyTests"
]
},
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
}
}
}
2 changes: 1 addition & 1 deletion docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and now enable the extension using your neon config
```yml
extensions:
# add theese four lines
console: Kdyby\Console\DI\ConsoleExtension
console: Contributte\Console\DI\ConsoleExtension
events: Kdyby\Events\DI\EventsExtension
annotations: Kdyby\Annotations\DI\AnnotationsExtension
doctrine: Kdyby\Doctrine\DI\OrmExtension
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
includes:
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
parameters:
ignoreErrors:
- '#Constant TEMP_DIR not found#'
Expand Down
28 changes: 28 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<ruleset>
<!-- Coding Standard -->
<rule ref="./vendor/ninjify/coding-standard/ruleset.xml"/>

<!-- Specific rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="Dekcz"/>
<element key="tests" value="DekczTests"/>
</property>
</properties>
</rule>
<!-- netbeans problem format -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
<property name="spacesCountAroundEqualsSign" value="1"/>
<property name="newlinesCountAfterDeclare" value="2"/>
</properties>
</rule>
<rule ref="PSR2">
<exclude name="Squiz.WhiteSpace.MemberVarSpacing"/>
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/>
</rule>

</ruleset>
8 changes: 4 additions & 4 deletions src/Kdyby/Doctrine/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class Configuration extends BaseConfiguration
{

public function getQueryBuilderClassName()
public function getQueryBuilderClassName() : string
{
return isset($this->_attributes['queryBuilderClass'])
? $this->_attributes['queryBuilderClass']
Expand All @@ -32,21 +32,21 @@ public function getQueryBuilderClassName()



public function setQueryBuilderClassName($className)
public function setQueryBuilderClassName(string $className) : void
{
$this->_attributes['queryBuilderClass'] = $className;
}



public function setTargetEntityMap($targetEntityMap)
public function setTargetEntityMap(array $targetEntityMap) : void
{
$this->_attributes['targetEntityMap'] = $targetEntityMap;
}



public function getTargetEntityClassName($className)
public function getTargetEntityClassName(string $className) : string
{
return isset($this->_attributes['targetEntityMap'], $this->_attributes['targetEntityMap'][$className])
? $this->_attributes['targetEntityMap'][$className]
Expand Down
2 changes: 1 addition & 1 deletion src/Kdyby/Doctrine/Console/CommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
use Kdyby\Console\ContainerHelper;
use Kdyby\Doctrine\Console\ContainerHelper;
use Symfony\Component\Console\Helper\HelperSet;

/**
Expand Down
78 changes: 78 additions & 0 deletions src/Kdyby/Doctrine/Console/ContainerHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

declare(strict_types = 1);

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/

namespace Kdyby\Doctrine\Console;

use Nette\DI\Container as DIContainer;

class ContainerHelper extends \Symfony\Component\Console\Helper\Helper
{

use \Nette\SmartObject;

/**
* @var \Nette\DI\Container
*/
private $container;

public function __construct(DIContainer $dic)
{
$this->container = $dic;
}

public function hasParameter(string $key): bool
{
return isset($this->container->parameters[$key]);
}

/**
* @return mixed
*/
public function getParameter(string $key)
{
if (!$this->hasParameter($key)) {
return NULL;
}

return $this->container->parameters[$key];
}

/**
* @return mixed[]
*/
public function getParameters(): array
{
return $this->container->parameters;
}

public function getContainer(): DIContainer
{
return $this->container;
}

/**
* @return object
*/
public function getByType(string $type)
{
return $this->container->getByType($type);
}

/**
* Returns the canonical name of this helper.
*/
public function getName(): string
{
return 'container';
}

}
5 changes: 3 additions & 2 deletions src/Kdyby/Doctrine/Console/DbalDelegateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ protected function configure()
$this->setHelp($this->command->getHelp());
$this->setDefinition($this->command->getDefinition());
$this->setDescription($this->command->getDescription());

$this->addOption('connection', NULL, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
if (!$this->getDefinition()->hasOption('connection')) {
$this->addOption('connection', NULL, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
}
}

/**
Expand Down
Loading