<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;/** * ModuleText * * @ORM\Table(name="module_carousels") * @ORM\Entity */class ModuleCarousel { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\ManyToOne(targetEntity="ModuleHook") * @ORM\JoinColumn(name="module_hook_id", referencedColumnName="id") */ private $moduleHook; /** * @var integer * * @ORM\OneToMany(targetEntity="ModuleCarouselItem", mappedBy="moduleCarousel", cascade={"remove"}) * @ORM\OrderBy({"orderNum" = "ASC"}) */ private $items; /** * @var string * * @ORM\Column(name="speed", type="float", nullable=true) */ private $speed; /** * @var string * * @ORM\Column(name="display", type="float", nullable=true) */ private $display; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Chargement des paramètres du module */ public function getData(ModuleHook $module_hooked) { $data = array(); $data['items'] = $this->getItems(); $data['speed'] = $this->getSpeed()*1000; $data['display'] = $this->getDisplay()*1000; return $data; } /** * @return the $moduleHook */ public function getModuleHook() { return $this->moduleHook; } /** * @param field_type $moduleHook */ public function setModuleHook($moduleHook) { $this->moduleHook = $moduleHook; } /** * @return the $items */ public function getItems() { return $this->items; } public function getItemsByPriceContext(?PriceGroup $priceGroup) { $output = []; foreach($this->items as $item){ if($item->matchPriceContext($priceGroup)) $output[] = $item; } return $output; } public function getSpeed() { if(empty($this->speed)) return 1; return $this->speed; } public function setSpeed($speed) { $this->speed = $speed; } public function getDisplay() { if(empty($this->display)) return 5; return $this->display; } public function setDisplay($display) { $this->display = $display; } public function setItems($items) { $this->items = $items; }}