daycry/doctrine

AUTO_INCREMENT error on MariaDB

Closed this issue · 1 comments

Operation 'Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSequenceNextValSQL' is not supported by platform.

Entity:

class AppUser
{
  /**
   * @Column(type="bigint", name="id")
   * @GeneratedValue(strategy="IDENTITY")
   * @Id()
   */
  private $id;

Controller:

    $user = new AppUser();
    $user->setUsername($requestData->username);
    $user->setPassword($requestData->password);
    $doctrine->em->persist($user);
    $doctrine->em->flush();

The error is generated by doctrine.
This library simply helps to connect codeigniter 4 with doctrine, but I use Maria DB and MySQL and I don't have that problem.

Try this:

<?php

namespace App\Models\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * ClassName
 *
 * @ORM\Table(name="table_name", indexes={@ORM\Index(name="deleted_at", columns={"deleted_at"}), @ORM\Index(name="uid", columns={"uid"})})
 * @ORM\Entity
 */
class ClassName
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;