laravel-doctrine / fluent

Fluent mapping driver for Doctrine2
http://www.laraveldoctrine.org/docs/current/fluent
MIT License
43 stars 22 forks source link

Fluent builder method [timestamps] does not exist #81

Open AtteR opened 1 month ago

AtteR commented 1 month ago

Hello,

I have problem that extensions are not working with Fluent, in this case timestamps:

<?php

namespace App\Mappings;

use App\Models\User;
use LaravelDoctrine\Fluent\EntityMapping;
use LaravelDoctrine\Fluent\Fluent;

class UserMapping extends EntityMapping
{

    public function mapFor(): string
    {
        return User::class;
    }

    public function map(Fluent $builder): void
    {
        $builder->increments('id');

        $builder->string('name');
        $builder->string('email')->unique();
        $builder->string('password');
        $builder->string('rememberToken')->length(100)->nullable();
        $builder->timestamp('emailVerifiedAt')->nullable();
        $builder->timestamps();
    }
}

I am using Laravel 11 with latest versions of Laravel Doctrine and extensions. I have enabled the extensions from doctrine.php config file.

I tried with both commands:

php artisan doctrine:migrations:diff php artisan doctrine:schema:update

And got this error:

   InvalidArgumentException 

  Fluent builder method [timestamps] does not exist

  at vendor/laravel-doctrine/fluent/src/Builders/Builder.php:176
    172▕         if ($this->hasMacro($method)) {
    173▕             return $this->queueMacro($method, $params);
    174▕         }
    175▕ 
  ➜ 176▕         throw new InvalidArgumentException('Fluent builder method ['.$method.'] does not exist');
    177▕     }
    178▕ 
    179▕     /**
    180▕      * {@inheritdoc}

  1   app/Mappings/UserMapping.php:26
      LaravelDoctrine\Fluent\Builders\Builder::__call()
      +15 vendor frames 

  17  artisan:13
      Illuminate\Foundation\Application::handleCommand()

Composer:

    "require": {
        "php": "^8.2",
        "beberlei/doctrineextensions": "^1.5",
        "gedmo/doctrine-extensions": "^3.0",
        "inertiajs/inertia-laravel": "^1.0",
        "laravel-doctrine/extensions": "^1.7",
        "laravel-doctrine/fluent": "^1.3",
        "laravel-doctrine/migrations": "^3.2",
        "laravel-doctrine/orm": "^2.1",
        "laravel/framework": "^11.9",
        "laravel/sanctum": "^4.0",
        "laravel/tinker": "^2.9",
        "spatie/laravel-data": "^4.9",
        "tightenco/ziggy": "^2.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.13",
        "fakerphp/faker": "^1.23",
        "laravel/breeze": "^2.1",
        "laravel/pint": "^1.13",
        "laravel/sail": "^1.26",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.0",
        "phpunit/phpunit": "^11.0.1"
    },

Thanks!