<?php
namespace Roothirsch\ShopBundle\Entity\Order;
use Roothirsch\CoreBundle\Behaviors\Attributable\AttributeInterface;
use Roothirsch\CoreBundle\Behaviors\Attributable\AttributeOption\AttributeOptionAwareTrait;
use Roothirsch\CoreBundle\Behaviors\Attributable\AttributeValue\AttributeValueAwareTrait;
use Roothirsch\CoreBundle\Behaviors\Attributable\MappedSuperclass\AbstractAttribute;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Roothirsch\ShopBundle\Entity\Order\OrderAttributeOption;
use Roothirsch\ShopBundle\Entity\Order\OrderAttributeValue;
use ApiPlatform\Core\Annotation\ApiResource;
use Roothirsch\ShopBundle\Repository\OrderAttributeRepository;
/**
* @ApiResource( shortName="Shop/OrderAttribute")
* @ORM\Entity(repositoryClass=OrderAttributeRepository::class)
* @ORM\Table(name="shop_order_attribute")
*/
class OrderAttribute extends AbstractAttribute
{
use AttributeOptionAwareTrait;
use AttributeValueAwareTrait;
/**
* @ORM\OneToMany(targetEntity=OrderAttributeValue::class, mappedBy="attribute", orphanRemoval=true)
*/
private $attributeValues;
/**
* @ORM\OneToMany(targetEntity=OrderAttributeOption::class, mappedBy="attribute", orphanRemoval=true, cascade={"persist"})
* @ORM\OrderBy({"position" = "ASC"})
*/
private $attributeOptions;
}