Skip to content

Commit

Permalink
Rename ApiBundle to AdminApiBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Mar 13, 2017
1 parent b0c9d92 commit e3c1930
Show file tree
Hide file tree
Showing 136 changed files with 492 additions and 425 deletions.
16 changes: 8 additions & 8 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* Changed the way how payment methods are created. Now you choose desired gateway first and configure payment method with it. All parameters that were previously configured in `yml` configuration file
are now managed for each payment method in the Admin panel.

### ApiBundle
### AdminApiBundle

* Change the import path of your API routing from `src/Sylius/Bundle/ApiBundle/Resources/config/routing/main.yml` to `src/Sylius/Bundle/ApiBundle/Resources/config/routing.yml`. API became versioned, so you need to prefix them accordingly (e.g. `/api/customer` -> `/api/v1/customer`).
* Change the import path of your API routing from `src/Sylius/Bundle/ApiBundle/Resources/config/routing/main.yml` to `src/Sylius/Bundle/AdminApiBundle/Resources/config/routing.yml`. API became versioned, so you need to prefix them accordingly (e.g. `/api/customer` -> `/api/v1/customer`).

* Routing definition for Shipping Categories has been removed and replaced with auto generated resource routing. Also, Shipping Categories are resolved by code instead of id.
One can either change the way, how the routes are handled on theirs app (send `code` instead of `id`) or replace previous routing import with following definition:
```yaml
sylius_api_shipping_category_index:
sylius_admin_api_shipping_category_index:
path: /
methods: [GET]
defaults:
Expand All @@ -34,23 +34,23 @@
sorting:
name: desc

sylius_api_shipping_category_create:
sylius_admin_api_shipping_category_create:
path: /
methods: [POST]
defaults:
_controller: sylius.controller.shipping_category:createAction
_sylius:
serialization_version: $version

sylius_api_shipping_category_update:
sylius_admin_api_shipping_category_update:
path: /{id}
methods: [PUT, PATCH]
defaults:
_controller: sylius.controller.shipping_category:updateAction
_sylius:
serialization_version: $version

sylius_api_shipping_category_delete:
sylius_admin_api_shipping_category_delete:
path: /{id}
methods: [DELETE]
defaults:
Expand All @@ -59,7 +59,7 @@
serialization_version: $version
csrf_protection: false

sylius_api_shipping_category_show:
sylius_admin_api_shipping_category_show:
path: /{id}
methods: [GET]
defaults:
Expand Down Expand Up @@ -389,7 +389,7 @@ From now on it won't compute every possible permutation of fallback locales from

### Configuration

* Move `sylius_shop` routing below `sylius_admin` and `sylius_api` in `app/config/routing.yml` and replace it with the following one:
* Move `sylius_shop` routing below `sylius_admin` and `sylius_admin_api` in `app/config/routing.yml` and replace it with the following one:

```yaml
sylius_shop:
Expand Down
4 changes: 2 additions & 2 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function registerBundles()
new \Sylius\Bundle\AdminBundle\SyliusAdminBundle(),
new \Sylius\Bundle\ShopBundle\SyliusShopBundle(),

new \FOS\OAuthServerBundle\FOSOAuthServerBundle(), // Required by SyliusApiBundle.
new \Sylius\Bundle\ApiBundle\SyliusApiBundle(),
new \FOS\OAuthServerBundle\FOSOAuthServerBundle(), // Required by SyliusAdminApiBundle.
new \Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle(),
];

return array_merge(parent::registerBundles(), $bundles);
Expand Down
2 changes: 1 addition & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusApiBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }

- { resource: "parameters.yml" }
- { resource: "security.yml" }
Expand Down
4 changes: 2 additions & 2 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ sylius_admin:
resource: "@SyliusAdminBundle/Resources/config/routing.yml"
prefix: /admin

sylius_api:
resource: "@SyliusApiBundle/Resources/config/routing.yml"
sylius_admin_api:
resource: "@SyliusAdminApiBundle/Resources/config/routing.yml"
prefix: /api

