B
B
bigazzzz2011-07-21 05:55:17
PHP
bigazzzz, 2011-07-21 05:55:17

AR library for PHP?

Decided to use ActiveRecord on one of my sites. Please share your experience towards the lowest threshold of entry and thoughts - is AR worth it to implement it?
p.s. Google shared two libraries with me github.com/kla/php-activerecord and www.phpactiverecord.org/

Answer the question

In order to leave comments, you need to log in

5 answer(s)
Z
zizop, 2011-07-21
@zizop

AR has a number of advantages:
- a single point of access to the database (request object), which means that you can easily add things such as: logging, caching, access control, etc.
- no need to write SQL queries yourself -> fewer errors as a result of automation.
For starters, I would take Zend_Db if I were you . Although many people say that this is not pure AR, but rather a Table Data Gateway, but in your case it does not matter.
We ourselves use Doctrine ORM + our own set of extensions for it, and are very satisfied.

G
Gibbzy, 2011-07-21
@gibbzy

You can pull it out of any framework, for example, from ZF or yii
There is also Doctrire.

E
Elkaz, 2011-07-21
@Elkaz

Everything is individual.
AR reduces the speed of application development, but (slightly) increases the speed of its operation. In some applications, the gain can be quite significant, in others it can be almost imperceptible, or even get a negative value. It all depends on your project and on your ability to build the right application architecture.
Ps
Used only Doctrine.

A
Arsen, 2011-07-21
@mekegi

It's worth it
Pluses:
Clean concise code in models. Visibility - it is immediately clear which fields, who refers to whom, and so on.
Newcomers will quickly "enter the code" written using AR. Low cost of making changes to the database structure.
Cons:
Overhead when using AR eats up time and RAM.
Conclusion:
there are many more advantages. Well, about the cons - they can be minimized by rewriting critical sections (of which there will not be very many)
If you are writing a system with a long life cycle, then you definitely need to use AR

A
Anatoly, 2011-07-21
@taliban

ActiveRecord is a very simple pattern, by going to the wiki you can implement it yourself in half an hour, as a result, get rid of tons of extra (not always necessary code) and make it the way you need it.
You can view this file in the print (save, insert, update, delete methods) and see the find method here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question