Skip to content

Commit

Permalink
[Wishlist] Wishlist Expiry for single use
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed May 4, 2023
1 parent c21cab4 commit c8f2adf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
use CoreShop\Component\Core\Wishlist\Repository\WishlistRepositoryInterface;
use CoreShop\Component\Customer\Model\CustomerInterface;
use CoreShop\Component\StorageList\Repository\CustomerExpiryRepositoryTrait;
use CoreShop\Component\StorageList\Repository\ExpireAbleStorageListRepositoryInterface;
use CoreShop\Component\Store\Model\StoreInterface;
use CoreShop\Component\Wishlist\Model\WishlistInterface;

class WishlistRepository extends BaseWishlistRepository implements WishlistRepositoryInterface, ExpireAbleStorageListRepositoryInterface
class WishlistRepository extends BaseWishlistRepository implements WishlistRepositoryInterface
{
use CustomerExpiryRepositoryTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@

class WishlistRepository extends PimcoreRepository implements WishlistRepositoryInterface
{
public function findExpiredStorageLists(int $days, array $params = []): array
{
$daysTimestamp = Carbon::now();

Check failure on line 30 in src/CoreShop/Bundle/WishlistBundle/Pimcore/Repository/WishlistRepository.php

View workflow job for this annotation

GitHub Actions / ^10.5, PHP 8, Deps lowest

Call to static method now() on an unknown class CoreShop\Bundle\WishlistBundle\Pimcore\Repository\Carbon.
$daysTimestamp->subDays($days);
$queryParams = [$daysTimestamp->getTimestamp()];

$list = $this->getList();
$list->setCondition('o_modificationDate < ?', $queryParams);

/**
* @var StorageListInterface[] $result
*/
$result = $list->getObjects();

return $result;
}

public function findByStorageListId(int $id): ?StorageListInterface
{
return $this->find($id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

namespace CoreShop\Component\Wishlist\Repository;

use CoreShop\Component\StorageList\Repository\ExpireAbleStorageListRepositoryInterface;
use CoreShop\Component\StorageList\Repository\PimcoreStorageListRepositoryInterface;
use CoreShop\Component\StorageList\Repository\ShareableStorageListRepositoryInterface;
use CoreShop\Component\Wishlist\Model\WishlistInterface;

interface WishlistRepositoryInterface extends PimcoreStorageListRepositoryInterface, ShareableStorageListRepositoryInterface
interface WishlistRepositoryInterface extends PimcoreStorageListRepositoryInterface, ShareableStorageListRepositoryInterface, ExpireAbleStorageListRepositoryInterface
{
public function findByToken(string $token): ?WishlistInterface;
}

0 comments on commit c8f2adf

Please sign in to comment.