-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
- Loading branch information
Showing
10 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace OroCRM\Bundle\MagentoBundle\Datagrid; | ||
|
||
use Oro\Bundle\DataGridBundle\Extension\GridViews\AbstractViewsList; | ||
use Oro\Bundle\DataGridBundle\Extension\GridViews\View; | ||
use Oro\Bundle\FilterBundle\Form\Type\Filter\NumberRangeFilterType; | ||
|
||
class CartViewList extends AbstractViewsList | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getViewsList() | ||
{ | ||
return [ | ||
(new View( | ||
'non_empty', | ||
[ | ||
'itemsQty' => [ | ||
'type' => NumberRangeFilterType::TYPE_GREATER_THAN, | ||
'value' => 0, | ||
], | ||
] | ||
)) | ||
->setLabel($this->translator->trans('orocrm.magento.datagrid.views.non_empty_carts.label')) | ||
->setDefault(true) | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/OroCRM/Bundle/SalesBundle/Migrations/Schema/v1_25_5/OroCRMSalesBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace OroCRM\Bundle\SalesBundle\Migrations\Schema\v1_25_5; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
class OroCRMSalesBundle implements Migration | ||
{ | ||
/** | ||
* Changes account_id to onDelete=CASCADE | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$this->changeOnDeleteToCascade( | ||
$schema, | ||
[ | ||
'orocrm_sales_b2bcustomer' => ['account_id'], | ||
'orocrm_sales_opportunity' => ['customer_id'], | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
* @param array $data | ||
* [ | ||
* table name => [column name, ...], | ||
* ... | ||
* ] | ||
*/ | ||
protected function changeOnDeleteToCascade(Schema $schema, array $data) | ||
{ | ||
foreach ($data as $tableName => $columns) { | ||
$table = $schema->getTable($tableName); | ||
foreach ($columns as $column) { | ||
$foreignKeys = $table->getForeignKeys(); | ||
foreach ($foreignKeys as $foreignKey) { | ||
$foreignKeyColumns = $foreignKey->getUnquotedLocalColumns(); | ||
if ($foreignKeyColumns === [$column]) { | ||
if ($foreignKey->getOption('onDelete') !== 'CASCADE') { | ||
$table->removeForeignKey($foreignKey->getName()); | ||
$table->addForeignKeyConstraint( | ||
$foreignKey->getUnqualifiedForeignTableName(), | ||
$foreignKeyColumns, | ||
$foreignKey->getUnquotedForeignColumns(), | ||
['onDelete' => 'CASCADE', 'onUpdate' => $foreignKey->getOption('onUpdate')] | ||
); | ||
} | ||
|
||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |