A
A
Alexander2016-08-01 00:48:35
PHP
Alexander, 2016-08-01 00:48:35

What is the justification for using QueryBuilder and ActiveRecord in the same project?

What is the justification for using QueryBuilder and ActiveRecord in the same project?
I'm very interested in how to justify the use of these two approaches to working with the database in one project ... And is it reasonable to use one QueriBuilder in this case and abandon ActiveRecords, in particular when using queries with JOIN, UNION

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Aksentiev, 2016-08-01
@websiteserf

AR generally uses its own QueryBuilder.
And in total it is called ORM
. Also, QueryBuilder can be called "directly". he is public.
So they are not interchangeable things at all.
Another question is if two different unrelated libraries are used, this is already something terrible. I have not seen this.
Well, something tells me not to.

T
trevoga_su, 2016-08-01
@trevoga_su

BEFORE ASKING THIS, YOU SHOULD understand what QueryBuilder is and what ActiveRecord
is QueryBuilder is a SQL query constructor
ActiveRecord is an ORM
these two technologies are in fact, theoretically NOT related to each other, but ORM most likely uses QB

And is it reasonable to use one QueriBuilder in this case and abandon ActiveRecords, in particular when using queries with JOIN, UNION
Yes. This is normal practice. No need to use ORM to try to make big requests. ORM is for trivial things.

F
Fortop, 2016-08-01
@Fortop

Depends on the size of the project.
For prototyping, AR is better.
For large development, you will need a query builder.
Accordingly, you can use the first and rewrite to the second as you grow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question