laravel-doctrine / extensions

Extensions integration for Doctrine2 and Laravel

Home Page:http://laraveldoctrine.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Doctrine extensions not working with ORM 1.0.*

erussell9987 opened this issue · comments

All my annotations worked when my Laravel Doctrine ORM was on dev-master. Since changing to 1.0.* my Laravel Doctrine extensions have stop working. I have removed the libraries and re-download them and still have the same error. I don't know what i'm missing but I have lost two days to this, any help would be greatly appreciated.

Composer.json

"laravel-doctrine/orm": "1.0.*",
"laravel-doctrine/extensions": "1.0.*",
"gedmo/doctrine-extensions": "^2.4",
"beberlei/DoctrineExtensions": "^1.0"

app.php
in providers array

      /*
         * 3rd Party Service Providers...
         */

        LaravelDoctrine\ORM\DoctrineServiceProvider::class,
        LaravelDoctrine\Extensions\GedmoExtensionsServiceProvider::class,
        LaravelDoctrine\Extensions\BeberleiExtensionsServiceProvider::class,

one of my classes

<?php

namespace RoninManga;

use Doctrine\ORM\Mapping as ORM;
use Carbon\Carbon;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable;

/**
 * @ORM\Entity
 * @ORM\Table(name="publisher_list")
 * @Gedmo\SoftDeleteable(fieldName="deletedAt",timeAware=false)
 */
class PublisherList {

    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="bigint")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="Publisher",inversedBy="series")
     * @var Publisher
     */
    private $publisher;

    /**
     * @ORM\ManyToOne(targetEntity="Series",inversedBy="publishers")
     * @var Series
     */
    private $series;

    /**
     * @ORM\Column(type="carbondatetime",nullable=true)
     */
    private $deletedAt;

    /**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="carbondatetime")
     */
    private $dateCreated;

    /**
     * @Gedmo\Timestampable(on="update",field={"deletedAt"})
     * @ORM\Column(type="carbondatetime", nullable=true)
     */
    private $dateUpdated;

    /**
     * PublisherList constructor.
     */
    public function __construct() { }

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

    /**
     * @param mixed $id
     *
     * @return PublisherList
     */
    public function setId( $id ) {
        $this->id = $id;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getPublisher() {
        return $this->publisher;
    }

    /**
     * @param mixed $publisher
     *
     * @return PublisherList
     */
    public function setPublisher( $publisher ) {
        $this->publisher = $publisher;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getSeries() {
        return $this->series;
    }

    /**
     * @param mixed $series
     *
     * @return PublisherList
     */
    public function setSeries( $series ) {
        $this->series = $series;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getDeletedAt() {
        return $this->deletedAt;
    }

    /**
     * @param mixed $deletedAt
     *
     * @return PublisherList
     */
    public function setDeletedAt( $deletedAt ) {
        $this->deletedAt = $deletedAt;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getDateCreated() {
        return $this->dateCreated;
    }

    /**
     * @param mixed $dateCreated
     *
     * @return PublisherList
     */
    public function setDateCreated( $dateCreated ) {
        $this->dateCreated = $dateCreated;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getDateUpdated() {
        return $this->dateUpdated;
    }

    /**
     * @param mixed $dateUpdated
     *
     * @return PublisherList
     */
    public function setDateUpdated( $dateUpdated ) {
        $this->dateUpdated = $dateUpdated;

        return $this;
    }


}

the error I get:


  [Doctrine\DBAL\Exception\NotNullConstraintViolationException]                                                                                                                                      
  An exception occurred while executing 'INSERT INTO publisher_list (deleted_at, date_created, date_updated, publisher_id, series_id) VALUES (?, ?, ?, ?, ?)' with params [null, null, null, 1, 1]:  
  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date_created' cannot be null                                                                                                         






  [Doctrine\DBAL\Driver\PDOException]                                                         
  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date_created' cannot be null  






  [PDOException]                                                                              
  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date_created' cannot be null  
                   ```                                                                           

Should work with 1.0.9 now