-
Notifications
You must be signed in to change notification settings - Fork 3
/
PrestashopEcommerceBundle.php
42 lines (36 loc) · 1.36 KB
/
PrestashopEcommerceBundle.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
34
35
36
37
38
39
40
41
42
<?php
namespace MauticPlugin\PrestashopEcommerceBundle;
use Mautic\CoreBundle\Factory\MauticFactory;
use Mautic\LeadBundle\Entity\LeadField;
use Mautic\PluginBundle\Bundle\PluginBundleBase;
use Mautic\PluginBundle\Entity\Plugin;
class PrestashopEcommerceBundle extends PluginBundleBase
{
static public function onPluginInstall(Plugin $plugin, MauticFactory $factory, $metadata = null, $installedSchema = NULL)
{
if ($metadata !== null) {
self::installPluginSchema($metadata, $factory);
}
$em = $factory->getEntityManager();
$leadField = new LeadField();
$leadField->setLabel('Customer Id');
$leadField->setAlias('customerid');
$leadField->setObject('lead');
$leadField->setGroup('core');
$leadField->setType('number');
$leadField->setIsUniqueIdentifier(true);
$leadField->setIsPubliclyUpdatable(true);
$em->persist($leadField);
$em->flush($leadField);
$leadField = new LeadField();
$leadField->setLabel('Guest Id');
$leadField->setAlias('guestid');
$leadField->setObject('lead');
$leadField->setGroup('core');
$leadField->setType('number');
$leadField->setIsUniqueIdentifier(true);
$leadField->setIsPubliclyUpdatable(true);
$em->persist($leadField);
$em->flush($leadField);
}
}