sylius_shop:
Expand Down
58 changes: 58 additions & 0 deletions app/migrations/Version20170313125424.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Sylius\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170313125424 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE sylius_api_access_token RENAME sylius_admin_api_access_token');
$this->addSql('ALTER TABLE sylius_api_auth_code RENAME sylius_admin_api_auth_code');
$this->addSql('ALTER TABLE sylius_api_client RENAME sylius_admin_api_client');
$this->addSql('ALTER TABLE sylius_api_refresh_token RENAME sylius_admin_api_refresh_token');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX uniq_7d83aa7f5f37a13b TO UNIQ_2AA4915D5F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX idx_7d83aa7f19eb6921 TO IDX_2AA4915D19EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX idx_7d83aa7fa76ed395 TO IDX_2AA4915DA76ED395');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX uniq_c84041795f37a13b TO UNIQ_E366D8485F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX idx_c840417919eb6921 TO IDX_E366D84819EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX idx_c8404179a76ed395 TO IDX_E366D848A76ED395');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX uniq_445785255f37a13b TO UNIQ_9160E3FA5F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX idx_4457852519eb6921 TO IDX_9160E3FA19EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX idx_44578525a76ed395 TO IDX_9160E3FAA76ED395');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX uniq_2aa4915d5f37a13b TO UNIQ_7D83AA7F5F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX idx_2aa4915d19eb6921 TO IDX_7D83AA7F19EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME INDEX idx_2aa4915da76ed395 TO IDX_7D83AA7FA76ED395');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX uniq_e366d8485f37a13b TO UNIQ_C84041795F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX idx_e366d84819eb6921 TO IDX_C840417919EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME INDEX idx_e366d848a76ed395 TO IDX_C8404179A76ED395');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX uniq_9160e3fa5f37a13b TO UNIQ_445785255F37A13B');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX idx_9160e3fa19eb6921 TO IDX_4457852519EB6921');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME INDEX idx_9160e3faa76ed395 TO IDX_44578525A76ED395');
$this->addSql('ALTER TABLE sylius_admin_api_access_token RENAME sylius_api_access_token');
$this->addSql('ALTER TABLE sylius_admin_api_auth_code RENAME sylius_api_auth_code');
$this->addSql('ALTER TABLE sylius_admin_api_client RENAME sylius_api_client');
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token RENAME sylius_api_refresh_token');
}
}
4 changes: 2 additions & 2 deletions docs/api/checkouts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ The response contains proposed shipments and for each of them, it has a list of

Because of the custom calculation logic, the regular rules of overriding do not apply for this endpoint.
In order to have a different response, you have to provide a custom controller and build the message on your own.
Exemplary implementation can be found `here <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ApiBundle/Controller/ShowAvailableShippingMethodsController.php>`__
Exemplary implementation can be found `here <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminApiBundle/Controller/ShowAvailableShippingMethodsController.php>`__

Next step is updating the order with the types of shipping methods that have been selected. A PUT request has to be send for each available shipment.

Expand Down Expand Up @@ -618,7 +618,7 @@ Definition

.. warning::

Similar to the shipping step, this one has its own controller, which has to be replaced if you want to make some changes. Exemplary implementation can be found `here <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ApiBundle/Controller/ShowAvailablePaymentMethodsController.php>`__
Similar to the shipping step, this one has its own controller, which has to be replaced if you want to make some changes. Exemplary implementation can be found `here <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminApiBundle/Controller/ShowAvailablePaymentMethodsController.php>`__

Example
^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/api/sorting_and_filtration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ do it with sample resources.
.. note::

To find out by which fields the api resources can be sorted and how they can be filtered you should check the grid configuration of these
`here <https://github.com/Sylius/Sylius/tree/master/src/Sylius/Bundle/ApiBundle/Resources/config/grids>`_
`here <https://github.com/Sylius/Sylius/tree/master/src/Sylius/Bundle/AdminApiBundle/Resources/config/grids>`_

