silverleague / silverstripe-ideannotator

Generate docblocks for DataObjects, Page, PageControllers and (Data)Extensions
BSD 3-Clause "New" or "Revised" License
46 stars 25 forks source link

has_many, many_many etc should import the namespace for HasManyList etc #120

Closed robbieaverill closed 1 year ago

robbieaverill commented 5 years ago

Example model:

namespace Foo;
class Foo extends \SilverStripe\ORM\DataObject
{
    private static $has_many = [
        'Bars' => Bar::class,
    ];
}

namespace Bar;
class Bar extends \SilverStripe\ORM\DataObject {}

When running dev/build you'll get this in the Foo docblock:

* @method DataList|Bar[] Bars()

It's missing use SilverStripe\ORM\DataList; imported - this is a bug

Firesphere commented 5 years ago

Isn't this pretty much what is covered in #114 ?

I like the use statement addition though, but I'm not sure how to parse that, would probably end up using regex to check if it's already there...

Firesphere commented 5 years ago

This is only a valid issue if the shortname feature is enabled.

I agree though, it's pretty annoying

Firesphere commented 1 year ago

Closing this for now, changing use statements feels like touching active code, which I'd rather avoid.

Feel free to open again if you disagree.