mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Rewrote the "create a new bundle" guide for clarity and completeness. Added detailed steps for creating a bundle class, registering namespaces in `composer.json`, updating configuration files, and dumping autoload. These changes aim to make the instructions easier to follow for new developers.
88 lines
1.9 KiB
ReStructuredText
88 lines
1.9 KiB
ReStructuredText
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3
|
|
or any later version published by the Free Software Foundation;
|
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
|
A copy of the license is included in the section entitled "GNU
|
|
Free Documentation License".
|
|
|
|
.. _create-new-bundle:
|
|
|
|
Create a new bundle
|
|
*******************
|
|
|
|
.. warning::
|
|
|
|
This part of the doc is not yet tested
|
|
|
|
Create a new directory with Bundle class
|
|
----------------------------------------
|
|
|
|
.. code-block:: bash
|
|
|
|
mkdir -p src/Bundle/ChillSomeBundle/src
|
|
|
|
Add a bundle file
|
|
|
|
.. code-block:: php
|
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\SomeBundle;
|
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
|
|
class ChillSomeBundle extends Bundle {}
|
|
|
|
Register the new psr-4 namespace
|
|
--------------------------------
|
|
|
|
In composer.json, add the new psr4 namespace
|
|
|
|
.. code-block:: diff
|
|
|
|
{
|
|
"autoload": {
|
|
"psr-4": {
|
|
+ "Chill\\SomeBundle\\": "src/Bundle/ChillSomeBundle/src",
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
Register the bundle
|
|
-------------------
|
|
|
|
Register in the file :code:`config/bundles.php`:
|
|
|
|
.. code-block:: php
|
|
Vendor\Bundle\YourBundle\YourBundle::class => ['all' => true],
|
|
|
|
Add the doctrine_migration namespace
|
|
------------------------------------
|
|
|
|
Add the namespace to :code:`config/packages/doctrine_migrations_chill.yaml`
|
|
|
|
.. code-block:: diff
|
|
|
|
doctrine_migrations:
|
|
migrations_paths:
|
|
+ 'Chill\Some\Ticket': '@ChillSomeBundle/migrations'
|
|
|
|
Dump autoloading
|
|
----------------
|
|
|
|
.. code-block:: bash
|
|
|
|
symfony composer dump-autoload
|
|
|