Skip to content

Commit 8c8f6bd

Browse files
author
markus-moser
committed
make class name of customer configurable - fixes #6
1 parent 7ddc53e commit 8c8f6bd

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

src/Controller/Admin/ActivitiesController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace CustomerManagementFrameworkBundle\Controller\Admin;
1717

18+
use CustomerManagementFrameworkBundle\CustomerProvider\CustomerProviderInterface;
1819
use Pimcore\Db\ZendCompatibility\QueryBuilder;
1920
use Symfony\Component\HttpFoundation\Request;
2021
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
@@ -42,7 +43,12 @@ public function listAction(Request $request)
4243
$activities = null;
4344
$paginator = null;
4445

45-
if ($customer = \Pimcore\Model\DataObject\Customer::getById($request->get('customerId'))) {
46+
/**
47+
* @var CustomerProviderInterface $customerProvier
48+
*/
49+
$customerProvier = \Pimcore::getContainer()->get('cmf.customer_provider');
50+
51+
if ($customer = $customerProvier->getById($request->get('customerId'))) {
4652
$list = \Pimcore::getContainer()->get('cmf.activity_store')->getActivityList();
4753
$list->setCondition('customerId = ' . $customer->getId());
4854
$list->setOrderKey('activityDate');

src/Controller/Admin/HelperController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ public function activityTypesAction(Request $request)
8888
*/
8989
public function settingJsonAction()
9090
{
91+
$customerClassName = explode('\\', \Pimcore::getContainer()->get('cmf.customer_provider')->getCustomerClassName());
92+
9193
$settings = [
9294
'newsletterSyncEnabled' => $this->container->getParameter('pimcore_customer_management_framework.newsletter.newsletterSyncEnabled'),
9395
'duplicatesViewEnabled' => $this->container->getParameter('pimcore_customer_management_framework.customer_duplicates_services.duplicates_view.enabled'),
94-
'segmentAssignment' => $this->getParameter('pimcore_customer_management_framework.segment_assignment_classes.types')
96+
'segmentAssignment' => $this->getParameter('pimcore_customer_management_framework.segment_assignment_classes.types'),
97+
'customerClassName' => $customerClassName[sizeof($customerClassName) - 1]
9598
];
9699

97100
$content = '

src/CustomerList/Exporter/AbstractExporter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use CustomerManagementFrameworkBundle\Model\CustomerSegmentInterface;
1919
use Pimcore\Model\DataObject\ClassDefinition;
20-
use Pimcore\Model\DataObject\Customer;
20+
use Pimcore\Model\DataObject\Listing\Concrete;
2121

2222
abstract class AbstractExporter implements ExporterInterface
2323
{
@@ -27,7 +27,7 @@ abstract class AbstractExporter implements ExporterInterface
2727
protected $name;
2828

2929
/**
30-
* @var Customer\Listing
30+
* @var Concrete
3131
*/
3232
protected $listing;
3333

@@ -100,17 +100,17 @@ public function setProperties(array $properties)
100100
}
101101

102102
/**
103-
* @return Customer\Listing
103+
* @return Concrete
104104
*/
105105
public function getListing()
106106
{
107107
return $this->listing;
108108
}
109109

110110
/**
111-
* @param Customer\Listing $listing
111+
* @param Concrete $listing
112112
*/
113-
public function setListing(Customer\Listing $listing)
113+
public function setListing(Concrete $listing)
114114
{
115115
$this->reset();
116116
$this->listing = $listing;

src/CustomerList/Exporter/ExporterInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace CustomerManagementFrameworkBundle\CustomerList\Exporter;
1717

18-
use Pimcore\Model\DataObject\Customer;
18+
use Pimcore\Model\DataObject\Listing\Concrete;
1919

2020
interface ExporterInterface
2121
{
@@ -40,14 +40,14 @@ public function getProperties();
4040
public function setProperties(array $properties);
4141

4242
/**
43-
* @return Customer\Listing
43+
* @return Concrete
4444
*/
4545
public function getListing();
4646

4747
/**
48-
* @param Customer\Listing $listing
48+
* @param Concrete $listing
4949
*/
50-
public function setListing(Customer\Listing $listing);
50+
public function setListing(Concrete $listing);
5151

5252
/**
5353
* Get file MIME type

src/Resources/public/js/startup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pimcore.plugin.customermanagementframework = Class.create(pimcore.plugin.admin,
144144
return;
145145
}
146146

147-
if (object.data.general.o_className === "Customer" && pimcore.globalmanager.get("user").isAllowed(ActivityView.config.PERMISSION)) {
147+
if (object.data.general.o_className === pimcore.settings.cmf && pimcore.globalmanager.get("user").isAllowed(ActivityView.config.PERMISSION)) {
148148
var panel = new ActivityView.ActivityTab(object, type).getPanel();
149149

150150
object.tab.items.items[1].insert(1, panel);

src/SegmentBuilder/StateSegmentBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct($groupName = 'State', array $countryTransformers = [
4343
*
4444
* @param SegmentManagerInterface $segmentManager
4545
*
46-
* @return \Pimcore\Model\DataObject\Customer\Listing
46+
* @return \Pimcore\Model\DataObject\Listing\Concrete
4747
*/
4848
public function prepare(SegmentManagerInterface $segmentManager)
4949
{

0 commit comments

Comments
 (0)