-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AKM-20: Compatibility with the non-empty filename fix for OroCommerce …
- Disable DAM - Reuse UUID from the DB - Fix validators performance - Fix files import
- Loading branch information
Showing
11 changed files
with
363 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\AkeneoBundle\EventListener; | ||
|
||
use Doctrine\ORM\Event\LoadClassMetadataEventArgs; | ||
use Oro\Bundle\AttachmentBundle\Entity\File; | ||
|
||
class LoadClassMetadataListener | ||
{ | ||
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) | ||
{ | ||
$classMetadata = $eventArgs->getClassMetadata(); | ||
|
||
if (is_a($classMetadata->getName(), File::class, true)) { | ||
$classMetadata->table['indexes']['oro_akeneo_file_parent_index'] = [ | ||
'columns' => ['parent_entity_class', 'parent_entity_id'], | ||
]; | ||
|
||
$classMetadata->fieldMappings[$classMetadata->getFieldForColumn('parent_entity_class')]['length'] = 255; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\DotmailerBundle\Migrations\Data\ORM; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Oro\Bundle\EntityConfigBundle\Config\ConfigManager; | ||
use Oro\Bundle\ProductBundle\Entity\ProductImage; | ||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | ||
|
||
class DisableDAM extends AbstractFixture implements ContainerAwareInterface | ||
{ | ||
use ContainerAwareTrait; | ||
|
||
public function load(ObjectManager $manager) | ||
{ | ||
/** @var ConfigManager $configManager */ | ||
$configManager = $this->container->get('oro_entity_config.config_manager'); | ||
$attachmentProvider = $configManager->getProvider('attachment'); | ||
$attachmentConfig = $attachmentProvider->getConfig(ProductImage::class, 'image'); | ||
$attachmentConfig->set('use_dam', false); | ||
|
||
$configManager->persist($attachmentConfig); | ||
$configManager->flush(); | ||
} | ||
} |
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,71 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\AkeneoBundle\Migrations\Schema\v1_14; | ||
|
||
use Doctrine\DBAL\Platforms\MySqlPlatform; | ||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Extension\DatabasePlatformAwareInterface; | ||
use Oro\Bundle\MigrationBundle\Migration\Extension\DatabasePlatformAwareTrait; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
class OroAkeneoMigration implements Migration, DatabasePlatformAwareInterface | ||
{ | ||
use DatabasePlatformAwareTrait; | ||
|
||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET owner_user_id = (SELECT default_user_owner_id FROM oro_integration_channel WHERE type = 'oro_akeneo' LIMIT 1) | ||
WHERE owner_user_id IS NULL | ||
AND parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\Product' | ||
AND parent_entity_field_name LIKE 'Akeneo%';" | ||
); | ||
|
||
if ($this->platform instanceof MySqlPlatform) { | ||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET uuid = UUID(); | ||
WHERE parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\Product' | ||
AND parent_entity_field_name LIKE 'Akeneo%';" | ||
); | ||
} elseif ($this->platform instanceof PostgreSqlPlatform) { | ||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET uuid = uuid_generate_v4() | ||
WHERE parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\Product' | ||
AND parent_entity_field_name LIKE 'Akeneo%';" | ||
); | ||
} | ||
|
||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET owner_user_id = (SELECT default_user_owner_id FROM oro_integration_channel WHERE type = 'oro_akeneo' LIMIT 1) | ||
WHERE owner_user_id IS null | ||
AND parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\ProductImage' | ||
AND parent_entity_field_name = 'image';" | ||
); | ||
|
||
if ($this->platform instanceof MySqlPlatform) { | ||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET uuid = UUID(); | ||
WHERE parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\ProductImage' | ||
AND parent_entity_field_name = 'image';" | ||
); | ||
} elseif ($this->platform instanceof PostgreSqlPlatform) { | ||
$queries->addPostQuery( | ||
"UPDATE oro_attachment_file | ||
SET uuid = uuid_generate_v4() | ||
WHERE parent_entity_class = 'Oro\Bundle\ProductBundle\Entity\ProductImage' | ||
AND parent_entity_field_name = 'image';" | ||
); | ||
} | ||
|
||
$table = $schema->getTable('oro_attachment_file'); | ||
$table->getColumn('parent_entity_class')->setLength(255); | ||
$table->addIndex(['parent_entity_class', 'parent_entity_id'], 'oro_akeneo_file_parent_index'); | ||
} | ||
} |
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
Oops, something went wrong.