<commit_before><?php

namespace Xima\ICalBundle\Entity\Component;

use Symfony\Component\HttpFoundation\Request;

/**
 * @author <NAME> <<EMAIL>>
 *
 * @todo Map missing properties: attendees and categories
 */
class Event extends \Eluceo\iCal\Component\Event
{
    /**
     * @var int
     */
    private $id;

    /**
     * @var \Event
     */
    private $parentEvent;

    public function __construct()
    {
        parent::__construct(self::generateUniqueId());
    }

    public function __toString()
    {
        return get_class($this);
    }

    public static function generateUniqueId()
    {
        $request = Request::createFromGlobals();
        $uniqueId = time().'-'.get_current_user().'@'.$request->server->get('SERVER_NAME');

        return $uniqueId;
    }

    public function removeRecurrenceRule()
    {
        $this->recurrenceRule = null;

        return $this;
    }

    /**
     * @return \Event
     */
    public function getParentEvent()
    {
        return $this->parentEvent;
    }

    /**
     * @param \Event $parentEvent
     *
     * @return Event
     */
    public function setParentEvent($parentEvent)
    {
        $this->parentEvent = $parentEvent;

        return $this;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;<commit_msg>Store exDates as timestamps via lifecyclecallbacks<commit_after><?php

namespace Xima\ICalBundle\Entity\Component;

use Symfony\Component\HttpFoundation\Request;
use Doctrine\ORM\Mapping as ORM;

/**
 * @author <NAME> <<EMAIL>>
 * @todo Map missing properties: attendees and categories
 * 
 * @ORM\HasLifecycleCallbacks
 */
class Event extends \Eluceo\iCal\Component\Event
{
    /**
     * @var int
     */
    private $id;

    /**
     * @var \Event
     */
    private $parentEvent;

    public function __construct()
    {
        parent::__construct(self::generateUniqueId());
    }

    public function __toString()
    {
        return get_class($this);
    }

    public static function generateUniqueId()
    {
        $request = Request::createFromGlobals();
        $uniqueId = time().'-'.get_current_user().'@'.$request->server->get('SERVER_NAME');

        return $uniqueId;
    }

    public function removeRecurrenceRule()
    {
        $this->recurrenceRule = null;

        return $this;
    }
    
    /** @ORM\PrePersist */
    public function prePersist()
    {
        $this->preSave();
    }
    
    /** @ORM\PreUpdate */
    public function preUpdate()
    {
        $this->preSave();
    }
    
    private function preSave()
    {
        //this->exDates: convert DateTimes to Timestamps
        $exDates = $this->exDates;
        $this->exDates = array();
         
        foreach ($exDates as $exDate) {
            $this->exDates[] = $exDate->getTimestamp();
        }
    }
    
    /** @ORM\PostLoad */
    public function postLoad()
    {
        //this->exDates: convert Timestamps to DateTimes
        $exDates = $this->exDates;
        $this->exDates = array();
         
        foreach ($exDates as $exDate) {
            $dateTime = new \DateTime();
            $dateTime->setTimestamp($exDate);
            $this->exDates[] = $dateTime;
        }
    }
    
    /**
     * @return \Event
     */
    public function getParentEvent()
    {
        return $this->parentEvent;
    }

    /**
     * @param \Event $parentEvent
     *
     * @return Event
     */
    public function setParentEvent($parentEvent)
    {
        $this->parentEvent = $parentEvent;

        return $this;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
{'fraction_non_alphanumeric': 0.1357045143638851, 'fraction_numerical': 0.0, 'mean_word_length': 1.9893704006541293, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1749694', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1101, 'n_words': 218}