<commit_before><?php

/*
 * This file is part of the Sylius sandbox application.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sylius\Sandbox\Bundle\CartBundle\Entity;

use Sylius\Bundle\AssortmentBundle\Model\ProductInterface;
use Sylius\Bundle\CartBundle\Entity\Item as BaseItem;

/**
 * Cart item entity.
 *
 * @author <NAME> <<EMAIL>>
 */
class Item extends BaseItem
{
    /**
     * Product.
     *
     * @var ProductInterface
     */
    protected $product;

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

        $this->setQuantity(1);
    }

    /**
     * Get associated product.
     *
     * @return ProductInterface
     */
    public function getProduct()
    {
        return $this->product;
    }

    /**
     * Set associated product.
     *
     * @param ProductInterface $product
     */
    public function setProduct(ProductInterface $product)
    {
        $this->product = $product;
    }
}<commit_msg>fix item equality check.<commit_after><?php

/*
 * This file is part of the Sylius sandbox application.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sylius\Sandbox\Bundle\CartBundle\Entity;

use Sylius\Bundle\AssortmentBundle\Model\ProductInterface;
use Sylius\Bundle\CartBundle\Entity\Item as BaseItem;
use Sylius\Bundle\CartBundle\Model\ItemInterface;

/**
 * Cart item entity.
 *
 * @author <NAME> <<EMAIL>>
 */
class Item extends BaseItem
{
    /**
     * Product.
     *
     * @var ProductInterface
     */
    protected $product;

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

        $this->setQuantity(1);
    }

    /**
     * Get associated product.
     *
     * @return ProductInterface
     */
    public function getProduct()
    {
        return $this->product;
    }

    /**
     * Set associated product.
     *
     * @param ProductInterface $product
     */
    public function setProduct(ProductInterface $product)
    {
        $this->product = $product;
    }

    /**
     * {@inheritdoc}
     */
    public function equals(ItemInterface $item)
    {
        return $this->getProduct()->getId() === $item->getProduct()->getId();
    }
}
{'fraction_non_alphanumeric': 0.12062420919443273, 'fraction_numerical': 0.0008435259384226065, 'mean_word_length': 2.447674418604651, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7145545', 'n_tokens_mistral': 699, 'n_tokens_neox': 688, 'n_words': 175}