Issues (3627)

IntegrationsBundle/Bundle/AbstractPluginBundle.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * @copyright   2019 Mautic Contributors. All rights reserved
7
 * @author      Mautic
8
 *
9
 * @link        http://mautic.org
10
 *
11
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Mautic\IntegrationsBundle\Bundle;
15
16
use Doctrine\DBAL\Schema\Schema;
17
use Exception;
18
use Mautic\CoreBundle\Factory\MauticFactory;
19
use Mautic\IntegrationsBundle\Migration\Engine;
20
use Mautic\PluginBundle\Bundle\PluginBundleBase;
21
use Mautic\PluginBundle\Entity\Plugin;
22
23
/**
24
 * Base Bundle class which should be extended by addon bundles.
25
 */
26
abstract class AbstractPluginBundle extends PluginBundleBase
27
{
28
    /**
29
     * @param array|null $metadata
30
     *
31
     * @throws Exception
32
     */
33
    public static function onPluginUpdate(Plugin $plugin, MauticFactory $factory, $metadata = null, ?Schema $installedSchema = null): void
34
    {
35
        $entityManager = $factory->getEntityManager();
36
        $tablePrefix   = (string) $factory->getParameter('mautic.db_table_prefix');
37
38
        $migrationEngine = new Engine(
39
            $entityManager,
40
            $tablePrefix,
41
            __DIR__.'/../../../../plugins/'.$plugin->getBundle(),
42
            $plugin->getBundle()
43
        );
44
45
        if (method_exists(__CLASS__, 'installAllTablesIfMissing')) {
46
            static::installAllTablesIfMissing(
0 ignored issues
show
The method installAllTablesIfMissing() does not exist on Mautic\IntegrationsBundl...le\AbstractPluginBundle. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
            static::/** @scrutinizer ignore-call */ 
47
                    installAllTablesIfMissing(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
                $entityManager->getConnection()->getSchemaManager()->createSchema(),
48
                $tablePrefix,
49
                $factory,
50
                $metadata
51
            );
52
        }
53
54
        $migrationEngine->up();
55
    }
56
57
    /**
58
     * Returns the bundle name that this bundle overrides.
59
     *
60
     * Despite its name, this method does not imply any parent/child relationship
61
     * between the bundles, just a way to extend and override an existing
62
     * bundle.
63
     *
64
     * @return string The Bundle name it overrides or null if no parent
65
     */
66
    public function getParent()
67
    {
68
        return null;
69
    }
70
}
71