# pascallinder/sulubasebundle architecture

> Architecture diagram of the GitHub repository pascallinder/sulubasebundle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pascallinder/sulubasebundle
- Repository: https://github.com/pascallinder/sulubasebundle

## Overview

SuluBaseBundle is a shared Symfony/Sulu CMS bundle for admin CRUD, localized entity handling, smart-content loading, and reusable admin fields. Its main workflow scaffolds an admin list and forms, routes CRUD requests through controller hooks to repositories, and returns entity data to the admin. Separate capabilities provide locale-aware smart-content resources, configurable content fields, theme-aware Twig colors, and persistence-time string trimming. The sampled source supports the controller/repository and field-registration links; unsampled implementations are represented only where the README and tree identify them.

Main entry points: [`Resources/js/src/app.js`](https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/app.js) (Field registration), [`Controller/Admin/BaseController.php`](https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/BaseController.php) (CRUD controller), [`Repository/LocaleRepositoryUtil.php`](https://github.com/pascallinder/sulubasebundle/blob/main/Repository/LocaleRepositoryUtil.php) (Locale repository utilities), [`Content/AbstractEntityResourceLoader.php`](https://github.com/pascallinder/sulubasebundle/blob/main/Content/AbstractEntityResourceLoader.php) (Smart-content loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin_crud["Admin CRUD"]
  node_crud_admin["CRUD admin scaffold<br/>[AdminCrud.php]"]
  node_crud_config["CRUD configuration"]
  node_crud_controller["CRUD controller<br/>[BaseController.php]"]
  node_locale_controller["Locale controller"]
  node_enable_toggle["Enable toggle<br/>[EnableSwitch.php]"]
  node_list_factory["Paginated list builder"]
end

subgraph group_entity_content["Entity and content"]
  node_base_repo["Base repository utilities"]
  node_locale_repo["Locale repository utilities"]
  node_locale_entity["Locale entity trait<br/>[LocaleTrait.php]"]
  node_resource_loader["Smart-content loader"]
end

subgraph group_admin_fields["Admin fields"]
  node_field_entry["Field registration<br/>[app.js]"]
  node_content_fields["Custom content fields"]
  node_generated_link["Generated link field<br/>[GeneratedLink.js]"]
  node_snackbar_action["Snackbar toolbar action"]
  node_snackbar_service["Snackbar service<br/>[SnackbarService.js]"]
end

subgraph group_shared_runtime["Shared runtime"]
  node_theme_colors["Theme color Twig support"]
  node_string_trim["String trim subscriber"]
end

node_admin_user(("Admin user"))
node_sulu_admin["Sulu admin"]
node_doctrine[("Doctrine entity store")]
node_smart_content["Sulu smart content"]
node_field_registry["Admin field registry"]
node_twig_template["Twig template"]
node_doctrine_events["Doctrine persistence events"]

node_admin_user -->|"uses"| node_sulu_admin
node_sulu_admin -->|"renders views"| node_crud_admin
node_crud_admin -->|"reads configuration"| node_crud_config
node_sulu_admin -->|"sends requests"| node_crud_controller
node_crud_controller -->|"delegates CRUD"| node_base_repo
node_locale_controller -->|"extends"| node_crud_controller
node_locale_controller -->|"loads and saves"| node_locale_repo
node_locale_repo -->|"sets locale"| node_locale_entity
node_base_repo -->|"persists and removes"| node_doctrine
node_locale_repo -->|"queries and persists"| node_doctrine
node_list_factory -->|"executes list query"| node_doctrine
node_enable_toggle -->|"handles toggle"| node_crud_controller
node_smart_content -->|"loads resources"| node_resource_loader
node_resource_loader -->|"reads entities"| node_doctrine
node_resource_loader -->|"returns content views"| node_smart_content
node_field_entry -->|"registers fields"| node_field_registry
node_field_entry -->|"registers components"| node_content_fields
node_field_entry -->|"registers field"| node_generated_link
node_field_entry -->|"registers action"| node_snackbar_action
node_snackbar_action -->|"uses service"| node_snackbar_service
node_snackbar_service -->|"adds notification"| node_sulu_admin
node_twig_template -->|"renders color"| node_theme_colors
node_doctrine_events -->|"invokes subscriber"| node_string_trim

click node_crud_admin "https://github.com/pascallinder/sulubasebundle/blob/main/Admin/AdminCrud.php"
click node_crud_config "https://github.com/pascallinder/sulubasebundle/blob/main/Admin/AdminCrudConfig.php"
click node_crud_controller "https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/BaseController.php"
click node_locale_controller "https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/LocaleController.php"
click node_enable_toggle "https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/EnableSwitch.php"
click node_list_factory "https://github.com/pascallinder/sulubasebundle/blob/main/Common/DoctrineListRepresentationFactory.php"
click node_base_repo "https://github.com/pascallinder/sulubasebundle/blob/main/Repository/BaseRepositoryUtil.php"
click node_locale_repo "https://github.com/pascallinder/sulubasebundle/blob/main/Repository/LocaleRepositoryUtil.php"
click node_locale_entity "https://github.com/pascallinder/sulubasebundle/blob/main/Entity/LocaleTrait.php"
click node_resource_loader "https://github.com/pascallinder/sulubasebundle/blob/main/Content/AbstractEntityResourceLoader.php"
click node_field_entry "https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/app.js"
click node_content_fields "https://github.com/pascallinder/sulubasebundle/tree/main/Resources/js/src/components/content/types"
click node_generated_link "https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/components/form/GeneratedLink.js"
click node_snackbar_action "https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/components/form/toolbar/button/SnackbarToolbarAction.js"
click node_snackbar_service "https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/services/SnackbarService.js"
click node_theme_colors "https://github.com/pascallinder/sulubasebundle/blob/main/Twig/ThemeColorExtension.php"
click node_string_trim "https://github.com/pascallinder/sulubasebundle/blob/main/Subscriber/EntityStringTrimSubscriber.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_crud_admin,node_crud_config,node_crud_controller,node_locale_controller,node_enable_toggle,node_list_factory,node_admin_user toneBlue
class node_base_repo,node_locale_repo,node_locale_entity,node_resource_loader,node_doctrine toneAmber
class node_field_entry,node_content_fields,node_generated_link,node_snackbar_action,node_snackbar_service toneMint
class node_theme_colors,node_string_trim toneRose
class node_sulu_admin,node_smart_content,node_field_registry,node_twig_template,node_doctrine_events toneIndigo
```

## Components

### Admin CRUD

- [CRUD admin scaffold](https://github.com/pascallinder/sulubasebundle/blob/main/Admin/AdminCrud.php): `Admin/AdminCrud.php`
- [CRUD configuration](https://github.com/pascallinder/sulubasebundle/blob/main/Admin/AdminCrudConfig.php): `Admin/AdminCrudConfig.php`
- [CRUD controller](https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/BaseController.php): `Controller/Admin/BaseController.php`
- [Locale controller](https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/LocaleController.php): `Controller/Admin/LocaleController.php`
- [Enable toggle](https://github.com/pascallinder/sulubasebundle/blob/main/Controller/Admin/EnableSwitch.php): `Controller/Admin/EnableSwitch.php`
- [Paginated list builder](https://github.com/pascallinder/sulubasebundle/blob/main/Common/DoctrineListRepresentationFactory.php): `Common/DoctrineListRepresentationFactory.php`

### Entity and content

- [Base repository utilities](https://github.com/pascallinder/sulubasebundle/blob/main/Repository/BaseRepositoryUtil.php): `Repository/BaseRepositoryUtil.php`
- [Locale repository utilities](https://github.com/pascallinder/sulubasebundle/blob/main/Repository/LocaleRepositoryUtil.php): `Repository/LocaleRepositoryUtil.php`
- [Locale entity trait](https://github.com/pascallinder/sulubasebundle/blob/main/Entity/LocaleTrait.php): `Entity/LocaleTrait.php`
- [Smart-content loader](https://github.com/pascallinder/sulubasebundle/blob/main/Content/AbstractEntityResourceLoader.php): `Content/AbstractEntityResourceLoader.php`

### Admin fields

- [Field registration](https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/app.js): `Resources/js/src/app.js`
- [Custom content fields](https://github.com/pascallinder/sulubasebundle/tree/main/Resources/js/src/components/content/types): `Resources/js/src/components/content/types`
- [Generated link field](https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/components/form/GeneratedLink.js): `Resources/js/src/components/form/GeneratedLink.js`
- [Snackbar toolbar action](https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/components/form/toolbar/button/SnackbarToolbarAction.js): `Resources/js/src/components/form/toolbar/button/SnackbarToolbarAction.js`
- [Snackbar service](https://github.com/pascallinder/sulubasebundle/blob/main/Resources/js/src/services/SnackbarService.js): `Resources/js/src/services/SnackbarService.js`

### Shared runtime

- [Theme color Twig support](https://github.com/pascallinder/sulubasebundle/blob/main/Twig/ThemeColorExtension.php): `Twig/ThemeColorExtension.php`
- [String trim subscriber](https://github.com/pascallinder/sulubasebundle/blob/main/Subscriber/EntityStringTrimSubscriber.php): `Subscriber/EntityStringTrimSubscriber.php`

### Other components

- **Admin user**
- **Sulu admin**
- **Doctrine entity store**
- **Sulu smart content**
- **Admin field registry**
- **Twig template**
- **Doctrine persistence events**

## Connections

- Admin user → Sulu admin: uses
- Sulu admin → CRUD admin scaffold: renders views
- CRUD admin scaffold → CRUD configuration: reads configuration
- Sulu admin → CRUD controller: sends requests
- CRUD controller → Base repository utilities: delegates CRUD
- Locale controller → CRUD controller: extends
- Locale controller → Locale repository utilities: loads and saves
- Locale repository utilities → Locale entity trait: sets locale
- Base repository utilities → Doctrine entity store: persists and removes
- Locale repository utilities → Doctrine entity store: queries and persists
- Paginated list builder → Doctrine entity store: executes list query
- Enable toggle → CRUD controller: handles toggle
- Sulu smart content → Smart-content loader: loads resources
- Smart-content loader → Doctrine entity store: reads entities
- Smart-content loader → Sulu smart content: returns content views
- Field registration → Admin field registry: registers fields
- Field registration → Custom content fields: registers components
- Field registration → Generated link field: registers field
- Field registration → Snackbar toolbar action: registers action
- Snackbar toolbar action → Snackbar service: uses service
- Snackbar service → Sulu admin: adds notification
- Twig template → Theme color Twig support: renders color
- Doctrine persistence events → String trim subscriber: invokes subscriber
