Install via Composer
Requires a Symfony-based application (e.g., platform-application skeleton).
composer create-project orocrm/platform-application my-app
First Use Case: Scaffold a Basic Entity
Use Oro’s CLI or YAML-based definitions to create a Product entity:
php bin/console oro:generate:entity Product
app/config/oro/entity-definitions.yml:
Oro\Bundle\EntityBundle\Entity\Entity:
fields:
name: ~
price: { type: decimal }
Key Initial Commands
php bin/console oro:navigation:update → Sync UI navigation.php bin/console oro:entity:generate → Auto-generate CRUD.php bin/console oro:workflow:generate → Bootstrap workflows.Entity-Centric Development
oro_entity_config for dynamic fields).
// app/Resources/OroEntityConfig/fields.yml
Oro\Bundle\ProductBundle\Entity\Product:
fields:
sku: { type: string, form_type: oro_form_field_text }
oro_entity.pre_update, oro_entity.post_remove) or services (oro_entity.manager).UI Customization
app/Resources/OroLayout/ (e.g., default.html.twig).app/Resources/public/css/ or SASS variables in app/Resources/OroTheme/.app/config/oro/navigation.yml:
items:
product_index:
label: Products
route: oro_product_index
position: 10
API Integration
oro_rest bundle. Extend with custom serializers:
// src/Acme/ProductBundle/Serializer/ProductNormalizer.php
use Oro\Bundle\SoapBundle\Serializer\Normalizer\AbstractNormalizer;
class ProductNormalizer extends AbstractNormalizer { ... }
oro_graphql for complex queries (requires oro-platform-graphql package).Permissions & Security
oro_entity_config:
Oro\Bundle\ProductBundle\Entity\Product:
scopes:
default: { label: Default, type: entity }
mine: { label: My Products, type: user }
app/config/oro/acl.yml:
Oro\Bundle\ProductBundle\Entity\Product:
view: ROLE_USER
edit: ROLE_ADMIN
Workflows & Automation
app/config/oro/workflow.yml:
Oro\Bundle\ProductBundle\Entity\Product:
workflows:
product_lifecycle:
steps:
draft: { label: Draft }
published: { label: Published, transition: publish }
oro_workflow events (e.g., oro_workflow.entity.transition).Entity Generation Quirks
oro:entity:generate may skip fields if Entity class isn’t properly namespaced.
Fix: Ensure use Oro\Bundle\EntityBundle\Entity\Entity; is present.oro_entity_config updates and a FormType class.
Fix: Implement Oro\Bundle\EntityConfigBundle\Form\Type\AbstractEntityFieldType.Caching Headaches
php bin/console cache:clear or debug with:
php bin/console debug:config oro_layout
Permission Overrides
acl.yml override Symfony’s voter system. Test with:
php bin/console debug:acl
API Serialization
oro_rest serializers or use @ORM\Expose annotations.Workflow Debugging
app/config/config.yml:
oro_workflow:
debug: true
transition definitions in workflow YAML.Dynamic Field Types
Use oro_entity_config to toggle fields at runtime:
Oro\Bundle\ProductBundle\Entity\Product:
fields:
discount:
form_type: oro_form_field_percentage
enabled: false # Disable via config
Bulk Operations
Leverage oro_entity batch processing:
$entityManager = $this->get('oro_entity.entity_manager');
$batch = $entityManager->getRepository(Product::class)->findAll();
$entityManager->updateBatch($batch, ['price' => 19.99]);
Localization
Translate labels via oro_translation:
# app/Resources/translations/messages.en.yml
Oro\Bundle\ProductBundle: Product
Oro\Bundle\ProductBundle:Field:price: Price (USD)
Testing Use Oro’s test utilities:
$this->get('oro_entity.entity_manager')->getRepository(Product::class)->create(['name' => 'Test']);
$this->get('oro_workflow.workflow_manager')->transition($entity, 'publish');
Extending OroCRM/OroCommerce
composer.json:
"replace": {
"orocrm/product": "path/to/your-bundle"
}
oro:platform:update to sync core changes post-upgrade.Performance
oro_entity DQL helpers:
$qb = $entityManager->getRepository(Product::class)->createQueryBuilder('p');
$qb->select('p.id, p.name')->where('p.price > :min')->setParameter('min', 10);
ORM\Query\Query::HYDRATE_ARRAY for bulk loads.How can I help you explore Laravel packages today?