Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent builder method [timestamps] does not exist #81

Open
AtteR opened this issue Sep 16, 2024 · 0 comments
Open

Fluent builder method [timestamps] does not exist #81

AtteR opened this issue Sep 16, 2024 · 0 comments

Comments

@AtteR
Copy link

AtteR commented Sep 16, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant