Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with columns mapping #2

Open
pvm opened this issue Jun 14, 2018 · 7 comments
Open

Problems with columns mapping #2

pvm opened this issue Jun 14, 2018 · 7 comments

Comments

@pvm
Copy link

pvm commented Jun 14, 2018

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 = [
    // ....
];

}`

@pvm
Copy link
Author

pvm commented Jun 20, 2018

@jarektkaczyk any news?

@jsdtaylor
Copy link

jsdtaylor commented Jun 22, 2018

@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.

@jarektkaczyk
Copy link
Owner

@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 :)

@pvm
Copy link
Author

pvm commented Jun 23, 2018

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();

@pvm
Copy link
Author

pvm commented Jul 10, 2018

@jarektkaczyk any news about it? If you don't have time, I'll try to help and send you a PR.

@jarektkaczyk
Copy link
Owner

@pvm would be lovely 👍

@1x481n
Copy link

1x481n commented Aug 6, 2018

only select support? when I use get($columns) or first($columns), the mapping is not working

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

No branches or pull requests

4 participants