Being a part of the Symfony ecosystem gives access to the vast number of open-source solutions built on top. A lot of people voluntarily committed the time to make impressive, multipurpose solutions. One of these solutions is the API Platform, the most mature framework for API development.
In Sylius, it was always our goal to take advantage of the best of the breed and integrate with others. Keeping this in mind, we have decided to combine both projects and deliver a new quality in the headless e-commerce world.
How did it go to integrate new infrastructure to the existing, pretty big codebase? What were the main challenges that we encountered, and how did we solve them? What are the key take-outs from our integrations? I will answer these and a few more questions during this presentation.
63. class AddItemToCart implements OrderTokenValueAwareInterfac
e
{
public ?string $orderTokenValue
;
public string $productVariantCode
;
public int $quantity
;
public function getOrderTokenValue(): ?strin
g
{
return $this->orderTokenValue
;
}
public function setOrderTokenValue(?string $orderTokenValue): voi
d
{
$this->orderTokenValue = $orderTokenValue
;
}
}
64. final class OrderTokenValueAwareInputCommandDataTransforme
r
implements CommandDataTransformerInterfac
e
{
public function transform($object, string $to, array $context = []
)
{
/** @var OrderInterface $cart *
/
$cart = $context['object_to_populate']
;
$object->setOrderTokenValue($cart->getTokenValue())
;
return $object
;
}
public function supportsTransformation($object): boo
l
{
return $object instanceof OrderTokenValueAwareInterface
;
}
}
88. class AddItemToCart implements IriToIdenti
fi
erConversionAwareInterfac
e
{
public string $orderToken
;
public string $productVariantCode
;
public int $quantity
;
}
105. Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background:
Given there is a user "ted@example.com" identi
fi
ed by "bear
"
Scenario: Sign in with email and passwor
d
When I want to log in with the "ted@example.com" email and the "bear" passwor
d
Then I should be logged in
109. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background
:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @ap
i
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
110. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background
:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @api
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
111. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background
:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @ap
i
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
112. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background
:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @ap
i
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
113. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background
:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @ap
i
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
114. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @ap
i
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
115. /*
*
* @When I log i
n
*
/
public function iLogIn(
)
{
$this->loginPage->logIn()
;
}
116. @customer_logi
n
Feature: Signing in to the stor
e
In order to view my order
s
As a Visito
r
I want to be able to log in to the stor
e
Background:
Given the store operates on a single channel in "United States
"
And there is a user "ted@example.com" identi
fi
ed by "bear
"
@ui @api
Scenario: Sign in with email and passwor
d
When I want to log i
n
And I specify the username as "ted@example.com
"
And I specify the password as "bear
"
And I log i
n
Then I should be logged in
117. /*
*
* @When I log i
n
*
/
public function iLogIn(): voi
d
{
$this->client->call()
;
}