Using * in query instead of selecting all columns

I have some code like this:
User::findFirst(12345);
But the query includes all columns name in select part, and now I want to be able select with star
Current query will be: SELECT User.ID, User.Name, User.LName, ... FROM User WHERE User.ID = 12345
But what I want is: SELECT * FROM User WHERE User.ID = 12345
I want to override findFirst method, please give me some code to do that inside my BaseModel. :)
Thanks in advanced

But what's the difference? Phalcon will use metadata to always select columns like this, if you add new column just clean metadata.

Selecting with * is also a bad practice.

When you specify column names explicitly, you can gain performance from overindexing.



78.6k

i assume this will do the trick, but as others pointed, it doesn't make any sense


User::findFirst([
    "conditions" => " id = ?0 ",
    "bind" => [0 => 12345],
    "columns" => "*"
]);

I just want to decrease outgoing network traffic from application.

But what's the difference? Phalcon will use metadata to always select columns like this, if you add new column just clean metadata.

How this is gonna reduce outgoing network traffic?

select a.b a.c a.d a.e is longer then select *

How this is gonna reduce outgoing network traffic?

IF that query is set up to be cached, you end up worse :P but only if it's cached...

select a.b a.c a.d a.e is longer then select *

How this is gonna reduce outgoing network traffic?