|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This is the Sylius GridImportExportBundle, a Symfony bundle that provides grid import/export functionality for Sylius applications. It supports CSV and JSON export formats and uses Symfony Messenger for asynchronous processing. |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +### Testing |
| 12 | +- Run tests: `vendor/bin/phpunit` |
| 13 | +- Tests are located in `tests/` directory with subdirectories for Integration, Api, and Unit tests |
| 14 | + |
| 15 | +### Code Quality |
| 16 | +- Run coding standards check: `vendor/bin/ecs check` |
| 17 | +- Fix coding standards: `vendor/bin/ecs check --fix` |
| 18 | +- Run static analysis: `vendor/bin/phpstan analyse` |
| 19 | + |
| 20 | +### Dependencies |
| 21 | +- Install dependencies: `composer install` |
| 22 | +- Update dependencies: `composer update` |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +### Core Components |
| 27 | + |
| 28 | +**Entity Layer** |
| 29 | +- `Process` entity (`src/Entity/Process.php`) - Tracks export processes with UUID, status, format, and output |
| 30 | +- Uses Doctrine ORM with XML mapping (`config/doctrine/Process.orm.xml`) |
| 31 | + |
| 32 | +**Export System** |
| 33 | +- `ExporterInterface` - Contract for all exporters |
| 34 | +- `AbstractExporter` - Base implementation with common functionality |
| 35 | +- `CsvExporter` and `JsonExporter` - Format-specific implementations |
| 36 | +- `ExporterResolver` - Factory for selecting appropriate exporter |
| 37 | + |
| 38 | +**Data Providers** |
| 39 | +- `ResourceDataProviderInterface` - Contract for providing resource data |
| 40 | +- `DefaultResourceDataProvider` - Default implementation |
| 41 | +- `RequestBasedResourcesIdsProvider` - Provides resource IDs from HTTP requests |
| 42 | + |
| 43 | +**Processing** |
| 44 | +- Uses Symfony Messenger for asynchronous processing |
| 45 | +- `ExportCommand` - Command message for export jobs |
| 46 | +- `ExportCommandHandler` - Handles export processing |
| 47 | + |
| 48 | +**UI Integration** |
| 49 | +- Integrates with Sylius Admin UI using Twig hooks |
| 50 | +- Custom form types for export configuration |
| 51 | +- Grid listeners for adding export actions |
| 52 | +- Live Components for dynamic UI updates |
| 53 | + |
| 54 | +### Key Directories |
| 55 | +- `src/Controller/` - HTTP endpoints for exports and downloads |
| 56 | +- `src/Messenger/` - Async command handling |
| 57 | +- `src/Grid/` - Grid integration and export actions |
| 58 | +- `src/Form/` - Form types and choice loaders |
| 59 | +- `templates/admin/` - Twig templates for admin interface |
| 60 | +- `config/` - Bundle configuration and service definitions |
| 61 | +- `assets/` - Frontend JavaScript controllers |
| 62 | + |
| 63 | +### Configuration |
| 64 | +- Main config: `config/config.yaml` |
| 65 | +- Services: `config/services.xml` |
| 66 | +- Routes: `config/routes.yaml` and `config/routes/admin.yaml` |
| 67 | +- Grid config: `config/config/sylius_grid.yaml` |
| 68 | + |
| 69 | +## Bundle Structure |
| 70 | + |
| 71 | +This follows standard Symfony bundle conventions: |
| 72 | +- Main bundle class: `SyliusGridImportExportBundle` |
| 73 | +- DI Extension: `SyliusGridImportExportExtension` |
| 74 | +- PSR-4 autoloading with `Sylius\GridImportExport\` namespace |
| 75 | +- Uses Sylius coding standards and requires PHP 8.2+ |
0 commit comments