clickandmortar/oro-platform-simple-item-bundle
Installation:
composer require clickandmortar/oro-platform-simple-item-bundle
Ensure your oro-platform version aligns with the supported matrix (e.g., 4.2.* for OroPlatform 4.2.*).
Post-Install Commands: Run the following in sequence (critical for entity configuration and assets):
php bin/console cache:clear
php bin/console doctrine:schema:update --force
php bin/console oro:entity-config:update --filter="ClickAndMortar*" --force
php bin/console assets:install --symlink --relative --no-interaction
php bin/console oro:assets:build --no-interaction
First Use Case:
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem and configure it via YAML (e.g., config/oro/entity/clickandmortar_simple_item.yml):
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem:
list:
title: 'Simple Items'
icon: icon-list
items_per_page: 20
SimpleItemController (if provided by the bundle).Entity Configuration:
oro_entity_config.yml:
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem:
grid:
columns:
name: ~
description: ~
SimpleItemType) or create a custom one:
use ClickAndMortar\SimpleItemBundle\Form\Type\SimpleItemType;
$builder->add('customField', TextType::class, ['required' => false]);
Integration with OroCRM:
SimpleItem to Oro entities (e.g., Account, Product) via many-to-one/many-to-many associations:
/**
* @ORM\ManyToOne(targetEntity="Oro\AccountBundle\Entity\Account")
*/
private $account;
prePersist, preUpdate) via Doctrine lifecycle callbacks or Oro’s event system:
$entityManager->getEventManager()->addEventListener(
\Doctrine\ORM\Events::prePersist,
[$this, 'onPrePersist']
);
API/REST:
oro_api.yml:
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem:
api:
enabled: true
collection:
fields:
- id
- name
Localization:
php bin/console oro:translation:dump
Add translations in translations/messages.en.yml:
ClickAndMortar\SimpleItemBundle:
simple_item.name: 'Item Name'
Schema Updates:
doctrine:schema:update --force after adding fields.--dry-run to preview changes:
php bin/console doctrine:schema:update --dry-run
Entity Config Caching:
oro_entity_config.yml not reflecting.php bin/console oro:entity-config:update --force
Asset Pipeline:
assets:install and oro:assets:build are run. For development, use:
php bin/console assets:install --watch
Version Conflicts:
4.2.* bundle with OroPlatform 4.1.*.composer.json:
"require": {
"clickandmortar/oro-platform-simple-item-bundle": "4.2.*",
"oro/platform": "4.2.*"
}
Symfony Profiler:
// config/packages/dev/oro_platform.yaml
oro_platform:
profiler: true
Doctrine Logging:
// config/packages/dev/doctrine.yaml
doctrine:
dbal:
logging: true
profiling: true
Event Listeners:
php bin/console debug:event-dispatcher
Custom Fields:
SimpleItemExtension (if supported) or override the form type:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('priority', EntityType::class, [
'class' => Priority::class,
'property' => 'name',
]);
}
Grid Actions:
oro_entity_config.yml:
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem:
grid:
actions:
view: ~
custom_action:
type: navigate
label: 'custom.label'
icon: icon-custom
route: clickandmortar_simpleitem_view
acl: true
Validation:
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\Length(max=255)
*/
private $name;
API Extensions:
oro_api.yml or create a custom serializer:
ClickAndMortar\SimpleItemBundle\Entity\SimpleItem:
api:
enabled: true
item:
fields:
- { name: 'fullName', type: 'string', data_name: 'name' }
How can I help you explore Laravel packages today?