mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-12-09 11:53:55 +00:00
convert content to markdown
This commit is contained in:
@@ -1,104 +1,90 @@
|
|||||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
# Create a new bundle {#create-new-bundle}
|
||||||
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:
|
:::: warning
|
||||||
|
::: title
|
||||||
|
Warning
|
||||||
|
:::
|
||||||
|
|
||||||
Create a new bundle
|
This part of the doc is not yet tested
|
||||||
*******************
|
::::
|
||||||
|
|
||||||
.. warning::
|
## Create a new directory with Bundle class
|
||||||
|
|
||||||
This part of the doc is not yet tested
|
``` bash
|
||||||
|
mkdir -p src/Bundle/ChillSomeBundle/src/config
|
||||||
Create a new directory with Bundle class
|
mkdir -p src/Bundle/ChillSomeBundle/src/Controller
|
||||||
----------------------------------------
|
```
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
mkdir -p src/Bundle/ChillSomeBundle/src/config
|
|
||||||
mkdir -p src/Bundle/ChillSomeBundle/src/Controller
|
|
||||||
|
|
||||||
Add a bundle file
|
Add a bundle file
|
||||||
|
|
||||||
.. code-block:: php
|
``` php
|
||||||
|
<?php
|
||||||
|
|
||||||
<?php
|
declare(strict_types=1);
|
||||||
|
|
||||||
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;
|
||||||
* 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;
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
class ChillSomeBundle extends Bundle {}
|
||||||
|
```
|
||||||
class ChillSomeBundle extends Bundle {}
|
|
||||||
|
|
||||||
And a route file:
|
And a route file:
|
||||||
|
|
||||||
.. code-block:: yaml
|
``` yaml
|
||||||
|
chill_ticket_controller:
|
||||||
|
resource: '@ChillTicketBundle/Controller/'
|
||||||
|
type: annotation
|
||||||
|
```
|
||||||
|
|
||||||
chill_ticket_controller:
|
## Register the new psr-4 namespace
|
||||||
resource: '@ChillTicketBundle/Controller/'
|
|
||||||
type: annotation
|
|
||||||
|
|
||||||
Register the new psr-4 namespace
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
In composer.json, add the new psr4 namespace
|
In composer.json, add the new psr4 namespace
|
||||||
|
|
||||||
.. code-block:: diff
|
``` diff
|
||||||
|
{
|
||||||
{
|
"autoload": {
|
||||||
"autoload": {
|
"psr-4": {
|
||||||
"psr-4": {
|
+ "Chill\\SomeBundle\\": "src/Bundle/ChillSomeBundle/src",
|
||||||
+ "Chill\\SomeBundle\\": "src/Bundle/ChillSomeBundle/src",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Register the bundle
|
||||||
|
|
||||||
Register the bundle
|
Register in the file `config/bundles.php`:
|
||||||
-------------------
|
|
||||||
|
|
||||||
Register in the file :code:`config/bundles.php`:
|
``` php
|
||||||
|
Vendor\Bundle\YourBundle\YourBundle::class => ['all' => true],
|
||||||
|
```
|
||||||
|
|
||||||
.. code-block:: php
|
And import routes in `config/routes/chill_some_bundle.yaml`:
|
||||||
|
|
||||||
Vendor\Bundle\YourBundle\YourBundle::class => ['all' => true],
|
``` yaml
|
||||||
|
chill_ticket_bundle:
|
||||||
|
resource: '@ChillSomeBundle/config/routes.yaml'
|
||||||
|
```
|
||||||
|
|
||||||
And import routes in :code:`config/routes/chill_some_bundle.yaml`:
|
## Add the doctrine_migration namespace
|
||||||
|
|
||||||
.. code-block:: yaml
|
Add the namespace to `config/packages/doctrine_migrations_chill.yaml`
|
||||||
|
|
||||||
chill_ticket_bundle:
|
``` diff
|
||||||
resource: '@ChillSomeBundle/config/routes.yaml'
|
doctrine_migrations:
|
||||||
|
migrations_paths:
|
||||||
|
+ 'Chill\Some\Ticket': '@ChillSomeBundle/migrations'
|
||||||
|
```
|
||||||
|
|
||||||
Add the doctrine_migration namespace
|
## Dump autoloading
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
symfony composer dump-autoload
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user