laravel-doctrine / fluent

Fluent mapping driver for Doctrine2

Home Page:http://www.laraveldoctrine.org/docs/current/fluent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$builder->string('name')->index(); returns an error

glennjacobs opened this issue · comments

I set up a simple mapping and when I added an index using the example below I get...

[BadMethodCallException]                     
FieldBuilder method [index] does not exist.

Example

public function map(Fluent $builder)
{
    $builder->increments('id');
    $builder->string('name');
    $builder->string('type')->index();
    $builder->timestamps();
}

However, this works

public function map(Fluent $builder)
{
    $builder->increments('id');
    $builder->string('name');
    $builder->string('type');
    $builder->timestamps();

    $builder->index('type');
}

That is true, indeed. Seems we had that planned and documented, but never got to implement it.

Being a shortcut, I won't make it a top priority. But if you can spare some time on an implementation, a PR would be more than welcomed!

That'll explain it then :)

I'll try...

Feature is added in latest release