Code Monkey home page Code Monkey logo

doctrine-mysql-come-back's People

Contributors

alexmanno avatar algatux avatar capitrium avatar dependabot[bot] avatar gordinskiy avatar jean85 avatar lattwood avatar lewisw avatar lkck24 avatar maxcanna avatar ninsuo avatar oleg-andreyev avatar peelandsee avatar roslov avatar starred-gijs avatar taueres avatar thomasvargiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doctrine-mysql-come-back's Issues

need add goneAwayExceptions

[2017-10-23 11:49:49] lumen.DEBUG: An exception occurred while executing 'SELECT t0.operator_id AS operator_id_1, t0.company_id AS company_id_2, t0.bind_status AS bind_status_3, t0.is_companyadmin AS is_companyadmin_4, t0.deleted_at AS deleted_at_5 FROM operator_bind_company t0 WHERE t0.operator_id = ? LIMIT 1' with params ["1"]:

Error while sending QUERY packet. PID=824

[2017-10-23 11:49:49] lumen.ERROR: ErrorException: Error while sending QUERY packet. PID=824 in /srv/www/espier-bloated/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105
Stack trace:
#0 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(2, 'Error while sen...', '/srv/www/espier...', 105, Array)
#1 /srv/www/espier-bloated/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)
#2 /srv/www/espier-bloated/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(907): Doctrine\DBAL\Driver\PDOStatement->execute()

[2017-10-23 11:50:08] lumen.DEBUG: An exception occurred while executing 'SELECT t0.operator_id AS operator_id_1, t0.company_id AS company_id_2, t0.bind_status AS bind_status_3, t0.is_companyadmin AS is_companyadmin_4, t0.deleted_at AS deleted_at_5 FROM operator_bind_company t0 WHERE t0.operator_id = ? LIMIT 1' with params ["1"]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Newer doctrine/dbal dependency

Hi There,

What are the possibilities for updating the doctrine/dbal dependency in your composer.json to a more recent version?

I'm asking, cause downgrading to ">=2.3,<2.4-dev" seems to have broken my sf2 'kpn_paginator' sorting functionality.

Beside that, your code was a real lifesaver for me!

Cheers!

Migration to v2

Hey guys,

we are using this component in our project and want to upgrade to PHP 8.1.
It seems that the v2 beta1 contains changes from #55

The changelog says "Removed specialized MasterSlaveConnection and PrimaryReadReplicaConnection (due to drop of corresponding classes in DBAL v3)".

I am not sure where this comes from but as of this very moment, it is still part of DBAL v3.5.1 + unreleased v4.0:
https://github.com/doctrine/dbal/blob/82483595da680180c1d360ea7fbff1ea8fb08142/src/Connections/PrimaryReadReplicaConnection.php#L77
https://github.com/doctrine/dbal/blob/0f2d257b50ebd097ea40eb67e5bd1337523ded26/src/Connections/PrimaryReadReplicaConnection.php#L75

However, since I would prefer continue using this component, I wonder if the v2 beta1 is in production somewhere in combination with latest doctrine versions.
If not, is v2 already "finalized" and only bugfixes are allowed or are you open for contributions to make it compatible with latest doctrine versions?

Regards,
Max

version tag

I've been struggling with double query logging but now I see you've solved that issue.

May I ask you to update packagist repo?

Add PrimaryReadReplicaConnetion again in v2 (or offer alternative)

Hi!

I would appreciate it, if you could add the PrimaryReadReplicaConnection again.
The upgrade file for 2.0 says that we should use the PrimaryReadReplicaConnection from doctrine/dbal. But since the wrapper class must be the. one from this repository, it cannot work together, as i can only define one connection wrapper class.

This was my setup in 1.9:

[
    'driver_class' => \Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver::class, // This is where the come back was located before
    'wrapper_class' => \Doctrine\DBAL\Connections\PrimaryReadReplicaConnection::class,
]

The setup in 2.0 now should look something like this (due to removed driver classes):

[
    'driver_class' => \Doctrine\DBAL\Driver\PDO\MySQL\Driver::class,
    'wrapper_class' => \Doctrine\DBAL\Connections\PrimaryReadReplicaConnection::class,  // this _should_ be where the come back can be located now?
]

Would you give me an example on how to achieve this without the driver class, or add the PrimaryReadReplicaConnetion class again?

No reconnect on "START TRANSACTION"

Hi,

I'm working with the newest release 2.0.0-BETA1 a couple of weeks now and run into an issue with the function beginTransaction.

