Skip to content

Commit

Permalink
Merge pull request #49 from TheDMSGroup/refactor-segments
Browse files Browse the repository at this point in the history
Refactor to support new Segment logic.
  • Loading branch information
heathdutton authored Jul 12, 2018
2 parents 633f93c + a4490aa commit d89a3fb
Show file tree
Hide file tree
Showing 10 changed files with 389 additions and 2,236 deletions.
6 changes: 6 additions & 0 deletions Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
'mautic.extended_field.config.subscriber' => [
'class' => 'MauticPlugin\MauticExtendedFieldBundle\EventListener\ConfigSubscriber',
],
'mautic.extended_field.lead_subscriber' => [
'class' => 'MauticPlugin\MauticExtendedFieldBundle\EventListener\LeadSubscriber',
'arguments' => [
'mautic.lead.model.field',
],
],
],
'forms' => [
'mautic.extended_field.form.config' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* @copyright 2018 Mautic Contributors. All rights reserved
* @author Digital Media Solutions, LLC
*
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

namespace MauticPlugin\MauticExtendedFieldBundle\DependencyInjection\Compiler;

use MauticPlugin\MauticExtendedFieldBundle\Segment\OverrideTableSchemaColumnsCache;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
* Class OverrideListModelPass.
*/
class OverrideTableSchemaColumnsCachePass implements CompilerPassInterface
{
/**
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
$container->getDefinition('mautic.lead.model.lead_segment_schema_cache')
->setFactory(null)
->setArguments(
[
new Reference('doctrine.orm.entity_manager'),
new Reference('mautic.lead.model.field'),
]
)
->setClass(OverrideTableSchemaColumnsCache::class);
}
}
5 changes: 5 additions & 0 deletions Entity/ExtendedFieldRepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ public function getEntitiesWithCustomFields(
$args,
$resultsCallback = null
) {
// Run core method if we are not dealing with a lead.
if ('lead' !== $object) {
return parent::getEntitiesWithCustomFields($object, $args, $resultsCallback);
}

list($fields, $fixedFields) = $this->getCustomFieldList($object);

//Fix arguments if necessary
Expand Down
Loading

0 comments on commit d89a3fb

Please sign in to comment.