-
Notifications
You must be signed in to change notification settings - Fork 17
/
CustomObjectsBundle.php
33 lines (28 loc) · 1.04 KB
/
CustomObjectsBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
namespace MauticPlugin\CustomObjectsBundle;
use Doctrine\DBAL\Schema\Schema;
use Mautic\CoreBundle\Factory\MauticFactory;
use Mautic\IntegrationsBundle\Bundle\AbstractPluginBundle;
use MauticPlugin\CustomObjectsBundle\DependencyInjection\Compiler\CustomFieldTypePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CustomObjectsBundle extends AbstractPluginBundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new CustomFieldTypePass());
}
/**
* In some rare cases it can happen that the plugin tables weren't created on plugin install.
* Create them on plugin update if they are missing.
*/
protected static function installAllTablesIfMissing(Schema $schema, string $tablePrefix, MauticFactory $factory, array $metadata = null): void
{
if (!$schema->hasTable($tablePrefix.'custom_object')) {
self::installPluginSchema($metadata, $factory, null);
}
}
}