How to sort resources?
----------------------
Expand Down
16 changes: 8 additions & 8 deletions docs/cookbook/disabling-shop-admin-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ How to disable Sylius shop?
// new \Sylius\Bundle\ShopBundle\SyliusShopBundle(), // - remove or leave this line commented
new \FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new \Sylius\Bundle\ApiBundle\SyliusApiBundle(),
new \Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle(),
new \AppBundle\AppBundle(),
];
Expand Down Expand Up @@ -100,7 +100,7 @@ How to disable Sylius Admin?
new \Sylius\Bundle\ShopBundle\SyliusShopBundle(),
new \FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new \Sylius\Bundle\ApiBundle\SyliusApiBundle(),
new \Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle(),
new \AppBundle\AppBundle(),
];
Expand Down Expand Up @@ -155,7 +155,7 @@ The part that has to be removed from this file is shown below:
How to disable Sylius API?
--------------------------

**1.** Remove SyliusApiBundle from ``app/AppKernel``.
**1.** Remove SyliusAdminApiBundle from ``app/AppKernel``.

.. code-block:: php
Expand All @@ -168,29 +168,29 @@ How to disable Sylius API?
new \Sylius\Bundle\ShopBundle\SyliusShopBundle(),
new \FOS\OAuthServerBundle\FOSOAuthServerBundle(),
// new \Sylius\Bundle\ApiBundle\SyliusApiBundle(), // - remove or leave this line commented
// new \Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle(), // - remove or leave this line commented
new \AppBundle\AppBundle(),
];
return array_merge(parent::registerBundles(), $bundles);
}
**2.** Remove SyliusApiBundle's config import from ``app/config/config.yml``.
**2.** Remove SyliusAdminApiBundle's config import from ``app/config/config.yml``.

Here you've got the line that should disappear from imports:

.. code-block:: yaml
imports:
# - { resource: "@SyliusApiBundle/Resources/config/app/config.yml" } # remove or leave this line commented
# - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } # remove or leave this line commented
**3.** Remove SyliusApiBundle routing configuration from ``app/config/routing.yml``.
**3.** Remove SyliusAdminApiBundle routing configuration from ``app/config/routing.yml``.

.. code-block:: yaml
# sylius_shop:
# resource: "@SyliusApiBundle/Resources/config/routing.yml" # remove or leave these lines commented
# resource: "@SyliusAdminApiBundle/Resources/config/routing.yml" # remove or leave these lines commented
**4.** Remove security configuration from ``app/config/security.yml``.

Expand Down
2 changes: 1 addition & 1 deletion phpspec.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ suites:

AddressingBundle: { namespace: Sylius\Bundle\AddressingBundle, psr4_prefix: Sylius\Bundle\AddressingBundle, spec_path: src/Sylius/Bundle/AddressingBundle, src_path: src/Sylius/Bundle/AddressingBundle }
AdminBundle: { namespace: Sylius\Bundle\AdminBundle, psr4_prefix: Sylius\Bundle\AdminBundle, spec_path: src/Sylius/Bundle/AdminBundle, src_path: src/Sylius/Bundle/AdminBundle }
ApiBundle: { namespace: Sylius\Bundle\ApiBundle, psr4_prefix: Sylius\Bundle\ApiBundle, spec_path: src/Sylius/Bundle/ApiBundle, src_path: src/Sylius/Bundle/ApiBundle }
AdminApiBundle: { namespace: Sylius\Bundle\AdminApiBundle, psr4_prefix: Sylius\Bundle\AdminApiBundle, spec_path: src/Sylius/Bundle/AdminApiBundle, src_path: src/Sylius/Bundle/AdminApiBundle }
AttributeBundle: { namespace: Sylius\Bundle\AttributeBundle, psr4_prefix: Sylius\Bundle\AttributeBundle, spec_path: src/Sylius/Bundle/AttributeBundle, src_path: src/Sylius/Bundle/AttributeBundle }
ChannelBundle: { namespace: Sylius\Bundle\ChannelBundle, psr4_prefix: Sylius\Bundle\ChannelBundle, spec_path: src/Sylius/Bundle/ChannelBundle, src_path: src/Sylius/Bundle/ChannelBundle }
CoreBundle: { namespace: Sylius\Bundle\CoreBundle, psr4_prefix: Sylius\Bundle\CoreBundle, spec_path: src/Sylius/Bundle/CoreBundle, src_path: src/Sylius/Bundle/CoreBundle }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Sylius\Component\Addressing\Model\Country:
relations:
- rel: self
href:
route: sylius_api_country_show
route: sylius_admin_api_country_show
parameters:
code: expr(object.getCode())
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Sylius\Component\Addressing\Model\Province:
relations:
- rel: self
href:
route: sylius_api_province_show
route: sylius_admin_api_province_show
parameters:
countryCode: expr(object.getCountry().getCode())
code: expr(object.getCode())
Expand All @@ -39,7 +39,7 @@ Sylius\Component\Addressing\Model\Province:
groups: [Default, Detailed]
- rel: country
href:
route: sylius_api_country_show
route: sylius_admin_api_country_show
parameters:
code: expr(object.getCountry().getCode())
version: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Sylius\Component\Addressing\Model\Zone:
relations:
- rel: self
href:
route: sylius_api_zone_show
route: sylius_admin_api_zone_show
parameters:
code: expr(object.getCode())
version: 1
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\Command;
namespace Sylius\Bundle\AdminApiBundle\Command;

