eloquence-mappable
eloquence-mappable copied to clipboard
Problems with columns mapping
Hi,
I have issuing some problems with column mapping.
Example with dynamic where:
Foo::whereId(1);
Example with where:
Foo::where([ ['foo', '=', 'bar'] ])->first();
the mapping is not working. The query is generated with old column name.
Model:
`class Foo extends Model { use Eloquence, Mappable;
protected $maps = [
// ....
];
}`
@jarektkaczyk any news?
@pvm - Jarek's Eloquence repos aren't heavily-maintained. However, in my view these vanity functions aren't tremendously important.
I.e: MyModel::whereTheValue(100)
vs. MyModel::where('the_value', 100)
, where the latter works and is equally readable; you could argue it is more so than the former.
@pvm do I get it right that dynamic wheres don't work for you? Or both examples you provided?
If the first is true, then I just strongly suggest not using dynamic wheres - they are very bad concept and lead to issues.
@jsdtaylor thanks for chiming in. True, I don't have much time for maintenance, and will be more than happy to share this responsibility with others :)
Just saying that dynamic where does not work, but where with multiple options too (this we use a lot):
Foo::where([ ['foo', '=', 'bar'], ['baz', '>=', 2]])->first();
@jarektkaczyk any news about it? If you don't have time, I'll try to help and send you a PR.
@pvm would be lovely :+1:
only select support? when I use get($columns) or first($columns), the mapping is not working