laravel-query-intellij icon indicating copy to clipboard operation
laravel-query-intellij copied to clipboard

Plugin not working correctly with aliases (select, join, orderBy)

Open CristianSitov opened this issue 3 years ago • 5 comments

If having a model Profile like:

<?php

namespace App\Models;

use App\Model;
use Eloquent;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @package App\Models
 * @mixin Eloquent
 */
class City extends Model
{
    public function state(): BelongsTo
    {
        return $this->belongsTo(State::class);
    }
}

Then highlighting would look like the screenshot below:

CleanShot 2022-02-22 at 13 22 38@2x

CristianSitov avatar Feb 22 '22 11:02 CristianSitov

Thank you, will try to reproduce 🙂

ekvedaras avatar Feb 22 '22 13:02 ekvedaras

Ok I think the issue is with AS instead of as. Not sure how I missed that case 😀 Will add support for AS 🙂

ekvedaras avatar Feb 22 '22 13:02 ekvedaras

Fixed autocomplete, but something is still off with inspection. Will take a look again 🙂

ekvedaras avatar Mar 01 '22 10:03 ekvedaras

Fixed in v3.0.3

ekvedaras avatar Mar 13 '22 11:03 ekvedaras

I still have the problem when using a raw DB statement. See the example code below where the column "date" is not found as the parameter of orderBy.

Example code:

City::query()
->select([DB::raw('DISTINCT(DATE(IFNULL(cities.start, cities.end))) as date')])
->orderBy('date');

Should I make a new issue for this? Thank you very much for your time and your plugin.

RobinBastiaan avatar Oct 05 '23 14:10 RobinBastiaan