|
|
|
|
|
|
|
|
namespace Lc\ShopBundle\Model; |
|
|
namespace Lc\ShopBundle\Model; |
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
use Symfony\Component\HttpFoundation\File\File; |
|
|
|
|
|
use Vich\UploaderBundle\Mapping\Annotation as Vich; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @ORM\MappedSuperclass() |
|
|
* @ORM\MappedSuperclass() |
|
|
|
|
|
* @Vich\Uploadable |
|
|
*/ |
|
|
*/ |
|
|
abstract class MerchantConfig |
|
|
|
|
|
|
|
|
abstract class MerchantConfig extends AbstractEntity |
|
|
{ |
|
|
{ |
|
|
/** |
|
|
/** |
|
|
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="merchantConfigs") |
|
|
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="merchantConfigs") |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
protected $value; |
|
|
protected $value; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Vich\UploadableField(mapping="images", fileNameProperty="value") |
|
|
|
|
|
* @var File |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $imageFile; |
|
|
|
|
|
|
|
|
public static $availableOptions = [] ; |
|
|
public static $availableOptions = [] ; |
|
|
|
|
|
|
|
|
public function getMerchant(): ?Merchant |
|
|
public function getMerchant(): ?Merchant |
|
|
|
|
|
|
|
|
return $this; |
|
|
return $this; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function setImageFile(File $image = null) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->imageFile = $image; |
|
|
|
|
|
|
|
|
|
|
|
// VERY IMPORTANT: |
|
|
|
|
|
// It is required that at least one field changes if you are using Doctrine, |
|
|
|
|
|
// otherwise the event listeners won't be called and the file is lost |
|
|
|
|
|
if ($image) { |
|
|
|
|
|
// if 'updatedAt' is not defined in your entity, use another property |
|
|
|
|
|
$this->updatedAt = new \DateTime('now'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getImageFile() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->imageFile; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static function getAvailableOptions(): array |
|
|
public static function getAvailableOptions(): array |
|
|
{ |
|
|
{ |
|
|
return static::$availableOptions ; |
|
|
return static::$availableOptions ; |