Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PlaceOrderFactory.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
16 {
20  private $objectManager;
21 
25  private $placeOrderPool;
26 
31  public function __construct(
32  ObjectManagerInterface $objectManager,
33  PlaceOrderPool $placeOrderPool
34  ) {
35  $this->objectManager = $objectManager;
36  $this->placeOrderPool = $placeOrderPool;
37  }
38 
43  public function create(string $paymentProviderCode): PlaceOrderInterface
44  {
45  $service = $this->placeOrderPool->get($paymentProviderCode);
46  if ($service === null) {
47  $service = $this->objectManager->get(PlaceOrderDefault::class);
48  }
49 
50  return $service;
51  }
52 }
$objectManager
Definition: bootstrap.php:17
__construct(ObjectManagerInterface $objectManager, PlaceOrderPool $placeOrderPool)