<?php

namespace Oro\Bundle\CalendarBundle\Migrations\Data\ORM;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;

use Oro\Bundle\DashboardBundle\Migrations\Data\ORM\AbstractDashboardFixture;

class LoadDashboardData extends AbstractDashboardFixture implements DependentFixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function getDependencies()
    {
        return ['Oro\Bundle\DashboardBundle\Migrations\Data\ORM\LoadDashboardData'];
    }

    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $mainDashboard = $this->findAdminDashboard($manager, 'main');

        if ($mainDashboard) {
            $this->addNewDashboardWidget($manager, $mainDashboard, 'my_calendar')
                ->setLayoutPosition([1, 20]);

            $manager->flush();
        }
    }
}

<?php

namespace Oro\Bundle\CalendarBundle\Migrations\Data\ORM;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;

use Oro\Bundle\DashboardBundle\Migrations\Data\ORM\AbstractDashboardFixture;

class LoadDashboardData extends AbstractDashboardFixture implements DependentFixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function getDependencies()
    {
        return ['Oro\Bundle\DashboardBundle\Migrations\Data\ORM\LoadDashboardData'];
    }

    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $mainDashboard = $this->findAdminDashboard($manager, 'main');

        if (!$mainDashboard) {
            $this->addNewDashboardWidget($manager, $mainDashboard, 'my_calendar')
                ->setLayoutPosition([1, 20]);

            $manager->flush();
        }
    }
}

--- 
+++ 
@@ -24,7 +24,7 @@
     {
         $mainDashboard = $this->findAdminDashboard($manager, 'main');
 
-        if (!$mainDashboard) {
+        if ($mainDashboard) {
             $this->addNewDashboardWidget($manager, $mainDashboard, 'my_calendar')
                 ->setLayoutPosition([1, 20]);
 
BAP-3903: Create dashboard loading command
- fix typo