This function is the first function to call for my process after a waiting period (in which the MySql-Server is gone away). Sadly the function throws an error "SQLSTATE[HY000]: General error: 2006 MySQL server has gone away" instead of reconnectiong and retrying. After some debugging I've found out that this function is trying to catch a Doctrine\DBAL\Exception instead of an core exception (\Exception) like other functions do. But the beginTransaction-function from Doctrine is throwing ad PDOException so its not caught in your beginTransaction-function. I've tried to catch the core exception instead but sadly canTryAgain returns false.

I'm not sure what's going wrong here exactly, whether it's just a typing error or this is intentionally (executeStatement and executeQuery also catches Exception instead of \Excpetion).

FYI: executeQuery works fine with catching Doctrine\DBAL\Exception instead of an core exception (\Exception)

Hope you can have a look into that. Meanwhile I'll try a workaround.

Thx and greetings Steven

Connection exception

Just tried to setup this in a project with Symfony 4.2 and got an InvalidArgumentException:

Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection needs a driver that implements ServerGoneAwayExceptionsAwareInterface

here is my conf:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver: 'pdo_mysql'
                server_version: '5.7'
                charset: utf8mb4
                default_table_options:
                    charset: utf8mb4
                    collate: utf8mb4_unicode_ci
                url: '%env(resolve:DATABASE_URL)%'
                wrapper_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection'
                driver_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver'
``

Usage of PrimaryReadReplicaConnection is failing

When I am using the PrimaryReadReplicaConnection class to set up a Primary/Replica connection, then I am facing the following issue:

Argument 2 passed to Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Statement::__construct() must be an instance of Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection, instance of Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connections\PrimaryReadReplicaConnection given, called in vendor/facile-it/doctrine-mysql-come-back/src/ConnectionTrait.php on line 212 and defined in vendor/facile-it/doctrine-mysql-come-back/src/Statement.php:40

My guess is that the Statement actually needs ConnectionInterface as the second parameter instead of Connection.

I am using the latest version 1.10.0.

Missing functions

Hi.

Unfortunately, the current version lacks new functions

for instance:
Call to undefined method Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Statement::executeQuery()

composer/package-versions-deprecated 1.11.99.1
doctrine/annotations 1.12.1
doctrine/cache 1.11.0
doctrine/collections 1.6.7
doctrine/common 3.1.2
doctrine/dbal 2.13.1
doctrine/deprecations v0.5.3
doctrine/doctrine-bundle 2.3.2
doctrine/event-manager 1.1.1
doctrine/inflector 2.0.3
doctrine/instantiator 1.4.0
doctrine/lexer 1.2.1
doctrine/orm 2.8.4
doctrine/persistence 2.1.0
doctrine/sql-formatter 1.1.1
facile-it/doctrine-mysql-come-back v1.8
friendsofphp/proxy-manager-lts v1.0.3
laminas/laminas-code 3.4.1
laminas/laminas-eventmanager 3.2.1
laminas/laminas-zendframework-bridge 1.1.1
monolog/monolog 2.2.0
paragonie/constant_time_encoding v2.4.0
paragonie/random_compat v9.99.100
php-amqplib/php-amqplib v3.0.0
php-amqplib/rabbitmq-bundle 2.6.0
phpseclib/phpseclib 3.0.8
psr/cache 1.0.1
psr/container 1.1.1
psr/event-dispatcher 1.0.0
psr/log 1.1.4
symfony/cache v5.2.7
symfony/cache-contracts v2.4.0
symfony/config v5.2.7
symfony/console v5.2.7
symfony/dependency-injection v5.2.7
symfony/deprecation-contracts v2.4.0
symfony/doctrine-bridge v5.2.7
symfony/dotenv v5.2.4
symfony/error-handler v5.2.7
symfony/event-dispatcher v5.2.4
symfony/event-dispatcher-contracts v2.4.0
symfony/filesystem v5.2.7
symfony/finder v5.2.4
symfony/flex v1.12.2
symfony/framework-bundle v5.2.7
symfony/http-client-contracts v2.4.0
symfony/http-foundation v5.2.7
symfony/http-kernel v5.2.7
symfony/lock v5.2.6
symfony/monolog-bridge v5.2.7
symfony/monolog-bundle v3.7.0
symfony/polyfill-intl-grapheme v1.22.1
symfony/polyfill-intl-normalizer v1.22.1
symfony/polyfill-mbstring v1.22.1
symfony/polyfill-php73 v1.22.1
symfony/polyfill-php80 v1.22.1
symfony/proxy-manager-bridge v5.2.4
symfony/routing v5.2.7
symfony/service-contracts v2.4.0
symfony/string v5.2.6
symfony/var-dumper v5.2.7
symfony/var-exporter v5.2.7
symfony/yaml v5.2.7

Deprecation warning

Hi

Thanks for this library - it's been working very well for us. I'm seeing this deprecation warning in our Symfony project

