mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Remove the remaining resolver references
This commit is contained in:
parent
66d152dc69
commit
1c3e513aee
4 changed files with 3 additions and 24 deletions
|
|
@ -39,10 +39,10 @@ You're interacting with them like you usually do with own entities in your proje
|
|||
$item = $this->get('sylius.repository.cart')->createNew();
|
||||
}
|
||||
|
||||
Provider and Resolver
|
||||
---------------------
|
||||
Provider
|
||||
--------
|
||||
|
||||
There are also 3 more services for you.
|
||||
There is also 1 more service for you.
|
||||
|
||||
You use the provider to obtain the current user cart, if there is none, a new one is created and saved.
|
||||
The ``->setCart()`` method also allows you to replace the current cart.
|
||||
|
|
@ -62,20 +62,3 @@ This is useful, for example, when after completing an order you want to start wi
|
|||
$provider->setCart($customCart);
|
||||
$provider->abandonCart();
|
||||
}
|
||||
|
||||
The resolver is used to create a new item based on the user request.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
// ...
|
||||
public function addItemAction(Request $request)
|
||||
{
|
||||
$resolver = $this->get('sylius.cart_resolver');
|
||||
$item = $resolver->resolve($this->createNew(), $request);
|
||||
}
|
||||
|
||||
.. note::
|
||||
|
||||
A more advanced example of a resolver implementation is available `in Sylius Sandbox application on GitHub <https://github.com/Sylius/Sylius-Sandbox/blob/master/src/Sylius/Bundle/SandboxBundle/Resolver/ItemResolver.php>`_.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ class Configuration implements ConfigurationInterface
|
|||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->cannotBeEmpty()->end()
|
||||
->scalarNode('resolver')->isRequired()->cannotBeEmpty()->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ class SyliusCartExtension extends AbstractResourceExtension implements PrependEx
|
|||
$loader->load($configFile);
|
||||
}
|
||||
|
||||
$container->setAlias('sylius.cart_resolver', $config['resolver']);
|
||||
|
||||
$definition = $container->getDefinition('sylius.form.type.cart_item');
|
||||
$definition->addArgument(new Reference('sylius.form.data_mapper.order_item_quantity'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ sylius_association:
|
|||
interface: Sylius\Component\Product\Model\ProductAssociationInterface
|
||||
|
||||
sylius_cart:
|
||||
resolver: sylius.cart_item_resolver.default
|
||||
resources:
|
||||
cart:
|
||||
classes:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue