Skip to content

Commit

Permalink
Merge pull request #154 from loic425/features/refresh-entities-docume…
Browse files Browse the repository at this point in the history
…ntation

Refresh entities documentation
  • Loading branch information
loic425 committed Mar 13, 2019
2 parents f4b8853 + ed8fe8c commit f1e7341
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 39 deletions.
17 changes: 10 additions & 7 deletions docs/cookbook/entities/configure-your-routes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ To configure backend routes for your entity, you have to create a new file on ba

Let’s configure our “Article” routes as an example.

``config/routes/backend/article.yml``

.. code-block:: yaml
# config/routes/backend/article.yml
app_backend_article:
resource: |
alias: app.article
Expand All @@ -26,17 +26,20 @@ Let’s configure our “Article” routes as an example.
And add it on backend routes configuration.

``config/routes/backend.yml``

.. code-block:: yaml
#config/routes/backend.yml
[...]
app_backend_article:
resource: "backend/article.yml"
And that’s all!

.. note::
Learn More
----------

You can learn more about `configuring routes in sylius documentation`_.
* `Configuring routes in sylius documentation`_

.. _configuring routes in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html#generating-the-crud-routing
.. _Configuring routes in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html#generating-the-crud-routing
35 changes: 18 additions & 17 deletions docs/cookbook/entities/first-resource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,15 @@ As an example we will take an **Article entity**.

.. code-block:: php
/*
* This file is part of AppName.
*
* (c) Monofony
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
use Sylius\Component\Resource\Model\ResourceInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="app_article")
*
* @JMS\ExclusionPolicy("all")
*/
class Article implements ResourceInterface
{
Expand All @@ -38,9 +26,6 @@ As an example we will take an **Article entity**.
* @ORM\Column(type="string")
*
* @Assert\NotBlank()
*
* @JMS\Expose
* @JMS\Groups({"Default", "Detailed"})
*/
private $title;
Expand All @@ -65,6 +50,8 @@ You now have to add it on Sylius Resource configuration.

.. code-block:: yaml
# config/packages/sylius_resource.yaml
sylius_resource:
resources:
app.article:
Expand All @@ -75,8 +62,22 @@ You now have to add it on Sylius Resource configuration.
classes:
model: App\Entity\OAuth\Client
.. note::
.. warning::

Don't forget to synchronize your database using Doctrine Migrations.

You can use these two commands to generate and synchronize your database.

.. code-block:: bash
$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate
Learn More
----------

You can learn more from `Sylius Resource Bundle`_ documentation.
* `Sylius Resource Bundle`_ documentation
* `Doctrine migrations`_ documentation

.. _`Sylius Resource Bundle`: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusResourceBundle/configuration.html
.. _`Doctrine migrations`: https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
28 changes: 13 additions & 15 deletions docs/cookbook/entities/manage-your-entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ To add a new grid, create a new grid configuration file in ``config/packages/gri
Create a new grid configuration file
------------------------------------

``config/packages/grids/backend/article.yml``

.. code-block:: yaml
# config/packages/grids/backend/article.yml
sylius_grid:
grids:
app_backend_article:
Expand Down Expand Up @@ -40,25 +40,23 @@ Create a new grid configuration file
delete:
type: delete
.. note::

You can view `the whole configuration reference in sylius documentation`_.

Import this to sylius_grid configuration file
---------------------------------------------

``config/packages/sylius_grid.yaml``

.. code-block:: yaml
# config/packages/sylius_grid.yaml
imports:
- { resource: 'grids/backend/article.yml' }
- { resource: 'grids/backend/admin_user.yml' }
- { resource: 'grids/backend/customer.yml' }
- { resource: 'grids/backend/article.yml' }
- { resource: 'grids/backend/admin_user.yml' }
- { resource: 'grids/backend/customer.yml' }
.. note::
Learn More
----------

You can learn more about `configuring grid in sylius documentation`_.
* `Configuring grid in sylius documentation`_
* `The whole configuration reference in sylius documentation`_

.. _the whole configuration reference in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/configuration.html
.. _configuring grid in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html
.. _The whole configuration reference in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/configuration.html
.. _Configuring grid in sylius documentation: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html

0 comments on commit f1e7341

Please sign in to comment.