<?php
namespace App\Calendar\Event;
use App\Calendar\Model\CalendarEvent;
use Pimcore\Model\DataObject\Auction;
class AuctionEventStrategy implements EventStrategyInterface
{
public function canProcess($data)
{
return $data instanceof Auction;
}
/**
* Convert a Auction to an CalendarEvent.
*
* @param Auction $auction
*
* @return CalendarEvent
*/
public function process($auction)
{
$auctionhouse = $auction->getAuctionhouse();
$event = new CalendarEvent();
$event->title = $auction->getTitle();
$event->type = $auction->getClassName();
$event->object = $auction;
$event->start = $auction->getStart();
$event->end = $auction->getEnd();
if ($auctionhouse) {
$event->color = $auctionhouse->getColor();
}
return $event;
}
}