Merge branch '0.x' into prod
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 8m9s
CI / testsuite (mysql, 8.4, ) (push) Failing after 7m52s
CI / testsuite (pgsql, 8.2, ) (push) Failing after 7m53s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Failing after 9m18s
CI / testsuite (sqlite, 8.2, ) (push) Failing after 9m21s
CI / testsuite (pgsql, 8.4, ) (push) Failing after 10m57s
CI / testsuite (sqlite, 8.4, ) (push) Failing after 12m55s
CI / Coding Standard & Static Analysis (push) Failing after 7m32s
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 8m9s
CI / testsuite (mysql, 8.4, ) (push) Failing after 7m52s
CI / testsuite (pgsql, 8.2, ) (push) Failing after 7m53s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Failing after 9m18s
CI / testsuite (sqlite, 8.2, ) (push) Failing after 9m21s
CI / testsuite (pgsql, 8.4, ) (push) Failing after 10m57s
CI / testsuite (sqlite, 8.4, ) (push) Failing after 12m55s
CI / Coding Standard & Static Analysis (push) Failing after 7m32s
This commit is contained in:
@@ -18,17 +18,12 @@ use CakeCarts\Model\Table\CartsTable;
|
|||||||
*/
|
*/
|
||||||
class ShoppingCartComponent extends Component {
|
class ShoppingCartComponent extends Component {
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string $userIdField
|
|
||||||
*/
|
|
||||||
protected string $userIdField;
|
protected string $userIdField;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \CakeCarts\Model\Table\CartsTable|\Cake\ORM\Table $Carts
|
|
||||||
*/
|
|
||||||
protected CartsTable|Table $Carts;
|
protected CartsTable|Table $Carts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array $config
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void {
|
public function initialize(array $config): void {
|
||||||
@@ -46,6 +41,7 @@ class ShoppingCartComponent extends Component {
|
|||||||
protected array $_defaultConfig = [];
|
protected array $_defaultConfig = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param \Cake\Event\EventInterface $event
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function beforeFilter(EventInterface $event): void {
|
public function beforeFilter(EventInterface $event): void {
|
||||||
@@ -62,7 +58,7 @@ class ShoppingCartComponent extends Component {
|
|||||||
/**
|
/**
|
||||||
* @param string $cartId
|
* @param string $cartId
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return \Cake\Datasource\EntityInterface|\CakeCarts\Model\Entity\Cart
|
||||||
*/
|
*/
|
||||||
public function getCartForUserById(string $cartId) {
|
public function getCartForUserById(string $cartId) {
|
||||||
$identity = $this->getController()->getRequest()->getAttribute('identity');
|
$identity = $this->getController()->getRequest()->getAttribute('identity');
|
||||||
@@ -81,6 +77,12 @@ class ShoppingCartComponent extends Component {
|
|||||||
return $cartsQ->firstOrFail();
|
return $cartsQ->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sessionId
|
||||||
|
* @param int|null $cartTypeId
|
||||||
|
* @return EntityInterface|\CakeCarts\Model\Entity\Cart
|
||||||
|
*/
|
||||||
|
|
||||||
public function findExistingCartOrCreate(string $sessionId, int|null $cartTypeId = null) {
|
public function findExistingCartOrCreate(string $sessionId, int|null $cartTypeId = null) {
|
||||||
$identity = $this->getController()->getRequest()->getAttribute('identity');
|
$identity = $this->getController()->getRequest()->getAttribute('identity');
|
||||||
|
|
||||||
@@ -114,6 +116,9 @@ class ShoppingCartComponent extends Component {
|
|||||||
return $cart;
|
return $cart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getUserIdField() {
|
public function getUserIdField() {
|
||||||
return $this->userIdField;
|
return $this->userIdField;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ enum CartTypeId: int implements EnumLabelInterface
|
|||||||
case Wishlist = 2;
|
case Wishlist = 2;
|
||||||
case CustomList = 3;
|
case CustomList = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function label(): string {
|
public function label(): string {
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
static::Cart => 'Cart',
|
static::Cart => 'Cart',
|
||||||
|
|||||||
@@ -84,6 +84,12 @@ class CartItemsTable extends Table {
|
|||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires Pricing validation rules.
|
||||||
|
*
|
||||||
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
|
* @return \Cake\Validation\Validator
|
||||||
|
*/
|
||||||
public function validationRequiresPricing(Validator $validator): Validator {
|
public function validationRequiresPricing(Validator $validator): Validator {
|
||||||
$validator = $this->validationDefault($validator);
|
$validator = $this->validationDefault($validator);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user