src/Calendar/Event/AuctionEventStrategy.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Calendar\Event;
  3. use App\Calendar\Model\CalendarEvent;
  4. use Pimcore\Model\DataObject\Auction;
  5. class AuctionEventStrategy implements EventStrategyInterface
  6. {
  7.   public function canProcess($data)
  8.   {
  9.     return $data instanceof Auction;
  10.   }
  11.   /**
  12.    * Convert a Auction to an CalendarEvent.
  13.    *
  14.    * @param Auction $auction
  15.    *
  16.    * @return CalendarEvent
  17.    */
  18.   public function process($auction)
  19.   {
  20.     $auctionhouse $auction->getAuctionhouse();
  21.     $event = new CalendarEvent();
  22.     $event->title $auction->getTitle();
  23.     $event->type $auction->getClassName();
  24.     $event->object $auction;
  25.     $event->start $auction->getStart();
  26.     $event->end $auction->getEnd();
  27.     if ($auctionhouse) {
  28.       $event->color $auctionhouse->getColor();
  29.     }
  30.     return $event;
  31.   }
  32. }