Skip to content

Commit 4b08818

Browse files
authored
Merge pull request #510 from teohhanhui/fix/no-more-appbundle
Fix outdated namespace: AppBundle -> App (src/AppBundle -> src)
2 parents 2d3fab4 + 74d434b commit 4b08818

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

core/errors.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ configure API Platform to convert it to a `404 Not Found` error:
1515

1616
```php
1717
<?php
18-
// src/AppBundle/Exception/ProductNotFoundException.php
18+
// src/Exception/ProductNotFoundException.php
1919

20-
namespace AppBundle\Exception;
20+
namespace App\Exception;
2121

2222
final class ProductNotFoundException extends \Exception
2323
{
@@ -26,13 +26,13 @@ final class ProductNotFoundException extends \Exception
2626

2727
```php
2828
<?php
29-
// src/AppBundle/EventSubscriber/CartManager.php
29+
// src/EventSubscriber/CartManager.php
3030

31-
namespace AppBundle\EventSubscriber;
31+
namespace App\EventSubscriber;
3232

3333
use ApiPlatform\Core\EventListener\EventPriorities;
34-
use AppBundle\Entity\Product;
35-
use AppBundle\Exception\ProductNotFoundException;
34+
use App\Entity\Product;
35+
use App\Exception\ProductNotFoundException;
3636
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
3737
use Symfony\Component\HttpFoundation\Request;
3838
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
@@ -65,7 +65,7 @@ final class ProductManager implements EventSubscriberInterface
6565
If you use the standard distribution of API Platform, this event listener will be automatically registered. If you use a
6666
custom installation, [learn how to register listeners](events.md).
6767

68-
Then, configure the framework to catch `AppBundle\Exception\ProductNotFoundException` exceptions and convert them in `404`
68+
Then, configure the framework to catch `App\Exception\ProductNotFoundException` exceptions and convert them in `404`
6969
errors:
7070

7171
```yaml
@@ -77,7 +77,7 @@ api_platform:
7777
Symfony\Component\Serializer\Exception\ExceptionInterface: 400 # Use a raw status code (recommended)
7878
ApiPlatform\Core\Exception\InvalidArgumentException: 'HTTP_BAD_REQUEST' # Or a `Symfony\Component\HttpFoundation\Response`'s constant
7979

80-
AppBundle\Exception\ProductNotFoundException: 404 # Here is the handler for our custom exception
80+
App\Exception\ProductNotFoundException: 404 # Here is the handler for our custom exception
8181
```
8282
8383
Any type of `Exception` can be thrown, API Platform will convert it to a Symfony's `HttpException`. The framework also takes

core/performance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Sometimes you need individual resources like `/me`. To work properly with Varnis
3535

3636
declare(strict_types=1);
3737

38-
namespace AppBundle\EventSubscriber;
38+
namespace App\EventSubscriber;
3939

4040
use ApiPlatform\Core\EventListener\EventPriorities;
41-
use AppBundle\Entity\User;
41+
use App\Entity\User;
4242
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
4343
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
4444
use Symfony\Component\HttpKernel\KernelEvents;

core/validation.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ the `@ApiResource` annotation:
1313

1414
```php
1515
<?php
16-
// src/AppBundle/Entity/Product.php
16+
// src/Entity/Product.php
1717

18-
namespace AppBundle\Entity;
18+
namespace App\Entity;
1919

2020
use ApiPlatform\Core\Annotation\ApiResource;
21+
use App\Validator\Constraints\MinimalProperties; // A custom constraint
2122
use Doctrine\ORM\Mapping as ORM;
2223
use Symfony\Component\Validator\Constraints as Assert; // Symfony's built-in constraints
23-
use AppBundle\Validator\Constraints\MinimalProperties; // A custom constraint
2424

2525
/**
2626
* A product.
@@ -63,9 +63,9 @@ Here is a custom constraint and the related validator:
6363

6464
```php
6565
<?php
66-
// src/AppBundle/Validator/Constraints/MinimalProperties.php
66+
// src/Validator/Constraints/MinimalProperties.php
6767

68-
namespace AppBundle\Validator\Constraints;
68+
namespace App\Validator\Constraints;
6969

7070
use Symfony\Component\Validator\Constraint;
7171

@@ -80,9 +80,9 @@ class MinimalProperties extends Constraint
8080

8181
```php
8282
<?php
83-
// src/AppBundle/Validator/Constraints/MinimalPropertiesValidator.php
83+
// src/Validator/Constraints/MinimalPropertiesValidator.php
8484

85-
namespace AppBundle\Validator\Constraints;
85+
namespace App\Validator\Constraints;
8686

8787
use Symfony\Component\Validator\Constraint;
8888
use Symfony\Component\Validator\ConstraintValidator;

0 commit comments

Comments
 (0)