Skip to content

Commit

Permalink
[WishlistBundle] make wishlist easier usable outside of CoreShop
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed May 3, 2023
1 parent 7a6d012 commit 15c7452
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 87 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ services:
- db
volumes:
- .:/var/www/html:cached
- ./.docker/xdebug-config.ini:/usr/local/etc/php/conf.d/21-xdebug.ini
environment:
PHP_IDE_CONFIG: serverName=localhost
XDEBUG_TRIGGER: PHPSTORM
Expand All @@ -110,6 +111,7 @@ services:
- db
volumes:
- .:/var/www/html:cached
- ./.docker/xdebug-config.ini:/usr/local/etc/php/conf.d/21-xdebug.ini
environment:
PHP_IDE_CONFIG: serverName=localhost
COMPOSER_HOME: /var/www/html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

namespace CoreShop\Bundle\CoreBundle\Pimcore\Repository;

use CoreShop\Component\Core\Wishlist\Repository\WishlistRepositoryInterface;
use CoreShop\Component\Core\Wishlist\Repository\WishlistRepositoryInterface as BaseWishlistRepository;
use CoreShop\Component\Customer\Model\CustomerInterface;
use CoreShop\Component\Store\Model\StoreInterface;
use CoreShop\Component\Wishlist\Model\WishlistInterface;

class WishlistRepository extends \CoreShop\Bundle\WishlistBundle\Pimcore\Repository\WishlistRepository implements WishlistRepositoryInterface
class WishlistRepository extends BaseWishlistRepository implements WishlistRepositoryInterface
{
public function findLatestByStoreAndCustomer(
StoreInterface $store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function load(array $configs, ContainerBuilder $container): void
'priority' => 10,
]);

$container->setParameter('coreshop.resources', []);
$container->setDefinition('coreshop.body_listener', $bodyListener);

$container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@

namespace CoreShop\Bundle\WishlistBundle\Pimcore\Repository;

use Carbon\Carbon;
use CoreShop\Bundle\ResourceBundle\Pimcore\PimcoreRepository;
use CoreShop\Component\StorageList\Model\StorageListInterface;
use CoreShop\Component\Wishlist\Model\WishlistInterface;
use CoreShop\Component\Wishlist\Repository\WishlistRepositoryInterface;

class WishlistRepository extends PimcoreRepository implements WishlistRepositoryInterface
{
public function findExpiredStorageLists(int $days, array $params = []): array
{
$daysTimestamp = Carbon::now();
$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 @@ -42,31 +42,6 @@
"datatype": "layout",
"permissions": null,
"children": [
{
"fieldtype": "input",
"width": "",
"defaultValue": null,
"columnLength": 190,
"regex": "",
"regexFlags": [],
"unique": false,
"showCharCount": false,
"name": "name",
"title": "Name",
"tooltip": "",
"mandatory": false,
"noteditable": false,
"index": false,
"locked": false,
"style": "",
"permissions": null,
"datatype": "data",
"relationType": false,
"invisible": false,
"visibleGridView": false,
"visibleSearch": false,
"defaultValueGenerator": ""
},
{
"fieldtype": "input",
"width": null,
Expand All @@ -92,27 +67,9 @@
"visibleSearch": false,
"defaultValueGenerator": ""
},
{
"fieldtype": "coreShopStore",
"allowEmpty": false,
"name": "store",
"title": "coreshop.order.store",
"tooltip": "",
"mandatory": false,
"noteditable": true,
"index": false,
"locked": false,
"style": "",
"permissions": null,
"datatype": "data",
"relationType": false,
"invisible": false,
"visibleGridView": false,
"visibleSearch": false
},
{
"fieldtype": "coreShopRelations",
"stack": "coreshop.product",
"stack": "coreshop.wishlist_item",
"relationType": true,
"objectsAllowed": true,
"assetsAllowed": false,
Expand All @@ -139,38 +96,6 @@
"invisible": false,
"visibleGridView": false,
"visibleSearch": false
},
{
"fieldtype": "coreShopRelation",
"stack": "coreshop.customer",
"relationType": true,
"objectsAllowed": true,
"assetsAllowed": false,
"documentsAllowed": false,
"returnConcrete": false,
"width": null,
"assetUploadPath": null,
"assetTypes": [],
"documentTypes": [],
"classes": [
{
"classes": "CoreShopCustomer"
}
],
"pathFormatterClass": "",
"name": "customer",
"title": "Customer",
"tooltip": "",
"mandatory": false,
"noteditable": false,
"index": false,
"locked": false,
"style": "",
"permissions": null,
"datatype": "data",
"invisible": false,
"visibleGridView": false,
"visibleSearch": false
}
],
"locked": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
"assetTypes": [],
"documentTypes": [],
"classes": [
{
"classes": "CoreShopProduct"
}
],
"pathFormatterClass": "",
"name": "product",
Expand Down Expand Up @@ -119,11 +116,6 @@
"invisible": false,
"visibleGridView": false,
"visibleSearch": false,
"classes": [
{
"classes": "CoreShopWishlist"
}
],
"pathFormatterClass": "",
"width": null,
"assetUploadPath": null,
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 15c7452

Please sign in to comment.