-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* MKP-688: PIM 2.0 compatibility * Update documentation * Migrate jobs to 2.0 * fix specs * PIM 2.0 migration: composer update * PIM 2.0 migration: fix Travis * PIM 2.0 migration: fix Jenkins * PIM 2.0 migration: update README
- Loading branch information
Showing
83 changed files
with
7,440 additions
and
1,762 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
bin | ||
vendor | ||
.php_cs.cache | ||
docker-compose.yml |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
language: php | ||
|
||
php: | ||
- 5.6 | ||
- 7.1 | ||
|
||
git: | ||
depth: 10 | ||
|
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 |
---|---|---|
|
@@ -3,9 +3,9 @@ | |
def launchIntegrationTests = "no" | ||
|
||
class Globals { | ||
static pimVersion = "1.7" | ||
static extensionBranch = "1.2.x-dev" | ||
static mysqlVersion = "5.5" | ||
static pimVersion = "2.0" | ||
static extensionBranch = "2.0.x-dev" | ||
static mysqlVersion = "5.7" | ||
} | ||
|
||
stage("Checkout") { | ||
|
@@ -34,7 +34,7 @@ if (launchIntegrationTests.equals("yes")) { | |
stage("Integration tests") { | ||
def tasks = [:] | ||
|
||
tasks["phpunit-5.6-ee"] = {runIntegrationTest("5.6", "${Globals.mysqlVersion}")} | ||
tasks["phpunit-7.1-ee"] = {runIntegrationTest("7.1", "${Globals.mysqlVersion}")} | ||
|
||
parallel tasks | ||
} | ||
|
@@ -45,45 +45,44 @@ def runIntegrationTest(phpVersion, mysqlVersion) { | |
cleanUpEnvironment() | ||
|
||
try { | ||
docker.image("mysql:5.5") | ||
.withRun("--name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=akeneo_pim -e MYSQL_PASSWORD=akeneo_pim -e MYSQL_DATABASE=akeneo_pim --tmpfs=/var/lib/mysql/:rw,noexec,nosuid,size=1000m --tmpfs=/tmp/:rw,noexec,nosuid,size=300m") { | ||
docker.image("akeneo/php:5.6") | ||
.inside("--link mysql:mysql -v /home/akeneo/.composer:/home/akeneo/.composer -e COMPOSER_HOME=/home/akeneo/.composer") { | ||
unstash "pim_enterprise" | ||
|
||
if (phpVersion != "5.6") { | ||
sh "composer require --no-update alcaeus/mongo-php-adapter" | ||
} | ||
|
||
sh """ | ||
composer config repositories.icecat '{"type": "vcs", "url": "[email protected]:akeneo/icecat-connector.git", "branch": "master"}' | ||
php -d memory_limit=3G /usr/local/bin/composer require phpunit/phpunit:5.4.* akeneo/icecat-connector:${Globals.extensionBranch} --no-interaction --no-progress --prefer-dist | ||
""" | ||
|
||
dir("vendor/akeneo/icecat-connector") { | ||
deleteDir() | ||
unstash "icecat_extension" | ||
docker.image("elasticsearch:5.5") | ||
.withRun("--name elasticsearch -e ES_JAVA_OPTS=\"-Xms512m -Xmx512m\"") { | ||
docker.image("mysql:5.7") | ||
.withRun("--name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=akeneo_pim -e MYSQL_PASSWORD=akeneo_pim -e MYSQL_DATABASE=akeneo_pim --tmpfs=/var/lib/mysql/:rw,noexec,nosuid,size=1000m --tmpfs=/tmp/:rw,noexec,nosuid,size=300m") { | ||
docker.image("akeneo/php:${phpVersion}") | ||
.inside("--link mysql:mysql --link elasticsearch:elasticsearch -v /home/akeneo/.composer:/home/docker/.composer -e COMPOSER_HOME=/home/docker/.composer") { | ||
unstash "pim_enterprise" | ||
|
||
sh """ | ||
composer config repositories.icecat '{"type": "vcs", "url": "[email protected]:akeneo/icecat-connector.git", "branch": "master"}' | ||
php -d memory_limit=3G /usr/local/bin/composer require phpunit/phpunit:5.4.* akeneo/icecat-connector:${Globals.extensionBranch} --no-interaction --no-progress --prefer-dist | ||
""" | ||
|
||
dir("vendor/akeneo/icecat-connector") { | ||
deleteDir() | ||
unstash "icecat_extension" | ||
} | ||
sh 'composer dump-autoload -o' | ||
|
||
sh """ | ||
rm app/cache/* -rf | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\IcecatConnectorBundle\\\\PimIcecatConnectorBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedMeasureBundle\\\\PimExtendedMeasureBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedAttributeTypeBundle\\\\PimExtendedAttributeTypeBundle(),#' app/AppKernel.php | ||
cat app/AppKernel.php | ||
""" | ||
|
||
sh """ | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/parameters_test.yml app/config/parameters_test.yml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/routing.yml >> app/config/routing.yml | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/phpunit.xml app/phpunit.xml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/config_test.yml >> app/config/config_test.yml | ||
mkdir -p app/build/logs | ||
""" | ||
sh "sleep 10" | ||
sh "bin/console pim:install --force --env=test" | ||
sh "vendor/bin/phpunit -c app/phpunit.xml --log-junit app/build/logs/phpunit.xml" | ||
} | ||
sh 'composer dump-autoload -o' | ||
|
||
sh """ | ||
rm app/cache/* -rf | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\IcecatConnectorBundle\\\\PimIcecatConnectorBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedMeasureBundle\\\\PimExtendedMeasureBundle(),#' app/AppKernel.php | ||
sed -i 's#// your app bundles should be registered here#\\0\\nnew Pim\\\\Bundle\\\\ExtendedAttributeTypeBundle\\\\PimExtendedAttributeTypeBundle(),#' app/AppKernel.php | ||
cat app/AppKernel.php | ||
""" | ||
|
||
sh """ | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/parameters_test.yml app/config/parameters_test.yml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/routing.yml >> app/config/routing.yml | ||
cp vendor/akeneo/icecat-connector/src/Resources/jenkins/phpunit.xml app/phpunit.xml | ||
cat vendor/akeneo/icecat-connector/src/Resources/jenkins/config_test.yml >> app/config/config_test.yml | ||
mkdir -p app/build/logs | ||
""" | ||
|
||
sh "app/console pim:install --force --env=test" | ||
sh "bin/phpunit -c app/phpunit.xml --log-junit app/build/logs/phpunit.xml" | ||
} | ||
} | ||
} finally { | ||
|
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ It can be used with both Open Icecat free catalog or Full Icecat paid catalog. | |
|
||
| IcecatConnectorBundle | Akeneo PIM Community Edition | | ||
|:---------------------:|:----------------------------:| | ||
| 2.0.* | v2.0.* | | ||
| 1.2.* | v1.7.* | | ||
| 1.1.* | v1.7.* | | ||
| 1.0.* | v1.6.* | | ||
|
@@ -64,7 +65,7 @@ First, you must require the connector dependencies: | |
|
||
```php | ||
composer config repositories.icecat '{"type": "vcs", "url": "ssh://[email protected]:443/IcecatConnector", "branch": "master"}' | ||
composer require akeneo/icecat-connector 1.2.* | ||
composer require akeneo/icecat-connector 2.0.* | ||
``` | ||
|
||
## Registering the bundle | ||
|
@@ -82,7 +83,7 @@ pim_icecat_connector: | |
### Register dependencies and override product value model | ||
The Icecat connector uses a new attribute type to store pictures url collection. | ||
You must then activate the dependencies bundles and add a custom one to override the original ProductValue class: | ||
You must then activate the dependencies bundles: | ||
In `app/AppKernel.php`: | ||
|
||
|
@@ -93,24 +94,18 @@ In `app/AppKernel.php`: | |
new \Pim\Bundle\ExtendedAttributeTypeBundle\PimExtendedAttributeTypeBundle(), | ||
new \Pim\Bundle\ExtendedMeasureBundle\PimExtendedMeasureBundle(), | ||
new \Pim\Bundle\IcecatConnectorBundle\PimIcecatConnectorBundle(), | ||
new \MyCompany\Bundle\MyBundle\MyPimBundle(), // Your custom bundle with overriden ProductValue | ||
]; | ||
} | ||
``` | ||
|
||
### Add new Mass Operation: | ||
``` | ||
app/console akeneo:batch:create-job "Akeneo Mass Edit Connector" "mass_edit_icecat_enrichment" "mass_edit" "mass_edit_icecat_enrichment" | ||
``` | ||
More explanation about the ProductValue override can be found in Akeneo documentation: | ||
https://docs.akeneo.com/1.7/cookbook/catalog_structure/overriding_the_orm_product_value.html | ||
Do not forget to update the mapping for your brand new product value in `app/config/config.yml`: | ||
|
||
```yaml | ||
akeneo_storage_utils: | ||
mapping_overrides: | ||
- | ||
original: PimEnterprise\Component\Catalog\Model\ProductValue | ||
override: Pim\Bundle\ExtendedCeBundle\Model\ProductValue | ||
``` | ||
|
||
### Add new Mass Operation: | ||
``` | ||
app/console akeneo:batch:create-job "Akeneo Mass Edit Connector" "mass_edit_icecat_enrichment" "mass_edit" "mass_edit_icecat_enrichment" | ||
|
@@ -119,8 +114,6 @@ app/console akeneo:batch:create-job "Akeneo Mass Edit Connector" "mass_edit_icec | |
In an Enterpise Edition context, you must also add the corresponding permissions: | ||
https://docs.akeneo.com/1.7/cookbook/mass_edition/register_a_new_mass_edit_action.html#phase-6-add-user-groups-permissions-to-job-profiles-enterprise-edition | ||
Copy the mass edit view `icecat-enrichment.html.twig` in your `app/Resources` directory. | ||
To facilitate this configuration, the bundle provides a `bin/setup.bash` to make this operations in one command line. | ||
### Mapping between Icecat locales and PIM locales | ||
|
@@ -169,37 +162,8 @@ LV | lv_LV (Latvian) | |
ID | id_ID (Indonesian) | ||
SK | sk_SK (Slovakian) | ||
### (Optionnal) Example bundles | ||
This connector is shipped with complete example bundle, especially to override the ProductValue model. | ||
This is needed to use the new TextCollection attribute type. | ||
The easiest way to enable it is to use a symbolic link: | ||
``` | ||
cd src | ||
ln -s ../vendor/akeneo/extended-attribute-type/doc/example/Pim Pim | ||
``` | ||
After that, you will be able to use the example bundles in `app/AppKernel.php`: | ||
```php | ||
protected function registerProjectBundles() | ||
{ | ||
return [ | ||
new \Pim\Bundle\ExtendedAttributeTypeBundle\PimExtendedAttributeTypeBundle(), | ||
new \Pim\Bundle\ExtendedMeasureBundle\PimExtendedMeasureBundle(), | ||
new \Pim\Bundle\IcecatConnectorBundle\PimIcecatConnectorBundle(), | ||
new \Pim\Bundle\ExtendedCeBundle\ExtendedCeBundle(), // example CE bundle to activate the extended attributes | ||
//new \Pim\Bundle\ExtendedEeBundle\ExtendedEeBundle(), // example EE bundle to activate the extended attributes | ||
]; | ||
} | ||
``` | ||
|
||
### Update the DB schema | ||
The ExtendedAttributeTypeBundle need to add some tables from the ProductValue override and you must update the Doctrine schema. | ||
|
||
One way to this is using the command `app/console doctrine:schema:update`. | ||
You will habe to specify an option for this command: | ||
|
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 |
---|---|---|
@@ -1,11 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
APP_DIR="$(readlink -e $SCRIPT_DIR/./../../../../app)" | ||
APP_VIEWS_DIR="$APP_DIR/Resources/PimEnrichBundle/views" | ||
echo $APP_DIR | ||
mkdir -p $APP_VIEWS_DIR/MassEditAction/product/configure | ||
cp ./../src/Resources/views/icecat-enrichment.html.twig $APP_VIEWS_DIR/MassEditAction/product/configure | ||
BIN_DIR="$(readlink -e $SCRIPT_DIR/./../../../../bin)" | ||
|
||
cd $APP_DIR | ||
cd $BIN_DIR | ||
echo $(pwd) | ||
./console akeneo:batch:create-job "Akeneo Mass Edit Connector" "mass_edit_icecat_enrichment" "mass_edit" "mass_edit_icecat_enrichment" |
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.