Installation
composer require dywee/order-cms-bundle
Ensure DyweeCoreBundle is installed (required for admin features).
Register Bundle
Add to config/bundles.php:
return [
// ...
Dywee\OrderCMSBundle\DyweeOrderCMSBundle::class => ['all' => true],
];
Routing
Add to config/routes.yaml:
dywee_order_cms:
resource: "@DyweeOrderCMSBundle/Controller/"
type: annotation
prefix: /admin/orders # Adjust prefix as needed
First Use Case
Access /admin/orders to view the default order management dashboard. The bundle assumes integration with DyweeCoreBundle for admin UI scaffolding.
Order Management
OrderController) for listing, creating, updating, and deleting orders.// Fetch orders via service (if exposed)
$orders = $this->get('dywee_order_cms.order_service')->findAll();
Note: Check src/DependencyInjection/DyweeOrderCMSBundleExtension.php for service definitions.Integration with DyweeCoreBundle
DyweeCoreBundle's admin grid system to customize order listings:
# config/packages/dywee_core.yaml
dywee_core:
admin:
grids:
order_grid:
model: Dywee\OrderCMSBundle\Entity\Order
fields: [id, customer, total, status, createdAt]
Entity Extensions
Order entity (located in Entity/Order.php) by overriding it in your project:
// src/Entity/Order.php
namespace App\Entity;
use Dywee\OrderCMSBundle\Entity\Order as BaseOrder;
class Order extends BaseOrder {
// Custom fields/methods
}
config/packages/doctrine.yaml to point to your extended entity.Event Listeners
order.pre_create):
// src/EventListener/OrderListener.php
namespace App\EventListener;
use Dywee\OrderCMSBundle\Event\OrderEvents;
class OrderListener {
public function onOrderCreate(OrderEvent $event) {
// Logic here
}
}
Register in services.yaml:
services:
App\EventListener\OrderListener:
tags:
- { name: kernel.event_listener, event: order.pre_create, method: onOrderCreate }
API Exposure (Optional)
use Symfony\Component\Serializer\Annotation\Groups;
class Order {
#[Groups(['order:read'])]
private $id;
// ...
}
Missing DyweeCoreBundle
DyweeCoreBundle for admin features. Install it first:
composer require dywee/dywee-core-bundle
Entity Overrides
Order entity, ensure your class is autoloaded and Doctrine is configured to use it. Clear cache after changes:
php bin/console cache:clear
Routing Conflicts
prefix: / in routing may clash with other bundles. Use a namespace-specific prefix (e.g., /admin/orders).Undocumented Services
src/DependencyInjection/ for available services and their configurations.Database Schema
Check Controller Annotations
OrderController) are properly loaded. Run:
php bin/console debug:router | grep dywee_order_cms
Enable Debug Mode
APP_DEBUG=true in .env to surface errors related to missing configurations or services.Event Dispatching
order.pre_create) aren’t firing, ensure:
services.yaml.Dywee\OrderCMSBundle\Event.Doctrine Entities
php bin/console doctrine:schema:validate
Custom Fields
Order entity and update the admin grid in dywee_core.yaml:
dywee_core:
admin:
grids:
order_grid:
fields: [id, customer, custom_field]
Order Status Workflow
OrderStatus entity or adding transitions via state machines (e.g., Symfony State Machine Bundle).API Resources
ApiPlatform or Serializer components.Testing
public function testOrderListing() {
$client = static::createClient();
$client->request('GET', '/admin/orders');
$this->assertResponseIsSuccessful();
}
How can I help you explore Laravel packages today?