I am running MySQL on a Docker container and I am connected to my database (I,ve added items via postman so I know it’s connected). However, I tried to add doctrine fixtures and then load them but it times out. Anybody ran into this issue before?
class AppFixtures extends Fixture
{
public function load(ObjectManager $manager)
{
$blogPost = new BlogPost();
$blogPost->setTitle('A First post!');
$blogPost->setPublished(new DateTime('2019-07-01 12:00:00'));
$blogPost->setContent('Post Text!');
$blogPost->setAuthor('Chris Moreno');
$blogPost->setSlug('a-first-post');
$manager->persist($blogPost);
$blogPost = new BlogPost();
$blogPost->setTitle('A Second post!');
$blogPost->setPublished(new DateTime('2019-07-01 12:00:00'));
$blogPost->setContent('Post Text!');
$blogPost->setAuthor('Chris Moreno');
$blogPost->setSlug('a-second-post');
$manager->persist($blogPost);
$manager->flush();
}
}
error when calling this:
php bin/console doctrine:fixtures:load
error msg:
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] Operation timed out
Have you properly specified database connection details in Doctrine fixtures?
Check this out and also this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With