Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Ascendens
Copy link
Contributor

There are classes in Laravel which may be used as query builder and it's indicated via @mixin annotation, for example, relations. I guess, it is useful to consider this moment.

@crissi
Copy link

crissi commented Feb 18, 2018

This needs to be added to the FacadeMethodExtension too since right now it is failing on DB::table('some_table'). The table method is located in Illuminate\Database\Connection and not the root facade Illuminate\Database\DatabaseManager, but the DatabaseManager do have a @mixin for the connection class

@twistor
Copy link
Contributor

twistor commented Mar 21, 2018

Thanks for the PR! And the tests!

Could we break this up into a collaborator, or even a base class method is fine?

if (!isset($this->methods[$classReflection->getName()]) && (
$classReflection->isSubclassOf(Model::class)
|| preg_match(
'/@mixin\s+' . preg_quote('\\' . Builder::class) . '/',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the leading slash optional?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twistor That / is the pattern delimiter!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the \\ for the namepsace.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the backslashes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twistor sorry for delay, but I have a lot of work now, but promise to you to resolve issue in next few days

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twistor I've moved mixin detection to a separate class and it will return class names without the leading slash, but if you'll try to use such form, for example, in IDE it will show incorrect namespace error (checked in PHPStorm). Of course, in IDE can be used even short class names, because it can parse use section, but in this case it is imposible to detect class namespace from doc block only.

@twistor
Copy link
Contributor

twistor commented Apr 13, 2018

Looks awesome, thanks!

@twistor twistor merged commit 5b89457 into Weebly:master Apr 13, 2018
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

Successfully merging this pull request may close these issues.

4 participants