Download the PHP package kiboko/akeneo-enrich-bundle without Composer
On this page you can find all versions of the php package kiboko/akeneo-enrich-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package akeneo-enrich-bundle
Akeneo Enrich Bundle by Kiboko
==============================
What this project is ?
The project is an enhancement of the CustomEntityBundle from Akeneo : https://github.com/akeneo-labs/CustomEntityBundle.
What the project does ?
This bundle helps developers to create more quickly and easily custom reference data for your PIM and related views in Akeneo.
Why this project is useful ?
Custom PIM reference data are often required to meet each project's business needs and specificities.
Need help ?
If you need help concerning this bundle you can reach the Kiboko developer team at : [email protected] or at +33 (0)471 027 223. We are open from 9am to 12:30pm and from 2pm to 5pm at Paris time.
How to: create a custom reference data
The Kiboko entity helper traits
We built 3 helper traits for common attributes that constitue most of custom entity reference data.
- Labeled: A short text label
- Described: A long text description
- Pictured: A picture
All of three are translatable and use an optimized UX for PIM using lots of locales at the same time.
The Custom Entity
First, you will have to create your custom entity class, in the following example we will call it Pictogram
.
As you can notice, the class is implementing five interfaces :
ReferenceDataInterface
andTranslatableInterface
from Akeneo bundles. If you need more information about them please refere to their documentation: https://docs.akeneo.com/1.7/index.html .DescribedInterface
,LabeledInterface
andPicturedInterface
are provided by this bundle as helpers
The default implementation of the interfaces is made in traits:
TranslatableCustomEntityTrait
, forTranslatableInterface
andReferenceDataInterface
concrete implementationsDescribedTrait
forDescribedInterface
implementationLabeledTrait
forLabeledInterface
implementationPicturedTrait
forPicturedInterface
implementation
Check the CustomEntityBundle documentation for explanations of the other methods declared in the example.
The Custom Entity Translation
If you wnt to managed translations you need to create a custom entity translation class,
in the following example we will call it PictogramTranslation
.
This class extends AbstractTranslation
as stated by the CustomEntityBundle documentation.
It also have to implement the translation interface and use their corresponding translation helper traits :
LabeledTranslationTrait
forLabeledTranslationInterface
implementationDescribedTranslationTrait
forDescribedTranslationInterface
implementationPicturedTranslationTrait
forPicturedTranslationInterface
implementation
The Doctrine configuration
In doctrine folder create the custom entity mapping in Resources/config/doctrine/Pictogram.orm.yml
For the pictureFallback
field a oneToOne relation is required to the FileInfo
model.
In order to manage translations a oneToMany relation is required.
If you want to manage translation you also need to create the mapping for the translation entity in Resources/config/doctrine/PictogramTranslation.orm.yml
Again, for the picture
field a oneToOne relation is required to the FileInfo
model.
Don't forget to create migration file or update your schema:
app/console doctrine:migration:diff
(preferred)app/console doctrine:schema:update --force
(dangerous, reserved for advanced users)
Datagrid configuration
Your custom entity is now declared, you need to realize the data grid configuration and the form mapping.
In your bundle create a datagrid folder in it create yaml file:
Resources/config/datagrid/pictogram.yml
The section below configure the custom reference data entity to use.
Creating the Form Type for creation and edition
In your bundle create a Form folder, and a subfolder Type.
Add inside this folder create the custom entity type class that extends CustomEntityType.
In our exemple we call it PictogramType.
For each kiboko model you will use, you need to add to your form builder the correct mapping.
In our exemple we mapped label, description and picture models with their respective translatation field.
This class also need to implement :
getName()
: return the form custom entity type namesetDefaultOption(OptionsResolverInterface $resolver)
: require to manage models translations
Now let's see to configure doctrine for our custom entity.
The Form Type configuration file
In the config folder of your bundle create a yaml file named 'form_types.yml'.
Resources/config/form_types.yml
This is where you have to mappe a form type with your custom data reference entity.
The Custom Entities configuration file
In the config folder of your bundle create a yaml file named 'custom_entities.yml'.
Resources/config/custom_entities.yml
This is where you have to define the services used for each action used in your datagrid.
Form view
Now you are ready to create your custom entity form view.
Create in the views folder of your bundle a twig file named form.html.twig
as specified in your
custom entities configuration file.
Resources/views/Pictogram/form.html.twig
Kiboko, who we are ?
Kiboko is a consulting and development agency for e-commerce and business solutions, created by the reunion of 3 e-commerce seasoned developers, working on various scale of e-commerce websites. Depending on your business needs, Kiboko develops and maintains e-commerce web stores using Magento and OroCommerce. Kiboko also integrates Akeneo (PIM), OroCRM (CRM) and Marello (ERP) into pre-existing environement or into a new one to build as your business needs. Kiboko has been one of the first companies to trust OroCommerce as a true B2B e-commerce solution and one of the first to release live a web store using it.
Contributing
Please feel free to create new issues on Github