use FOS\OAuthServerBundle\Model\ClientManagerInterface;
use Sylius\Bundle\ApiBundle\Model\Client;
use Sylius\Bundle\AdminApiBundle\Model\Client;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\Controller;
namespace Sylius\Bundle\AdminApiBundle\Controller;

use Doctrine\ORM\EntityManagerInterface;
use Sylius\Component\Core\Model\ProductTaxonInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\Controller;
namespace Sylius\Bundle\AdminApiBundle\Controller;

use FOS\RestBundle\View\View;
use FOS\RestBundle\View\ViewHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\Controller;
namespace Sylius\Bundle\AdminApiBundle\Controller;

use FOS\RestBundle\View\View;
use FOS\RestBundle\View\ViewHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\DependencyInjection;
namespace Sylius\Bundle\AdminApiBundle\DependencyInjection;

use Sylius\Bundle\ApiBundle\Form\Type\ClientType;
use Sylius\Bundle\ApiBundle\Model\AccessToken;
use Sylius\Bundle\ApiBundle\Model\AccessTokenInterface;
use Sylius\Bundle\ApiBundle\Model\AuthCode;
use Sylius\Bundle\ApiBundle\Model\AuthCodeInterface;
use Sylius\Bundle\ApiBundle\Model\Client;
use Sylius\Bundle\ApiBundle\Model\ClientInterface;
use Sylius\Bundle\ApiBundle\Model\RefreshToken;
use Sylius\Bundle\ApiBundle\Model\RefreshTokenInterface;
use Sylius\Bundle\ApiBundle\Model\UserInterface;
use Sylius\Bundle\AdminApiBundle\Form\Type\ClientType;
use Sylius\Bundle\AdminApiBundle\Model\AccessToken;
use Sylius\Bundle\AdminApiBundle\Model\AccessTokenInterface;
use Sylius\Bundle\AdminApiBundle\Model\AuthCode;
use Sylius\Bundle\AdminApiBundle\Model\AuthCodeInterface;
use Sylius\Bundle\AdminApiBundle\Model\Client;
use Sylius\Bundle\AdminApiBundle\Model\ClientInterface;
use Sylius\Bundle\AdminApiBundle\Model\RefreshToken;
use Sylius\Bundle\AdminApiBundle\Model\RefreshTokenInterface;
use Sylius\Bundle\AdminApiBundle\Model\UserInterface;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Resource\Factory\Factory;
Expand All @@ -39,7 +39,7 @@ final class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_api');
$rootNode = $treeBuilder->root('sylius_admin_api');

$rootNode
->children()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\DependencyInjection;
namespace Sylius\Bundle\AdminApiBundle\DependencyInjection;

use Sylius\Bundle\ApiBundle\Controller\TokenController;
use Sylius\Bundle\AdminApiBundle\Controller\TokenController;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -24,7 +24,7 @@
/**
* @author Paweł Jędrzejewski <[email protected]>
*/
final class SyliusApiExtension extends AbstractResourceExtension implements PrependExtensionInterface
final class SyliusAdminApiExtension extends AbstractResourceExtension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\Bundle\ApiBundle\EventListener;
namespace Sylius\Bundle\AdminApiBundle\EventListener;

use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Component\Core\Model\OrderItemInterface;
Expand Down
Loading

0 comments on commit e3c1930

Please sign in to comment.