ancarebeca / FullCalendarBundle

Symfony3 integration with the library FullCalendar.js
36 stars 38 forks source link

CalendarEvent class don't herit Event class #29

Closed Xipotera closed 7 years ago

Xipotera commented 7 years ago

Hello I create my Calendar Event class

<?php

namespace AppBundle\Entity;

use AncaRebeca\FullCalendarBundle\Model\Event as BaseEvent;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="f_calendar")
 */
class CalendarEvent extends BaseEvent
{
    /**
     * @ORM\Id
     * @ORM\Column(name="id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

}

after php bin/console doctrine:schema:update --force my database don't herit Event and i only have the ID field!!!

Can you help me to solve this problem?

mgonyan commented 7 years ago

@Xipotera, where are the doctrine mapping config for the other fields ? that is way you only have one field, because you have only mapped the id field.

Xipotera commented 7 years ago

hi, i am beginner on Symfony

i know i only mapped ID field but i like do something like FosuserBundle where a personnalize user class herit fields from the model describe on FOSUserBundle.

Here the bundle have fields mapped on the AncaRebeca\FullCalendarBundle\Model\Event and i think it was the same way to add them mapped

Sorry for bad english

mgonyan commented 7 years ago

@Xipotera, no worries about your english, I can understand what you mean 😉. The purpose of the class AncaRebeca\FullCalendarBundle\Model\Event is give you a representation of a default event and then you can extend add the the persisting layer you consider convenient for your project. What you could do is either override the properties within your class adding the annotations, something like this:

/**
 * @ORM\Entity
 * @ORM\Table(name="f_calendar")
 */
class CalendarEvent extends BaseEvent
{
    /**
     * @ORM\Id
     * @ORM\Column(name="id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Id
     * @ORM\Column(name="title", type="string")
     */
    protected $title;

    /**
     * @ORM\Column(name="all_day", type="boolean")
     */
    protected $allDay = true;

    // ... All the fields with the annotation 
}

Or keep your class as it is removing the annotations and create a yml/xml doctrine mapping file.

Xipotera commented 7 years ago

Ok thanks for your reply! I'll do that! But just for fun ;) there is no way to make in the bundle something like FOSUserBundle who inherit the model User?