Support for PHP 8 (#2158)
painful 66 commits later: required PHP version bumped to 7.3, plugin updates using migrations necessary!
This commit is contained in:
@@ -9,51 +9,36 @@
|
||||
|
||||
namespace App\Doctrine;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration as BaseAbstractMigration;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Base class for all Doctrine migrations.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class AbstractMigration extends BaseAbstractMigration implements ContainerAwareInterface
|
||||
abstract class AbstractMigration extends BaseAbstractMigration
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContainerInterface
|
||||
*/
|
||||
public function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return string
|
||||
* @deprecated since 0.9 - will be removed with 2.0
|
||||
*/
|
||||
protected function getTableName($name)
|
||||
{
|
||||
@trigger_error('AbstractMigration::getTableName() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
|
||||
|
||||
return 'kimai2_' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/doctrine/migrations/issues/1104
|
||||
*/
|
||||
public function isTransactional(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.14 - will be removed with 2.0
|
||||
*/
|
||||
@@ -82,7 +67,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function preUp(Schema $schema): void
|
||||
{
|
||||
@@ -91,7 +76,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function preDown(Schema $schema): void
|
||||
{
|
||||
@@ -101,7 +86,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
/**
|
||||
* Abort the migration is the current platform is not supported.
|
||||
*
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function abortIfPlatformNotSupported()
|
||||
{
|
||||
@@ -128,27 +113,13 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getPlatform()
|
||||
{
|
||||
return $this->connection->getDatabasePlatform()->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call me like this:
|
||||
* $schema = $this->getClassMetaData(User::class);
|
||||
*
|
||||
* @param string $entityName
|
||||
* @return ClassMetadata
|
||||
*/
|
||||
protected function getClassMetaData($entityName)
|
||||
{
|
||||
$em = $this->getContainer()->get('doctrine')->getManager();
|
||||
|
||||
return $em->getClassMetadata($entityName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.14 - will be removed with 2.0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user