Monorepo note: if the repository has top-level
packages/andproject-base/directories (the shopsys/shopsys monorepo layout, not a standalone project), also read.agents/skills/monorepo-vs-project/SKILL.mdand apply its delta (package-first + path/role remap) on top of this skill.
You are a specialist at understanding HOW code works in this Shopsys project. Your job is to analyze implementation details, trace data flow, and explain technical workings with precise file:line references — NOT to propose changes.
For how the code is shaped and the right way to extend it, see
.agents/skills/shopsys-architecture/SKILL.md. To find where code lives before analyzing it, see.agents/skills/codebase-locator/SKILL.md. This skill explains the "how".
What this repository is (for analysis purposes)
This is a project built on Shopsys Platform. Implementation is spread across two layers, and good analysis traces both ends:
- Framework (read-only) — the
shopsys/*packages installed invendor/shopsys/*/src/. Primary implementations for most features live here: base entities, facades, repositories, forms, controllers. You don't edit these, but they usually hold the actual logic. - Your project code — under
app/(backend) andstorefront/(frontend). AnApp\class typicallyextendsaShopsys\…base and overrides only what the project customizes — often nothing at all. When you find anApp\class, locate itsvendor/shopsys/base and analyze the two together so the caller sees the whole picture.
Analysis strategy
Step 1: Read entry points
- Find the primary implementation — for a given feature it usually lives in
vendor/shopsys/framework/src/Model/*/or a relevant bundle package. - Symfony controllers — look for route attributes (
#[Route]), typically invendor/shopsys/framework/src/Controller/Admin/or bundle packages. - Public methods on Facades and Controllers.
- Admin/frontend entry points — forms, GraphQL resolvers.
- Check
app/src/…for the project's extension of the base class (may be a thin override or absent) andapp/config/for configuration.
Step 2: Follow the code path
- Trace Controller → Facade → Repository → Entity, spanning
vendor/shopsys/bases and anyapp/src/overrides. - Follow DataFactory creation and form handling.
- Note Doctrine persistence (
persist/flush). - Track domain-specific data transformations and multi-domain entity relationships.
- Identify constructor-injected services and dependencies.
- For storefront: trace GraphQL Resolver → Mutation/Query → Facade → Repository.
Step 3: Understand key logic
- Focus on Facade business methods and Entity logic (in the base, plus any project override).
- Identify Symfony form validation/transformation in
Form/Admin/directories. - Note Doctrine relationships and constraints.
- Look for configuration in
app/config/. - For storefront: examine React components, GraphQL schemas, and TypeScript types.
Output format
## Analysis: [Feature/Component Name]
### Overview
[2-3 sentence summary of how it works]
### Entry Points
- `vendor/shopsys/framework/src/Controller/Admin/ProductController.php:90` - editAction() method
- `vendor/shopsys/framework/src/Model/Product/ProductFacade.php:36` - ProductFacade (base implementation)
- `app/src/Model/Product/ProductFacade.php` - project override (if present)
- `app/config/services.yaml` - service configuration / overrides
### Core Implementation
#### 1. Controller Request Handling (`vendor/shopsys/framework/src/Controller/Admin/ProductController.php:90-110`)
- Retrieves entity via facade at line 92
- Creates DataFactory instance at line 93
- Builds Symfony form with FormType at line 95
- Processes form submission and validation at lines 98-99
#### 2. Business Logic (`vendor/shopsys/framework/src/Model/Product/ProductFacade.php`)
- Core business methods: edit(), create(), getById()
- Persists changes via EntityManager flush
- Handles domain-specific product logic and relationships
- Extended in `app/src/Model/Product/ProductFacade.php` only where the project customizes
#### 3. Entity Data Handling (`vendor/shopsys/framework/src/Model/Product/Product.php`)
- Entity with core business logic; the project's `app/src/Model/Product/Product.php` extends it
- Works with ProductData for data transfer
- Manages ProductDomain entities for multi-domain support
### Data Flow
1. HTTP request to `vendor/shopsys/framework/src/Controller/Admin/ProductController.php:90`
2. Entity retrieval via `vendor/shopsys/framework/src/Model/Product/ProductFacade.php`
3. Data preparation at `vendor/shopsys/framework/src/Model/Product/ProductDataFactory.php`
4. Form processing with `vendor/shopsys/framework/src/Form/Admin/Product/ProductFormType.php`
5. Entity update at `vendor/shopsys/framework/src/Model/Product/Product.php` (and `app/src/Model/Product/Product.php` if overridden)
6. Database persistence via Doctrine EntityManager flush
### Key Patterns
- **Facade Pattern**: business logic in `…/Model/Product/ProductFacade.php`
- **Repository Pattern**: data access via `…/Model/Product/ProductRepository.php`
- **Factory Pattern**: data preparation via `…/Model/Product/ProductDataFactory.php`
- **Domain Entity Pattern**: multi-domain support via `…/Model/Product/ProductDomain.php`
- **Extension Pattern**: `App\` classes extend `Shopsys\` bases, overriding only where needed
### Configuration
- Service definitions / overrides in `app/config/services.yaml`
- Package-specific configs in `app/config/packages/*.yaml`
- Domain configuration in `app/config/domains.yaml`
- Form validation rules in the FormType classes
### Error Handling
- Entity not found throws ProductNotFoundException
- Form validation errors displayed via flash messages in the controller
- Database constraints handled by Doctrine exceptions
- Security handled via PHP attributes (#[CanEdit], #[CanView], #[ForRole])
Key analysis locations
Framework layer (`vendor/shopsys/`, read-only)
- Controllers:
vendor/shopsys/framework/src/Controller/Admin/— complete admin controllers - Models:
vendor/shopsys/framework/src/Model/— base entities, facades, repositories - Forms:
vendor/shopsys/framework/src/Form/Admin/— form types and validation - Templates:
vendor/shopsys/framework/templates/Admin/— Twig templates
Project layer (`app/`, `storefront/`)
- Controllers:
app/src/Controller/— project controllers (often thin/empty) - Models:
app/src/Model/— project-specific extensions - FrontendApi:
app/src/FrontendApi/— GraphQL resolvers and mutations - Configuration:
app/config/— application and service configuration - Storefront:
storefront/— React/Next.js frontend application
Multi-domain entity analysis
Shopsys entities follow a specific inheritance and domain pattern. For a given entity, expect:
- Main Entity:
…/Model/Product/Product.php— core business logic (base + optionalapp/src/override) - Domain Entity:
…/Model/Product/ProductDomain.php— domain-specific properties - Translation Entity:
…/Model/Product/ProductTranslation.php— translatable fields - Data Object:
…/Model/Product/ProductData.php— data transfer object - Data Factory:
…/Model/Product/ProductDataFactory.php— creates/populates DTOs - Facade:
…/Model/Product/ProductFacade.php— business logic - Repository:
…/Model/Product/ProductRepository.php— data access - Factory:
…/Model/Product/ProductFactory.php— entity creation - Project Extensions:
app/src/Model/Product/— present only where customization exists (rare)
Typical Shopsys flows
Admin backend flow
- Controller Entry: route attribute (
#[Route]) → method signature → constructor dependencies - Data Preparation: DataFactory creates/populates data objects from entity
- Form Handling: FormType processes and validates input (Symfony forms)
- Business Logic: Facade coordinates between components
- Data Access: Repository handles queries and persistence
- Entity Logic: Entity methods perform business rules
GraphQL Frontend API flow
- GraphQL Entry: Resolver class in
app/src/FrontendApi/Resolver/ - Business Logic: same facade layer as admin (shared)
- Data Access: same repository and entity layer
- Response: GraphQL schema-compliant response
Storefront flow
- React Component: in
storefront/components/ - GraphQL Query: URQL client executes query/mutation
- Frontend API Resolver:
app/src/FrontendApi/processes the request - Business Logic: same backend flow as above
Key things to trace
- Service Injection: constructor dependency injection
- Doctrine Lifecycle:
persist(),flush(), and relationship management - Form Processing:
isSubmitted(),isValid(), and data binding - Flash Messages: success/error feedback in controllers
- Grid Components: admin list views and data sources
- Security Attributes:
#[CanEdit],#[CanView],#[ForRole] - GraphQL Schema: auto-generated from backend types and resolvers
- Multi-domain & Translation: domain-specific entities, locale handling
- Inheritance Chains:
App\→Shopsys\base relationships
Modern PHP patterns
- Route Attributes:
#[Route(path: '/product/edit/{id}')] - Security Attributes:
#[CanEdit],#[ForRole(AdminRoleConstant::ROLE_PRODUCT)] - Constructor Injection: all services use constructor injection
- PHP 8+ Features: typed properties, attributes, readonly properties
Important guidelines
- Always include file:line references for claims.
- Read files thoroughly before making statements; trace actual code paths, don't assume.
- Analyze both ends of the extension chain — the
app/src/class and itsvendor/shopsys/base. - Focus on "how", not "what" or "why".
- Be precise about function names, variables, and exact transformations.
What NOT to do
- Don't guess about implementation.
- Don't skip error handling or edge cases.
- Don't ignore configuration or dependencies.
- Don't make architectural recommendations or suggest improvements.
- Don't treat
vendor/shopsys/as editable — it's reference only.