Skip to content

Commit

Permalink
Merge pull request #907 from dpfaffenbauer/whishlist
Browse files Browse the repository at this point in the history
[StorageList] StorageList are not Pimcore Objects per se
  • Loading branch information
dpfaffenbauer authored Mar 31, 2019
2 parents a8fff2a + cfc40a7 commit 50105c4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% for item in wishlist.getItems %}
{% set product = item.getProduct %}
{% set productUrl = coreshop_path(product, 'coreshop_product_detail') %}
<tr class="shopping-wishlist-item shopping-wishlist-item-{{ item.getId }}">
<tr class="shopping-wishlist-item">
<td class="text-center">
{% if item.getProduct and item.getProduct.getImage() %}
<a class="" href="{{ productUrl }}">
Expand All @@ -45,7 +45,7 @@
{{ currency.getPrice(product) }}
</td>
<td class="text-center">
<a href="{{ coreshop_path('coreshop_wishlist_remove', {product: product.getId}) }}" title="{{ 'coreshop.ui.remove'|trans }}" class="btn btn-danger tool-tip" data-id="{{ product.getId }}">
<a href="{{ coreshop_path('coreshop_wishlist_remove', {product: product.id}) }}" title="{{ 'coreshop.ui.remove'|trans }}" class="btn btn-danger tool-tip" data-id="{{ product.getId }}">
<i class="fa fa-times-circle"></i>
</a>
</td>
Expand All @@ -58,4 +58,4 @@
<p>{{ 'coreshop.ui.wishlist_empty'|trans }}</p>
{% endif %}
<br/>
{% endblock %}
{% endblock %}
5 changes: 1 addition & 4 deletions src/CoreShop/Component/StorageList/Model/StorageList.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

namespace CoreShop\Component\StorageList\Model;

use CoreShop\Component\Resource\Pimcore\Model\AbstractPimcoreModel;
use Webmozart\Assert\Assert;

class StorageList extends AbstractPimcoreModel implements StorageListInterface
class StorageList implements StorageListInterface
{
/**
* @var array
Expand All @@ -24,8 +23,6 @@ class StorageList extends AbstractPimcoreModel implements StorageListInterface

public function __construct()
{
parent::__construct();

$this->items = [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

namespace CoreShop\Component\StorageList\Model;

use CoreShop\Component\Resource\Model\ResourceInterface;

interface StorageListInterface extends ResourceInterface
interface StorageListInterface
{
/**
* @param StorageListProductInterface $product
Expand Down
12 changes: 9 additions & 3 deletions src/CoreShop/Component/StorageList/Model/StorageListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

namespace CoreShop\Component\StorageList\Model;

use CoreShop\Component\Resource\Pimcore\Model\AbstractPimcoreModel;

class StorageListItem extends AbstractPimcoreModel implements StorageListItemInterface
class StorageListItem implements StorageListItemInterface
{
/**
* @var int
Expand All @@ -26,6 +24,14 @@ class StorageListItem extends AbstractPimcoreModel implements StorageListItemInt
*/
protected $product;

/**
* {@inheritdoc}
*/
public function getId()
{
return $this->product ? $this->product->getId() : 0;
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@

namespace CoreShop\Component\StorageList\Model;

use CoreShop\Component\Resource\Model\ResourceInterface;

interface StorageListItemInterface extends ResourceInterface
interface StorageListItemInterface
{
/**
* @return int
*/
public function getId();

/**
* @return StorageListProductInterface
*/
Expand Down

0 comments on commit 50105c4

Please sign in to comment.