The "Doctrine\DBAL\Connection::__construct()" method is considered internal The connection can be only instantiated by the driver manager. It may change without further notice. You should not extend it from "Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection".

This is with doctrine/dbal 2.12.0. I imagine this isn't a real problem yet, but annoying as this gets flagged up as part of our build process. Is there a way to achieve what this library does without overriding the constructor? Or perhaps a way to turn off the warning at least.

Regards

Steve

Php8

Helo, when php8 support is going to be tagged? #46

Statement object looses state of statement

Hello.

Check out catch code inside Statement::execute method. Then the connection is lost the $this->stmt property recreated without its internal state -- without binded params and variables, without fetch mode.

So this code with doctrine-mysql-come-back use will not wok correct:

$connection = baza::getService('master_connection');
$st = $connection->prepare('show variables like "wait_timeout"');
$st->setFetchMode(\Doctrine\DBAL\FetchMode::STANDARD_OBJECT);
$st->execute();
var_dump($st->fetchAll());

Without reconnect it will return object, and with reconnect where will be array. This is dangerous and not obvious behavior.

Handle "Connection timed out"

Hi,
Is it possible to also handle this error with this bundle ?
SQLSTATE[HY000] [2002] "Connection timed out"

Maybe catching the error, and recreating a connection ? Or maybe also retrying X times ?

Update 1.6.X please?

Can you version this change please?

3943d0c

Current composer version doesn't detect the string PDO::query(): MySQL server has gone away

PHP 7.1 compatibility

doctrine/dbal 2.11 was released with php >= 7.3 compatibility, later (in 2.13.0) they change it again to php 7.1 minimum version. We should try to do the same.

Incompatible with Sentry if using DB tracing

Hello, I'm using this package together with sentry and sentry-symfony. When I enable DBAL tracing for sentry, the default connection driver gets wrapped in Sentry's own TracingDriver, but the default connection driver is in turn the MysqlComeBackDriver wrapping the regular DBAL connection, which then causes an error in ConnectionTrait on line 50.

        if (!$driver instanceof ServerGoneAwayExceptionsAwareInterface) {
            throw new \InvalidArgumentException(
                sprintf('%s needs a driver that implements ServerGoneAwayExceptionsAwareInterface', get_class($this))
            );
        }

See picture: The driver is the Sentry driver decorating the MySqlComeBack driver.
Screenshot 2024-02-07 at 13 53 33

I can fix it by disabling DBAL tracing for Sentry, but I would like to have it enabled.

Package info:

symfony/symfony: 4.4.50
sentry/sentry: 3.7.0
sentry/sentry-symfony: 4.3.0
facile-it/doctrine-mysql-come-back: 1.10.1

Any suggestions? Maybe I can somehow change the order in which the drivers get wrapped so that the ComeBack one is always on top.

Undefined method named fetchAllAssociative

Hey and thanks for the great package which does great work.

In a current project I get the following message:
Attempted to call an undefined method named "fetchAllAssociative" of class "Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Statement".

Best regards

Timeouts despite the configuration is set according to the recommendation

Hi,

strangely enough I still see timeouts when configuring as per recommendation. When analyzing the related Server Error I do not see any trace of Facile in it, while I think I should, the stack trace only refers to the AbstractMySQLDriver, Doctrine/DBAL/Driver/PDOMySql/Driver, Doctrine/DBAL/Connection.

How can I check that the configured Driver and Connection class are really loaded?
When running the bin/console debug:container command, I can see this

...
  doctrine.dbal.connection                                                                         Doctrine\DBAL\Connection                                                                        
  doctrine.dbal.connection.configuration                                                           Doctrine\DBAL\Configuration                                                                     
  doctrine.dbal.connection.event_manager                                                           Symfony\Bridge\Doctrine\ContainerAwareEventManager                                              
  doctrine.dbal.connection_factory                                                                 Doctrine\Bundle\DoctrineBundle\ConnectionFactory                                                
  doctrine.dbal.default_connection                                                                 Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection                                           
  doctrine.dbal.default_connection.configuration                                                   Doctrine\DBAL\Configuration                                                                     
  doctrine.dbal.default_connection.event_manager                                                   Symfony\Bridge\Doctrine\ContainerAwareEventManager                                              ...

Should it look like that?
Thanks for having a look.

Warm regards

Carsten

Installation of version 2.x is not working

Hi,

I'm tryinf to install the newsest version oft this package using:

composer require facile-it/doctrine-mysql-come-back ^2.0   

as documentation says. Unfortunately it's not working

[InvalidArgumentException]
Could not find package facile-it/doctrine-mysql-come-back in a version matching "2.0" and a stability matching "dev".

Thx in advance for any help. Steven

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.