-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP [TASK] Replace hooks with PSR-14 events
Replace existing hooks with PSR-14 events Todo: * Replace missing hooks
- Loading branch information
Showing
5 changed files
with
152 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Extcode\Cart\Event\Cart; | ||
|
||
use Extcode\Cart\Domain\Model\Cart\Cart; | ||
use Extcode\Cart\Domain\Model\Order\BillingAddress; | ||
use Extcode\Cart\Domain\Model\Order\Item; | ||
use Extcode\Cart\Domain\Model\Order\ShippingAddress; | ||
use TYPO3\CMS\Extbase\Mvc\Request; | ||
|
||
final class ShowCartEvent implements ShowCartEventInterface | ||
{ | ||
public function __construct( | ||
private Cart $cart, | ||
private readonly Request $request, | ||
private readonly array $settings, | ||
private Item $orderItem, | ||
private BillingAddress $billingAddress, | ||
private ShippingAddress $shippingAddress | ||
) {} | ||
|
||
public function getCart(): Cart | ||
{ | ||
return $this->cart; | ||
} | ||
|
||
public function setCart(Cart $cart): void | ||
{ | ||
$this->cart = $cart; | ||
} | ||
|
||
public function getRequest(): Request | ||
{ | ||
return $this->request; | ||
} | ||
|
||
public function getSettings(): array | ||
{ | ||
return $this->settings; | ||
} | ||
|
||
public function getOrderItem(): Item | ||
{ | ||
return $this->orderItem; | ||
} | ||
public function setOrderItem(Item $orderItem): void | ||
{ | ||
$this->orderItem = $orderItem; | ||
} | ||
public function getBillingAddress(): BillingAddress | ||
{ | ||
return $this->billingAddress; | ||
} | ||
public function setBillingAddress(BillingAddress $billingAddress): void | ||
{ | ||
$this->billingAddress = $billingAddress; | ||
} | ||
public function getShippingAddress(): ShippingAddress | ||
{ | ||
return $this->shippingAddress; | ||
} | ||
public function setShippingAddress(ShippingAddress $shippingAddress): void | ||
{ | ||
$this->shippingAddress = $shippingAddress; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Extcode\Cart\Event\Cart; | ||
|
||
use Extcode\Cart\Domain\Model\Cart\Cart; | ||
use Extcode\Cart\Domain\Model\Order\BillingAddress; | ||
use Extcode\Cart\Domain\Model\Order\Item; | ||
use Extcode\Cart\Domain\Model\Order\ShippingAddress; | ||
use TYPO3\CMS\Extbase\Mvc\Request; | ||
|
||
interface ShowCartEventInterface | ||
{ | ||
public function __construct( | ||
Cart $cart, | ||
Request $request, | ||
array $settings, | ||
Item $orderItem, | ||
BillingAddress $billingAddress, | ||
ShippingAddress $shippingAddress | ||
); | ||
|
||
public function getCart(): Cart; | ||
|
||
public function getRequest(): Request; | ||
|
||
public function getSettings(): array; | ||
|
||
public function getOrderItem(): Item; | ||
|
||
public function getBillingAddress(): BillingAddress; | ||
|
||
public function getShippingAddress(): ShippingAddress; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
============================= | ||
Breaking: #452 - Remove Hooks | ||
============================= | ||
|
||
See :issue:`452` | ||
|
||
Description | ||
=========== | ||
|
||
Existing Hooks have been removed. They were replaced by EventListeners. | ||
The extension offered following hooks: | ||
|
||
* `showCartActionAfterCartWasLoaded` in `\Extcode\Cart\Controller\Cart\CartController` | ||
|
||
Affected Installations | ||
====================== | ||
|
||
All installations that used the hooks to programmatically adjust the behavior | ||
of the extension are affected. | ||
|
||
Migration | ||
========= | ||
|
||
* `showCartActionAfterCartWasLoaded` in `\Extcode\Cart\Controller\Cart\CartController` | ||
now needs to listen to the event `\Extcode\Cart\Event\Cart\ShowCartEvent` | ||
|
||
.. index:: API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters