Доктрина symfony2 допускает нулевые значения?

Итак, я все еще ДЕЙСТВИТЕЛЬНО новичок в symfony, но я быстро учусь... Я создал сущность и crud (я забыл, как я это сделал на самом деле, но это было с помощью команды line)..

Сущность была создана с этим:

namespace Ecs\CrmBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Ecs\CrmBundle\Entity\TimeClock
 */
class TimeClock
{
    /**
     * @var integer $id
     */
    private $id;

    /**
     * @var datetime $in1
     */
    private $in1;

    /**
     * @var datetime $out1
     */
    private $out1;

    /**
     * @var datetime $in2
     */
    private $in2;

    /**
     * @var datetime $out2
     */
    private $out2;

    /**
     * @var datetime $in3
     */
    private $in3;

    /**
     * @var datetime $out3
     */
    private $out3;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set in1
     *
     * @param datetime $in1
     * @return TimeClock
     */
    public function setin1($in1)
    {
        $this->in1 = $in1;
        return $this;
    }

    /**
     * Get in1
     *
     * @return datetime 
     */
    public function getin1()
    {
        return $this->in1;
    }

    /**
     * Set in2
     *
     * @param datetime $in2
     * @return TimeClock
     */
    public function setin2($in2)
    {
        $this->in2 = $in2;
        return $this;
    }

    /**
     * Get in2
     *
     * @return datetime 
     */
    public function getin2()
    {
        return $this->in2;
    }

    /**
     * Set in3
     *
     * @param datetime $in3
     * @return TimeClock
     */
    public function setin3($in3)
    {
        $this->in3 = $in3;
        return $this;
    }

    /**
     * Get in3
     *
     * @return datetime 
     */
    public function getin3()
    {
        return $this->in3;
    }

    /**
     * Set in4
     *
     * @param datetime $in4
     * @return TimeClock
     */
    public function setin4($in4)
    {
        $this->in4 = $in4;
        return $this;
    }

    /**
     * Get in4
     *
     * @return datetime 
     */
    public function getin4()
    {
        return $this->in4;
    }

    /**
     * Set in5
     *
     * @param datetime $in5
     * @return TimeClock
     */
    public function setin5($in5)
    {
        $this->in5 = $in5;
        return $this;
    }

    /**
     * Get in5
     *
     * @return datetime 
     */
    public function getin5()
    {
        return $this->in5;
    }

    /**
     * Set in6
     *
     * @param datetime $in6
     * @return TimeClock
     */
    public function setin6($in6)
    {
        $this->in6 = $in6;
        return $this;
    }

    /**
     * Get in6
     *
     * @return datetime 
     */
    public function getin6()
    {
        return $this->in6;
    }
    /**
     * @var Ecs\AgentManagerBundle\Entity\User
     */
    private $noteBy;


    /**
     * Set noteBy
     *
     * @param Ecs\AgentManagerBundle\Entity\User $noteBy
     * @return TimeClock
     */
    public function setNoteBy(\Ecs\AgentManagerBundle\Entity\User $noteBy = null)
    {
        $this->noteBy = $noteBy;
        return $this;
    }

    /**
     * Get noteBy
     *
     * @return Ecs\AgentManagerBundle\Entity\User 
     */
    public function getNoteBy()
    {
        return $this->noteBy;
    }
    /**
     * @var datetime $in1
     */
    private $in1;

    /**
     * @var datetime $out1
     */
    private $out1;

    /**
     * @var datetime $in2
     */
    private $in2;

    /**
     * @var datetime $out2
     */
    private $out2;

    /**
     * @var datetime $in3
     */
    private $in3;

    /**
     * @var datetime $out3
     */
    private $out3;

    /**
     * @var varchar $totaltime
     */
    private $totaltime;

    /**
     * @var datetime $daydate
     */
    private $daydate;


    /**
     * Set in1
     *
     * @param datetime $in1
     * @return TimeClock
     */
    public function setIn1($in1)
    {
        $this->in1 = $in1;
        return $this;
    }

    /**
     * Get in1
     *
     * @return datetime 
     */
    public function getIn1()
    {
        return $this->in1;
    }

    /**
     * Set out1
     *
     * @param datetime $out1
     * @return TimeClock
     */
    public function setOut1($out1)
    {
        $this->out1 = $out1;
        return $this;
    }

    /**
     * Get out1
     *
     * @return datetime 
     */
    public function getOut1()
    {
        return $this->out1;
    }

    /**
     * Set in2
     *
     * @param datetime $in2
     * @return TimeClock
     */
    public function setIn2($in2)
    {
        $this->in2 = $in2;
        return $this;
    }

    /**
     * Get in2
     *
     * @return datetime 
     */
    public function getIn2()
    {
        return $this->in2;
    }

    /**
     * Set out2
     *
     * @param datetime $out2
     * @return TimeClock
     */
    public function setOut2($out2)
    {
        $this->out2 = $out2;
        return $this;
    }

    /**
     * Get out2
     *
     * @return datetime 
     */
    public function getOut2()
    {
        return $this->out2;
    }

    /**
     * Set in3
     *
     * @param datetime $in3
     * @return TimeClock
     */
    public function setIn3($in3)
    {
        $this->in3 = $in3;
        return $this;
    }

    /**
     * Get in3
     *
     * @return datetime 
     */
    public function getIn3()
    {
        return $this->in3;
    }

    /**
     * Set out3
     *
     * @param datetime $out3
     * @return TimeClock
     */
    public function setOut3($out3)
    {
        $this->out3 = $out3;
        return $this;
    }

    /**
     * Get out3
     *
     * @return datetime 
     */
    public function getOut3()
    {
        return $this->out3;
    }

    /**
     * Set totaltime
     *
     * @param varchar $totaltime
     * @return TimeClock
     */
    public function setTotaltime(\varchar $totaltime)
    {
        $this->totaltime = $totaltime;
        return $this;
    }

    /**
     * Get totaltime
     *
     * @return varchar 
     */
    public function getTotaltime()
    {
        return $this->totaltime;
    }

    /**
     * Set daydate
     *
     * @param datetime $daydate
     * @return TimeClock
     */
    public function setDaydate($daydate)
    {
        $this->daydate = $daydate;
        return $this;
    }

    /**
     * Get daydate
     *
     * @return datetime 
     */
    public function getDaydate()
    {
        return $this->daydate;
    }
}

Затем, когда я это сделал, я подумал о доктрине: сгенерировать: сущности (я мог ошибаться — я забыл, что я сделал для ее создания).

Он генерирует timeclock.orm.yml и создает таблицу в базе данных или что-то в этом роде..

timeclock.orm.yml имеет следующее:

Ecs\CrmBundle\Entity\TimeClock:
    type: entity
    table: null
    fields:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
        in1:
            type: datetime
        out1:
            type: datetime
        in2:
            type: datetime
        out2:
            type: datetime
        in3:
            type: datetime
        out3:
            type: datetime
        totaltime:
            type: string
        daydate:
            type: datetime
    manyToOne:
        noteBy:
            targetEntity:  Ecs\AgentManagerBundle\Entity\User
    lifecycleCallbacks: {  }

Проблема в том, totaltime, и все поля inи outдолжны иметь значение по умолчанию NULL, и я не могу найти, как это сделать. Я искал последние 30 минут. пытаясь понять это, прежде чем я пришел сюда..

Затем, как только я отредактирую любой файл(ы) в а как сделать, чтобы он обновлял и в базе данных?

41
задан Johnny 3 April 2012 в 00:15
поделиться