Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed o_ prefixes #379

Closed
wants to merge 12 commits into from
4 changes: 2 additions & 2 deletions .github/ci/files/var/classes/DataObject/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@

class Customer extends \CustomerManagementFrameworkBundle\Model\AbstractCustomer\DefaultAbstractUserawareCustomer
{
protected $o_classId = "CU";
protected $o_className = "Customer";
protected $classId = "CU";
protected $className = "Customer";
protected $active;
protected $gender;
protected $firstname;
Expand Down
4 changes: 2 additions & 2 deletions .github/ci/files/var/classes/DataObject/CustomerSegment.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

class CustomerSegment extends \CustomerManagementFrameworkBundle\Model\AbstractCustomerSegment
{
protected $o_classId = "2";
protected $o_className = "CustomerSegment";
protected $classId = "2";
protected $className = "CustomerSegment";
protected $name;
protected $group;
protected $reference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

class CustomerSegmentGroup extends Concrete
{
protected $o_classId = "1";
protected $o_className = "CustomerSegmentGroup";
protected $classId = "1";
protected $className = "CustomerSegmentGroup";
protected $name;
protected $reference;
protected $calculated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

class LinkActivityDefinition extends Concrete
{
protected $o_classId = "5";
protected $o_className = "LinkActivityDefinition";
protected $classId = "5";
protected $className = "LinkActivityDefinition";
protected $code;
protected $attributeType;
protected $label;
Expand Down
4 changes: 2 additions & 2 deletions .github/ci/files/var/classes/DataObject/SsoIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

class SsoIdentity extends \CustomerManagementFrameworkBundle\Model\AbstractSsoIdentity
{
protected $o_classId = "3";
protected $o_className = "SsoIdentity";
protected $classId = "3";
protected $className = "SsoIdentity";
protected $provider;
protected $identifier;
protected $profileData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

class TermSegmentBuilderDefinition extends \CustomerManagementFrameworkBundle\Model\AbstractTermSegmentBuilderDefinition
{
protected $o_classId = "4";
protected $o_className = "TermSegmentBuilderDefinition";
protected $classId = "4";
protected $className = "TermSegmentBuilderDefinition";
protected $name;
protected $terms;

Expand Down
6 changes: 3 additions & 3 deletions doc/03_Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ pimcore_customer_management_framework:
filter_properties:
# Filter fields which must match exactly.
equals:
# ?filter[id]=8 will result in a SQL condition of "WHERE o_id=8"
id: o_id
# ?filter[id]=8 will result in a SQL condition of "WHERE id=8"
id: id
active: active

# Searched fields in customer view search filters
Expand All @@ -272,7 +272,7 @@ pimcore_customer_management_framework:

# main search filter
search:
- o_id
- id
- idEncoded
- firstname
- lastname
Expand Down
2 changes: 1 addition & 1 deletion src/ActionTrigger/Condition/CountActivities.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ public function getDbCondition(ConditionDefinitionInterface $conditionDefinition
return '-1';
}

return 'o_id in ('.implode(',', $ids).')';
return 'id in ('.implode(',', $ids).')';
}
}
2 changes: 1 addition & 1 deletion src/ActionTrigger/Condition/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getDbCondition(ConditionDefinitionInterface $conditionDefinition

$customerId = intval($options[self::OPTION_CUSTOMER_ID]);

$condition = sprintf('o_id = %s', $customerId);
$condition = sprintf('id = %s', $customerId);

$not = $options[self::OPTION_NOT];

Expand Down
2 changes: 1 addition & 1 deletion src/ActionTrigger/EventHandler/DefaultEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function handleCustomerListEvent(CustomerListEventInterface $event, RuleE

$listing = \Pimcore::getContainer()->get('cmf.customer_provider')->getList();
$listing->setCondition($where);
$listing->setOrderKey('o_id');
$listing->setOrderKey('id');
$listing->setOrder('asc');

$paginator = $this->paginator->paginate($listing, 1, 100);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/DuplicatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function listAction(Request $request, DuplicatesIndexInterface $duplicate
// build customer listing
$customerList = $this->getSearchHelper()->getCustomerProvider()->getList();
$customerList
->setOrderKey('o_id')
->setOrderKey('id')
->setOrder('ASC');

/** @noinspection PhpUnhandledExceptionInspection */
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/SegmentAssignmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function inheritableSegments(Request $request, SegmentManagerInterface $s
$type = $request->get('type') ?? '';

$db = \Pimcore\Db::get();
$parentIdStatement = sprintf('SELECT `%s` FROM `%s` WHERE `%s` = :value', $type === 'object' ? 'o_parentId' : 'parentId', $type.'s', $type === 'object' ? 'o_id' : 'id');
$parentIdStatement = sprintf('SELECT `%s` FROM `%s` WHERE `%s` = :value', 'parentId', $type.'s', 'id');
$parentId = $db->fetchOne($parentIdStatement, [
'value' => $id
]);
Expand Down
16 changes: 8 additions & 8 deletions src/Controller/Rest/AbstractRestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,24 +317,24 @@ public static function buildSqlCondition($q, $op = null, $subject = null)

// Examples:
//
//q={"o_modificationDate" : {"$gt" : "1000"}}
//where ((`o_modificationDate` > '1000') )
//q={"modificationDate" : {"$gt" : "1000"}}
//where ((`modificationDate` > '1000') )
//
//
//
//
//q=[{"o_modificationDate" : {"$gt" : "1000"}}, {"o_modificationDate" : {"$lt" : "9999"}}]
//where ( ((`o_modificationDate` > '1000') ) AND ((`o_modificationDate` < '9999') ) )
//q=[{"modificationDate" : {"$gt" : "1000"}}, {"modificationDate" : {"$lt" : "9999"}}]
//where ( ((`modificationDate` > '1000') ) AND ((`modificationDate` < '9999') ) )
//
//
//
//
//q={"o_modificationDate" : {"$gt" : "1000"}, "$or": [{"o_id": "3", "o_key": {"$like" :"%lorem-ipsum%"}}]}
//where ((`o_modificationDate` > '1000') AND ((`o_id` = '3') OR ((`o_key` LIKE '%lorem-ipsum%') ) ) )
//q={"modificationDate" : {"$gt" : "1000"}, "$or": [{"id": "3", "key": {"$like" :"%lorem-ipsum%"}}]}
//where ((`modificationDate` > '1000') AND ((`id` = '3') OR ((`key` LIKE '%lorem-ipsum%') ) ) )
//
// q={"$and" : [{"o_published": "0"}, {"o_modificationDate" : {"$gt" : "1000"}, "$or": [{"o_id": "3", "o_key": {"$like" :"%lorem-ipsum%"}}]}]}
// q={"$and" : [{"published": "0"}, {"modificationDate" : {"$gt" : "1000"}, "$or": [{"id": "3", "key": {"$like" :"%lorem-ipsum%"}}]}]}
//
// where ( ((`o_published` = '0') ) AND ((`o_modificationDate` > '1000') AND ((`o_id` = '3') OR (`o_key` LIKE '%lorem-ipsum%') ) ) )
// where ( ((`published` = '0') ) AND ((`modificationDate` > '1000') AND ((`id` = '3') OR (`key` LIKE '%lorem-ipsum%') ) ) )

if (!$op) {
$op = 'AND';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getDuplicatesByData(array $data, $limit = 0)
$customerProvider->addActiveCondition($list);

$list
->addConditionParam('o_published = ?', 1);
->addConditionParam('published = ?', 1);

foreach ($data as $field => $value) {
if (is_null($value) || $value === '') {
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getDuplicatesOfCustomerByFields(CustomerInterface $customer, arr
$duplicates = $this->getDuplicatesByData($data, $limit);

if ($customer->getId()) {
$duplicates->addConditionParam('o_id != ?', $customer->getId());
$duplicates->addConditionParam('id != ?', $customer->getId());
}

if (!is_null($duplicates) && $duplicates->getCount()) {
Expand Down
4 changes: 2 additions & 2 deletions src/CustomerList/Exporter/AbstractExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ protected function getHeaderTitles(array $exportData)
if ($this->getExportSegmentsAsColumns() && sizeof($exportData[self::SEGMENT_IDS])) {
$list = \Pimcore::getContainer()->get('cmf.segment_manager')->getSegments();
array_walk($exportData[self::SEGMENT_IDS], 'intval');
$list->addConditionParam('o_id in(' . implode(', ', $exportData[self::SEGMENT_IDS]) .')');
$list->setOrderKey('concat(o_path, o_key)', false);
$list->addConditionParam('id in(' . implode(', ', $exportData[self::SEGMENT_IDS]) .')');
$list->setOrderKey('concat(path, key)', false);

$i = sizeof($titles);
foreach ($list as $item) {
Expand Down
2 changes: 1 addition & 1 deletion src/CustomerList/Filter/CustomerSegment.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected function addJoin(

// relation matches one of our field names and relates to our current object
$baseCondition = sprintf(
'`%1$s`.fieldname IN (%2$s) AND `%1$s`.src_id = o_id',
'`%1$s`.fieldname IN (%2$s) AND `%1$s`.src_id = id',
$joinName,
$relationNames
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function cleanupEmptyFolders()
$archiveDir = $this->archiveDir ?: $this->parentPath;

$folders->setCondition(
"o_id in (select o_id from (select o_id, o_path, o_key, o_type, (select count(*) from objects where o_parentId = o.o_id) as counter from objects o) as temp where counter=0 and o_type = 'folder' and (o_path like ? or o_path like ?) and o_creationDate < ?)",
"id in (select id from (select id, path, key, type, (select count(*) from objects where parentId = o.id) as counter from objects o) as temp where counter=0 and type = 'folder' and (path like ? or path like ?) and creationDate < ?)",
[
str_replace('//', '/', $this->parentPath.'/%'),
str_replace('//', '/', $archiveDir .'/%'),
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function buildCustomerListNode()
];

$defaultFilterPropertiesEquals = [
'id' => 'o_id',
'id' => 'id',
'active' => 'active',
];

Expand All @@ -290,7 +290,7 @@ private function buildCustomerListNode()
'lastname'
],
'search' => [
'o_id',
'id',
'idEncoded',
'firstname',
'lastname',
Expand Down
8 changes: 4 additions & 4 deletions src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function recreateIndex()
$customerList = $customerProvider->getList();

$customerProvider->addActiveCondition($customerList);
$customerList->setOrderKey('o_id');
$customerList->setOrderKey('id');

$paginator = $this->paginator->paginate($customerList);
$paginator->setItemNumberPerPage(200);
Expand Down Expand Up @@ -250,12 +250,12 @@ public function getPotentialDuplicates($page, $pageSize = 100, $declined = false
if (!is_null($filterCustomerList)) {
$query = $filterCustomerList->getQueryBuilder()
->resetQueryPart('select')
->select('o_id');
->select('id');
$joinTable = 'object_' . $filterCustomerList->getClassId();
$select
->distinct()
->innerJoin(self::POTENTIAL_DUPLICATES_TABLE, $joinTable, $joinTable, 'FIND_IN_SET(o_id, duplicateCustomerIds)')
->andWhere('o_id in (' . $query . ')');
->innerJoin(self::POTENTIAL_DUPLICATES_TABLE, $joinTable, $joinTable, 'FIND_IN_SET(id, duplicateCustomerIds)')
->andWhere('id in (' . $query . ')');
}

if ($declined) {
Expand Down
6 changes: 3 additions & 3 deletions src/Helper/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ private static function checkObjectKeyHelper(Concrete $object, $origKey = null,
$list = new \Pimcore\Model\DataObject\Listing;
$list->setUnpublished(true);
$list->addConditionParam(
'o_path = ? and o_key = ?',
'path = ? and key = ?',
[(string)$object->getParent() . '/', $object->getKey()]
);
$objectId = $object->getId();
if ($objectId !== null) {
$list->addConditionParam('o_id != ?', $object->getId());
$list->addConditionParam('id != ?', $object->getId());
} else {
$list->addConditionParam('o_id is not null');
$list->addConditionParam('id is not null');
}
$list->setLimit(1);
$list = $list->load();
Expand Down
4 changes: 2 additions & 2 deletions src/Listing/Filter/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ protected function addPermissionFilters(QueryBuilder $queryBuilder)
$cPath = $workspace->getCpath();
$cPath = $cPath === '/' ? '' : $cPath;
// prepare condition to allow sub paths (with wildcard) and path itself (with equation)
$condition = sprintf("(CONCAT(o_path,o_key) LIKE '%s/%%' OR CONCAT(o_path,o_key) = '%s')",
$condition = sprintf("(CONCAT(path,key) LIKE '%s/%%' OR CONCAT(path,key) = '%s')",
$cPath, $cPath);
// add allow condition
$allowConditions[] = $condition;
} // if user is not allowed to list content -> add to deny conditions
else {
// prepare condition to allow sub paths (with wildcard) and path itself (with equation)
$condition = sprintf("(CONCAT(o_path,o_key) NOT LIKE '%s/%%' AND CONCAT(o_path,o_key) <> '%s')",
$condition = sprintf("(CONCAT(path,key) NOT LIKE '%s/%%' AND CONCAT(path,key) <> '%s')",
$workspace->getCpath(),
$workspace->getCpath());
// add allow condition
Expand Down
10 changes: 5 additions & 5 deletions src/Model/AbstractObjectActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public function cmfToArray()
$result = ObjectToArray::getInstance()->toArray($this);
unset($result['customer']);

$result['o_id'] = $this->getId();
$result['o_key'] = $this->getKey();
$result['o_path'] = $this->getRealFullPath();
$result['id'] = $this->getId();
$result['key'] = $this->getKey();
$result['path'] = $this->getRealFullPath();

return $result;
}
Expand All @@ -72,8 +72,8 @@ public function cmfUpdateData(array $data)
public static function cmfCreate(array $data, $fromWebservice = false)
{
$object = null;
if (!empty($data['o_id'])) {
$object = self::getById($data['o_id']);
if (!empty($data['id'])) {
$object = self::getById($data['id']);
}

if (is_null($object)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Model/CustomerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* @method \Pimcore\Model\DataObject\ClassDefinition getClass()
* @method static setPublished(bool $o_published)
* @method static setPublished(bool $published)
*/
interface CustomerInterface extends ElementInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Newsletter/ProviderHandler/Mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ protected function getAllExportableSegments()
$groups = $this->getExportableSegmentGroups();
$select = $groups->getQueryBuilder()
->resetQueryPart('select')
->select('o_id');
->select('id');

$segments = $this->segmentManager->getSegments();
$segments->addConditionParam('group__id in (' . $select . ')');
Expand Down Expand Up @@ -861,7 +861,7 @@ public function doesOtherSubscribedCustomerWithEmailExist($email, $customerId =
$list = $customerProvider->getList();
$customerProvider->addActiveCondition($list);
if ($customerId) {
$list->setCondition('trim(lower(email)) = ? and o_id != ?', [trim(strtolower($email)), $customerId]);
$list->setCondition('trim(lower(email)) = ? and id != ?', [trim(strtolower($email)), $customerId]);
} else {
$list->setCondition('trim(lower(email)) = ?', [trim(strtolower($email))]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Newsletter/Queue/DefaultNewsletterQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function enqueueAllCustomers()
$customerClassId = $customerProvider->getCustomerClassId();

$sql = sprintf(
"insert into %s (SELECT `o_id` AS `customerId`,`email`, 'update' AS `operation`, ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) AS `modificationDate` FROM `object_%s` WHERE o_published = 1 and o_id not in (select customerId from %s))",
"insert into %s (SELECT `id` AS `customerId`,`email`, 'update' AS `operation`, ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) AS `modificationDate` FROM `object_%s` WHERE published = 1 and id not in (select customerId from %s))",
self::QUEUE_TABLE,
$customerClassId,
self::QUEUE_TABLE
Expand Down
4 changes: 2 additions & 2 deletions src/RESTApi/CustomersHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public function listRecords(Request $request)
$customers = \Pimcore::getContainer()->get('cmf.customer_provider')->getList();
}

$customers->setOrderKey('o_id');
$customers->setOrderKey('id');
$customers->setOrder('asc');
$customers->setUnpublished(false);

if ($params->getModificationTimestamp()) {
$customers->addConditionParam('o_modificationDate > ?', $params->getModificationTimestamp());
$customers->addConditionParam('modificationDate > ?', $params->getModificationTimestamp());
}

$paginator = $this->handlePaginatorParams($customers, $request);
Expand Down
2 changes: 1 addition & 1 deletion src/RESTApi/SegmentGroupsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function listRecords(Request $request)
{
$list = new CustomerSegmentGroup\Listing();

$list->setOrderKey('o_id');
$list->setOrderKey('id');
$list->setOrder('asc');
$list->setUnpublished(false);

Expand Down
2 changes: 1 addition & 1 deletion src/RESTApi/SegmentsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function listRecords(Request $request)
{
$list = new CustomerSegment\Listing();

$list->setOrderKey('o_id');
$list->setOrderKey('id');
$list->setOrder('asc');
$list->setUnpublished(false);

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/public/js/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pimcore.plugin.customermanagementframework = Class.create({
var object = event.detail.object;
var type = event.detail.type;

if ("object" === type && object.data.general.o_className === pimcore.settings.cmf.customerClassName && pimcore.globalmanager.get("user").isAllowed(ActivityView.config.PERMISSION)) {
if ("object" === type && object.data.general.className === pimcore.settings.cmf.customerClassName && pimcore.globalmanager.get("user").isAllowed(ActivityView.config.PERMISSION)) {
aashan10 marked this conversation as resolved.
Show resolved Hide resolved
var panel = new ActivityView.ActivityTab(object, type).getPanel();

object.tab.items.items[1].insert(1, panel);
Expand Down Expand Up @@ -343,7 +343,7 @@ pimcore.plugin.customermanagementframework = Class.create({
var addTab = Boolean(pimcore.settings.cmf.segmentAssignment[type][subType]);

if('object' === type && 'folder' !== subType) {
addTab &= pimcore.settings.cmf.segmentAssignment[type][subType][element.data.general.o_className];
addTab &= pimcore.settings.cmf.segmentAssignment[type][subType][element.data.general.className];
}

if (!addTab) {
Expand Down
Loading