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

Introduce 4.0 compatibility #68

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/Completeness/Checker/TextCollectionCompleteChecker.php

This file was deleted.

100 changes: 0 additions & 100 deletions src/Factory/Value/TextCollectionValueFactory.php

This file was deleted.

62 changes: 0 additions & 62 deletions src/Model/TextCollectionValue.php

This file was deleted.

41 changes: 0 additions & 41 deletions src/Normalizer/Indexing/Value/TextCollectionNormalizer.php

This file was deleted.

28 changes: 11 additions & 17 deletions ...alueConverter/TextCollectionConverter.php → ...alueConverter/TextCollectionConverter.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\ArrayConverter\FlatToStandard\Product\ValueConverter;

use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\TextCollectionType;
use Pim\Component\Connector\ArrayConverter\FlatToStandard\Product\ValueConverter\ValueConverterInterface;
use Akeneo\Pim\Enrichment\Component\Product\Connector\ArrayConverter\FlatToStandard\FieldSplitter;
use Akeneo\Pim\Enrichment\Component\Product\Connector\ArrayConverter\FlatToStandard\ValueConverter\AbstractValueConverter;

//use Pim\Component\Connector\ArrayConverter\FlatToStandard\Product\ValueConverter\ValueConverterInterface;

/**
* Converts a text collection value from Akeneo PIM flat format to Akeneo PIM standard format
Expand Down Expand Up @@ -31,25 +33,17 @@
* @copyright 2017 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class TextCollectionConverter implements ValueConverterInterface
class TextCollectionConverter extends AbstractValueConverter
{
/** @var string[] */
protected $supportedFieldTypes;

/**
* @param string[] $supportedFieldTypes
* @param FieldSplitter $fieldSplitter
* @param array $supportedFieldType
*/
public function __construct(array $supportedFieldTypes)
public function __construct(FieldSplitter $fieldSplitter, array $supportedFieldType)
{
$this->supportedFieldTypes = $supportedFieldTypes;
}
parent::__construct($fieldSplitter);

/**
* {@inheritdoc}
*/
public function supportsField($attributeType)
{
return in_array($attributeType, $this->supportedFieldTypes);
$this->supportedFieldType = $supportedFieldType;
}

/**
Expand All @@ -65,7 +59,7 @@ public function convert(array $attributeFieldInfo, $value)
$attributeFieldInfo['attribute']->getCode() => [[
'locale' => $attributeFieldInfo['locale_code'],
'scope' => $attributeFieldInfo['scope_code'],
'data' => explode(TextCollectionType::FLAT_SEPARATOR, $value),
'data' => $this->fieldSplitter->splitCollection($value)
]],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\ArrayConverter\StandardToFlat\Product\ValueConverter;

use Akeneo\Pim\Enrichment\Component\Product\Connector\ArrayConverter\StandardToFlat\Product\ValueConverter\AbstractValueConverter;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\TextCollectionType;
use Pim\Component\Connector\ArrayConverter\StandardToFlat\Product\ValueConverter\AbstractValueConverter;
use Pim\Component\Connector\ArrayConverter\StandardToFlat\Product\ValueConverter\ValueConverterInterface;
//use Pim\Component\Connector\ArrayConverter\StandardToFlat\Product\ValueConverter\AbstractValueConverter;
//use Pim\Component\Connector\ArrayConverter\StandardToFlat\Product\ValueConverter\ValueConverterInterface;

/**
* Converts a text collection value from Akeneo PIM standard format to Akeneo PIM flat format
Expand Down Expand Up @@ -32,7 +33,7 @@
* @copyright 2017 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class TextCollectionConverter extends AbstractValueConverter implements ValueConverterInterface
class TextCollectionConverter extends AbstractValueConverter
{
/**
* Converts a value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

namespace Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType;

/**
* Extended attribute types dictionary
*
Expand All @@ -13,5 +12,5 @@ final class ExtendedAttributeTypes
{
const TEXT_COLLECTION = 'pim_catalog_text_collection';

const BACKEND_TYPE_TEXT_COLLECTION = 'textCollection';
const BACKEND_TYPE_TEXT_COLLECTION = 'text_collection';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the backend type?

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType;

use Pim\Bundle\CatalogBundle\AttributeType\AbstractAttributeType;
//use Pim\Bundle\CatalogBundle\AttributeType\AbstractAttributeType;
use Akeneo\Pim\Structure\Component\AttributeType\AbstractAttributeType;

/**
* Text collection attribute type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Component\Product\Completeness\MaskItemGenerator;

use Akeneo\Pim\Enrichment\Component\Product\Completeness\MaskItemGenerator\MaskItemGeneratorForAttributeType;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;

class ExtendedAttributeTypeMaskItem implements MaskItemGeneratorForAttributeType
{
public function forRawValue(string $attributeCode, string $channelCode, string $localeCode, $value): array
{
return [
sprintf(
'%s-%s-%s',
$attributeCode,
$channelCode,
$localeCode
)
];
}

public function supportedAttributeTypes(): array
{
return [
ExtendedAttributeTypes::TEXT_COLLECTION
];
}
}
File renamed without changes.
Loading