<?php
declare(strict_types=1);
namespace App\Entity\System;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
*
* @ORM\Table(name="ps_feature")
*
* @ORM\Entity(repositoryClass="App\Repository\System\FeatureRepository")
*/
class Feature
{
/**
* @var int
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=30)
*/
private $reference;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
*/
private $dateAdd;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var FeatureLang[]|Collection<int, FeatureLang>
*
* @ORM\OneToMany(targetEntity="FeatureLang", mappedBy="feature")
*/
private $featureLangs;
/**
* @var ArrayCollection<int, FeatureProduct>|FeatureProduct[]
*
* @ORM\OneToMany(targetEntity="App\Entity\System\FeatureProduct", mappedBy="feature")
*/
private $featureProducts;
public function __construct()
{
$this->featureLangs = new ArrayCollection();
$this->featureProducts = new ArrayCollection();
}
public function getId(): int
{
return $this->id;
}
public function getReference(): string
{
return $this->reference;
}
public function setReference(string $reference): Feature
{
$this->reference = $reference;
return $this;
}
public function getDateAdd(): \DateTime
{
return $this->dateAdd;
}
public function setDateAdd(\DateTime $dateAdd): Feature
{
$this->dateAdd = $dateAdd;
return $this;
}
public function isActive(): bool
{
return $this->active;
}
public function setActive(bool $active): Feature
{
$this->active = $active;
return $this;
}
/**
* @return FeatureLang[]|Collection<int, FeatureLang>
*/
public function getFeatureLangs()
{
return $this->featureLangs;
}
/**
* @param Collection<int, FeatureLang>|FeatureLang[] $featureLangs
*/
public function setFeatureLangs($featureLangs): Feature
{
$this->featureLangs = $featureLangs;
return $this;
}
/**
* @return FeatureProduct[]|ArrayCollection<int, FeatureProduct>
*/
public function getFeatureProducts()
{
return $this->featureProducts;
}
/**
* @param FeatureProduct[]|ArrayCollection<int, FeatureProduct> $featureProducts
*
* @return Feature
*/
public function setFeatureProducts($featureProducts)
{
$this->featureProducts = $featureProducts;
return $this;
}
/**
* @return array<string, FeatureLang>
*/
public function getTranslationsIndexedByIsoCode(): array
{
$translations = [];
foreach ($this->featureLangs as $translation) {
$isoCode = strtolower($translation->getLanguage()->getIsoCode());
$translations[$isoCode] = $translation;
}
return $translations;
}
}