Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit 71ca1b8

Browse files
author
Jens Schulze
authored
Me endpoints (#75)
Me endpoints
2 parents 7ba9af3 + 73eca4d commit 71ca1b8

File tree

483 files changed

+21278
-2445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

483 files changed

+21278
-2445
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
},
1111
"require": {
1212
"php": ">=7.0",
13+
"ext-json": "*",
1314
"symfony/framework-bundle": "^3.4 | ^4.0",
1415
"symfony/form": "^3.4 | ^4.0",
1516
"symfony/security-bundle": "^3.4 | ^4.0",
1617
"symfony/validator": "^3.4 | ^4.0",
1718
"symfony/serializer": "^3.4 | ^4.0",
1819
"symfony/cache": "^3.4 | ^4.0",
19-
"commercetools/php-sdk": "^2.6",
20+
"commercetools/php-sdk": "dev-develop",
2021
"symfony/var-dumper": "^3.4 | ^4.0",
2122
"symfony/dotenv": "^3.4 | ^4.0",
2223
"symfony/stopwatch": "^3.4 | ^4.0",
@@ -28,6 +29,7 @@
2829
"require-dev": {
2930
"phpunit/phpunit": "^7.0 | ^6.0 | ^5.0",
3031
"symfony/phpunit-bridge": "^3.4 | ^4.0",
32+
"phpspec/prophecy": "~1.0",
3133
"commercetools/commercetools-api-reference": "dev-master",
3234
"matthiasnoback/symfony-dependency-injection-test": "^3.0",
3335
"symfony/test-pack": "^1.0",

quickstart.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Quick-start
22

3+
* [Pre-requisites](#pre-requisites)
4+
* [Create a basic page](#create-a-basic-page)
5+
* [Install ExampleBundle](#examplebundle)
6+
* [Import sample data](#sample-data)
7+
* [Preview in browser](#preview-in-browser)
8+
39
### Pre-requisites
410

511
* You have successfully completed the Installation step and verified that everything works fine.
@@ -74,6 +80,83 @@ class DefaultController extends AbstractController
7480
{% endblock %}
7581
```
7682

83+
## ExampleBundle
84+
85+
You may enable ExampleBundle to have a running instance of the Sunrise sample e-shop. It
86+
resembles an e-shop demonstrating sample data, templates and functionalities.
87+
88+
* run `composer require symfony/asset symfony/translation`
89+
* enable all commercetools bundles in `config/bundles.php`
90+
```php
91+
return [
92+
...
93+
Commercetools\Symfony\CtpBundle\CtpBundle::class => ['all' => true],
94+
Commercetools\Symfony\ShoppingListBundle\ShoppingListBundle::class => ['all' => true],
95+
Commercetools\Symfony\CartBundle\CartBundle::class => ['all' => true],
96+
Commercetools\Symfony\CustomerBundle\CustomerBundle::class => ['all' => true],
97+
Commercetools\Symfony\ReviewBundle\ReviewBundle::class => ['all' => true],
98+
Commercetools\Symfony\CatalogBundle\CatalogBundle::class => ['all' => true],
99+
Commercetools\Symfony\ExampleBundle\ExampleBundle::class => ['all' => true],
100+
Commercetools\Symfony\SetupBundle\SetupBundle::class => ['all' => true],
101+
Commercetools\Symfony\StateBundle\StateBundle::class => ['all' => true],
102+
...
103+
];
104+
```
105+
* import the ExampleBundle routes in `config/routes.yaml`
106+
```yaml
107+
_example:
108+
resource: "@ExampleBundle/Resources/config/routing.yml"
109+
```
110+
111+
* enable user/customer management and authentication to be managed by commercetools
112+
by editing `congig/packages/security.yaml` as:
113+
```yaml
114+
security:
115+
providers:
116+
ctp:
117+
id: Commercetools\Symfony\CustomerBundle\Security\User\UserProvider
118+
access_control:
119+
- { path: /user/, roles: ROLE_USER }
120+
encoders:
121+
Symfony\Component\Security\Core\User\User: plaintext
122+
Commercetools\Symfony\CustomerBundle\Security\User\User: plaintext
123+
firewalls:
124+
main:
125+
anonymous: ~
126+
commercetools-login:
127+
login_path: login
128+
check_path: login_check
129+
default_target_path: _ctp_example_index
130+
logout:
131+
path: logout
132+
target: _ctp_example_index
133+
dev:
134+
pattern: ^/(_(profiler|wdt)|css|images|js)/
135+
security: false
136+
default:
137+
anonymous: ~
138+
```
139+
* note: to disable errors on undefined twig variables change in `config/packages/twig.yaml`. This is
140+
because right now there are undefined variables in the Sunrise templates. This setting should and it is
141+
recommended to be back to it's original value for any real world scenario.
142+
```yaml
143+
twig:
144+
strict_variables: false
145+
```
146+
147+
* recreate the translation messages by running:
148+
`bin/console translation:update --dump-messages --force en ExampleBundle`
149+
150+
## Sample Data
151+
152+
* At this point no data is inserted in the shop which will result to your sample e-shop be
153+
more or less empty and no sample products/categories/etc
154+
will be demonstrated. To import the sample Sunrise data please follow the procedure
155+
[here](https://github.com/commercetools/commercetools-sunrise-data/). You may run this importer
156+
in a repository other than the one you currently work at, since you will not need any of it
157+
after running it once on your project.
158+
159+
77160

78161
## Preview in browser
79162

@@ -86,5 +169,3 @@ created your project in commercetools, you will have to manually add some produc
86169
the list will be empty. If you, manually added some products and your locale was not `en`,
87170
you should change the parameter `en` used in the `DefaultController` above, to match the
88171
locale that you used in your products.
89-
90-

src/CartBundle/Event/CartCreateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Commercetools\Symfony\CartBundle\Event;
77

8-
use Symfony\Component\EventDispatcher\Event;
8+
use Symfony\Contracts\EventDispatcher\Event;
99

1010
class CartCreateEvent extends Event
1111
{

src/CartBundle/Event/CartGetEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Commercetools\Symfony\CartBundle\Event;
77

88
use Commercetools\Core\Model\Cart\Cart;
9-
use Symfony\Component\EventDispatcher\Event;
9+
use Symfony\Contracts\EventDispatcher\Event;
1010

1111
class CartGetEvent extends Event
1212
{

src/CartBundle/Event/CartNotFoundEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Commercetools\Symfony\CartBundle\Event;
77

8-
use Symfony\Component\EventDispatcher\Event;
8+
use Symfony\Contracts\EventDispatcher\Event;
99

1010
class CartNotFoundEvent extends Event
1111
{

src/CartBundle/Event/CartPostCreateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Commercetools\Symfony\CartBundle\Event;
77

88
use Commercetools\Core\Model\Cart\Cart;
9-
use Symfony\Component\EventDispatcher\Event;
9+
use Symfony\Contracts\EventDispatcher\Event;
1010

1111
class CartPostCreateEvent extends Event
1212
{

src/CartBundle/Event/CartPostUpdateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Commercetools\Core\Model\Cart\Cart;
88
use Commercetools\Core\Request\AbstractAction;
9-
use Symfony\Component\EventDispatcher\Event;
9+
use Symfony\Contracts\EventDispatcher\Event;
1010

1111
class CartPostUpdateEvent extends Event
1212
{

src/CartBundle/Event/CartUpdateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Commercetools\Core\Model\Cart\Cart;
88
use Commercetools\Core\Request\AbstractAction;
9-
use Symfony\Component\EventDispatcher\Event;
9+
use Symfony\Contracts\EventDispatcher\Event;
1010

1111
class CartUpdateEvent extends Event
1212
{

src/CartBundle/Event/OrderCreateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Commercetools\Symfony\CartBundle\Event;
77

8-
use Symfony\Component\EventDispatcher\Event;
8+
use Symfony\Contracts\EventDispatcher\Event;
99

1010
class OrderCreateEvent extends Event
1111
{

src/CartBundle/Event/OrderPostCreateEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Commercetools\Symfony\CartBundle\Event;
77

8-
use Symfony\Component\EventDispatcher\Event;
8+
use Symfony\Contracts\EventDispatcher\Event;
99

1010
class OrderPostCreateEvent extends Event
1111
{

0 commit comments

Comments
 (0)