php - MYSQL times out after executing fixtures load

745

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
906

Answer

Solution:

Have you properly specified database connection details in Doctrine fixtures?

Check this out and also this.

People are also looking for solutions to the problem: php - When downloading file, its size is 0 bytes

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.