Reset recordsModified to false before conneciont release into pool.

This commit is contained in:
李铭昕 2019-12-07 16:35:38 +08:00
parent 5d0a55d474
commit 41cec1dd96
11 changed files with 14 additions and 38 deletions

View File

@ -40,8 +40,6 @@ class InstallCommand extends BaseCommand
/** /**
* Create a new migration install command instance. * Create a new migration install command instance.
*
* @param MigrationRepositoryInterface $repository
*/ */
public function __construct(MigrationRepositoryInterface $repository) public function __construct(MigrationRepositoryInterface $repository)
{ {

View File

@ -38,8 +38,6 @@ class MigrateCommand extends BaseCommand
/** /**
* Create a new migration command instance. * Create a new migration command instance.
*
* @param \Hyperf\Database\Migrations\Migrator $migrator
*/ */
public function __construct(Migrator $migrator) public function __construct(Migrator $migrator)
{ {

View File

@ -74,8 +74,6 @@ class StatusCommand extends BaseCommand
/** /**
* Get the status for the given ran migrations. * Get the status for the given ran migrations.
* *
* @param array $ran
* @param array $batches
* @return \Hyperf\Utils\Collection * @return \Hyperf\Utils\Collection
*/ */
protected function getStatusFor(array $ran, array $batches) protected function getStatusFor(array $ran, array $batches)

View File

@ -28,8 +28,6 @@ class GenSeederCommand extends BaseCommand
/** /**
* Create a new seeder generator command instance. * Create a new seeder generator command instance.
*
* @param \Hyperf\Database\Seeders\SeederCreator $creator
*/ */
public function __construct(SeederCreator $creator) public function __construct(SeederCreator $creator)
{ {
@ -51,8 +49,6 @@ class GenSeederCommand extends BaseCommand
/** /**
* Write the seeder file to disk. * Write the seeder file to disk.
*
* @param string $name
*/ */
protected function writeMigration(string $name) protected function writeMigration(string $name)
{ {

View File

@ -43,8 +43,6 @@ class SeedCommand extends BaseCommand
/** /**
* Create a new seed command instance. * Create a new seed command instance.
*
* @param \Hyperf\Database\Seeders\Seed $seed
*/ */
public function __construct(Seed $seed) public function __construct(Seed $seed)
{ {

View File

@ -537,6 +537,14 @@ class Connection implements ConnectionInterface
} }
} }
/**
* Reset `recordsModified` to false.
*/
public function resetRecordsModified(): void
{
$this->recordsModified = false;
}
/** /**
* Is Doctrine available? * Is Doctrine available?
* *

View File

@ -35,8 +35,6 @@ class MigrationCreator
/** /**
* Create a new migration creator instance. * Create a new migration creator instance.
*
* @param Filesystem $files
*/ */
public function __construct(Filesystem $files) public function __construct(Filesystem $files)
{ {

View File

@ -502,8 +502,6 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
/** /**
* Save the model to the database. * Save the model to the database.
*
* @return bool
*/ */
public function save(array $options = []): bool public function save(array $options = []): bool
{ {

View File

@ -60,9 +60,6 @@ class Seed
/** /**
* Create a new seed instance. * Create a new seed instance.
*
* @param \Hyperf\Database\ConnectionResolverInterface $resolver
* @param \Hyperf\Utils\Filesystem\Filesystem $files
*/ */
public function __construct(Resolver $resolver, Filesystem $files) public function __construct(Resolver $resolver, Filesystem $files)
{ {
@ -74,7 +71,6 @@ class Seed
* Run the pending seeders at a given path. * Run the pending seeders at a given path.
* *
* @param array|string $paths * @param array|string $paths
* @param array $options
* @return array * @return array
*/ */
public function run($paths = [], array $options = []) public function run($paths = [], array $options = [])
@ -90,8 +86,6 @@ class Seed
/** /**
* Set the default connection name. * Set the default connection name.
*
* @param string $name
*/ */
public function setConnection(string $name): void public function setConnection(string $name): void
{ {
@ -104,9 +98,6 @@ class Seed
/** /**
* Run an array of seeders. * Run an array of seeders.
*
* @param array $seeders
* @param array $options
*/ */
public function runSeeders(array $seeders, array $options = []) public function runSeeders(array $seeders, array $options = [])
{ {
@ -155,10 +146,6 @@ class Seed
/** /**
* Resolve a seeder instance from a file. * Resolve a seeder instance from a file.
*
* @param string $file
*
* @return object
*/ */
public function resolve(string $file): object public function resolve(string $file): object
{ {
@ -170,8 +157,6 @@ class Seed
/** /**
* Resolve the database connection instance. * Resolve the database connection instance.
* *
* @param string $connection
*
* @return Connection * @return Connection
*/ */
public function resolveConnection(string $connection) public function resolveConnection(string $connection)
@ -209,8 +194,6 @@ class Seed
/** /**
* Require in all the seeder files in a given path. * Require in all the seeder files in a given path.
*
* @param array $files
*/ */
public function requireFiles(array $files) public function requireFiles(array $files)
{ {
@ -222,7 +205,6 @@ class Seed
/** /**
* Set the output implementation that should be used by the console. * Set the output implementation that should be used by the console.
* *
* @param OutputInterface $output
* @return $this * @return $this
*/ */
public function setOutput(OutputInterface $output) public function setOutput(OutputInterface $output)
@ -236,8 +218,6 @@ class Seed
* Get the schema grammar out of a migration connection. * Get the schema grammar out of a migration connection.
* *
* @param Connection $connection * @param Connection $connection
*
* @return \Hyperf\Database\Schema\Grammars\Grammar
*/ */
protected function getSchemaGrammar($connection): Grammar protected function getSchemaGrammar($connection): Grammar
{ {

View File

@ -27,8 +27,6 @@ class SeederCreator
/** /**
* Create a new seeder creator instance. * Create a new seeder creator instance.
*
* @param Filesystem $files
*/ */
public function __construct(Filesystem $files) public function __construct(Filesystem $files)
{ {

View File

@ -115,10 +115,16 @@ class Connection extends BaseConnection implements ConnectionInterface, DbConnec
public function release(): void public function release(): void
{ {
if ($this->connection instanceof \Hyperf\Database\Connection) {
// Reset `recordsModified` to false before conneciont release into pool.
$this->connection->resetRecordsModified();
}
if ($this->isTransaction()) { if ($this->isTransaction()) {
$this->rollBack(0); $this->rollBack(0);
$this->logger->error('Maybe you\'ve forgotten to commit or rollback the MySQL transaction.'); $this->logger->error('Maybe you\'ve forgotten to commit or rollback the MySQL transaction.');
} }
parent::release(); parent::release();
} }