Installation
composer require comunedifirenze/bicorebundle
Add to config/bundles.php:
return [
// ...
ComuneFI\BiCoreBundle\BiCoreBundle::class => ['all' => true],
];
Basic Configuration
Ensure bootstrap-italia is installed (via npm or CDN) and configure in config/packages/bicore.yaml:
bicore:
bootstrap_italia:
enabled: true
theme: 'default' # or 'custom'
First Use Case: Quick Table Interface Use the built-in table generator for Doctrine entities:
// src/Controller/SomeController.php
use ComuneFI\BiCoreBundle\Controller\TableController;
class SomeController extends TableController
{
protected $entityClass = 'App\Entity\YourEntity';
}
Define a route in config/routes.yaml:
bicore_table:
resource: "@BiCoreBundle/Resources/config/routing/table.yaml"
prefix: /admin
CRUD Operations
Extend ComuneFI\BiCoreBundle\Controller\CrudController for full CRUD:
class UserController extends CrudController
{
protected $entityClass = 'App\Entity\User';
protected $formType = 'App\Form\UserType'; // Optional: Customize form
}
Bootstrap Italia Components Use pre-built components (e.g., modals, alerts) via Twig:
{% bicore_modal('example-modal', 'Modal Title') %}
<p>Modal content here.</p>
{% endbicore_modal %}
Database Schema to Entities Convert MySQL Workbench schemas to Doctrine entities:
php bin/console bicore:schema-to-entities --schema=path/to/schema.sql
Custom Templates
Override default templates in templates/bicore/ (e.g., table.html.twig).
bicore:fixtures:load for test data:
php bin/console bicore:fixtures:load
enabled: true in config.bicore/translations/ for custom translations.Bootstrap Italia Dependency
bootstrap-italia is installed (via npm or CDN). The bundle does not auto-install it./build/ assets.Route Conflicts
/admin/*) may clash with existing routes. Prefix or rename in routing.yaml.Doctrine Schema Conversion
schema-to-entities command assumes a MySQL-compatible schema. Adjust for PostgreSQL/SQLite quirks (e.g., SERIAL vs AUTO_INCREMENT).Twig Extensions
bicore_modal must be loaded. Verify BiCoreBundle is registered in bundles.php.debug: true in config/packages/bicore.yaml for verbose logs.bicore.event in Symfony’s event dispatcher for custom logic:
// config/services.yaml
ComuneFI\BiCoreBundle\EventListener\YourListener:
tags:
- { name: kernel.event_listener, event: bicore.event, method: onEvent }
Custom Form Types
Override default forms by extending ComuneFI\BiCoreBundle\Form\Type\BaseType:
class CustomUserType extends BaseType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('custom_field', TextType::class);
}
}
Dynamic Table Columns Modify table columns via Twig:
{% bicore_table_row entity %}
<td>{{ entity.customField }}</td> {# Override default column #}
{% endbicore_table_row %}
Authentication
Extend the login system by overriding BiCoreBundle:Security:login.html.twig and configuring guard in security.yaml:
firewalls:
main:
form_login:
template: BiCoreBundle:Security:login.html.twig
How can I help you explore Laravel packages today?