Quantcast

ActiveRecord proposal

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ActiveRecord proposal

Artur Bodera
Hey ZF hackers!

Most of PHP developers using frameworks have this moment, when it hits them:
- I have gazillion of my own, custom classes that I reuse in every project.
Why isn't this X Y Z functionality already in the framework?

So now it hit me (again), so I (finally) sent that CLA and started giving
some lovin to a project, that I've been feeding from for the last 4 years or
so.
As I'm not anonymous anymore, I'm sending my first proposal, based on my
10-year experience with ActiveRecord pattern.

I've been tracking Zend\Db\* for some time now and I could not understand
why it wasn't implemented. It's an extremely simple pattern to work with, a
bit more tricky to implement, but that's what frameworks are for, right?

On the other hand ActiveRecord is an elementary topic for every beginner PHP
programmer that learns LAMP and creates his/her first class. Yet, the most
popular and hyped framework (ekhm.. ZF) did not have anything that would
resemble that.  Also agile programming (think 2011), in general, is all
about efficiency and time-to-market, so AR is a great alternative to a
full-blown ORM in terms of development and maintenance time.


Because AR is so simple, it is a blast to use.
Because it's an universal component, I will optimize it "to the bone" to
make it feasible for high-load and large data applications.


For all hard-core devs out there, and "pattern cops": I swear I will never
ever tell anyone that AR is the same as a model ;-) I will also never try to
replace or sabotage Doctrine or Proper integration efforts. What I've
created is an "implementation of pareto" for database access. Observing my
own development efforts: when my OO app have a robust AR, I rarely need
anything else for DB access.


Here is the proposal:
http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera

ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).


Here is my branch with working implementation:
https://github.com/Thinkscape/zf2/branches/ActiveRecord

Unit tests: require a working db connection, so configure it in
TestConfiguration.php. Then run:
# phpunit tests/Zend/Db/ActiveRecord


This is the first version. As I'm writing these classes from scratch (using
and refactoring my custom classes), not everything is implemented yet and
expect some bugs.



Have a nice day!


Arthur


--

      __
     /.)\   +48 695 600 936
     \(./   [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Nicolas A. Bérard-Nault
On Tue, Jul 19, 2011 at 9:35 AM, Artur Bodera <[hidden email]> wrote:

> Hey ZF hackers!
>
> Most of PHP developers using frameworks have this moment, when it hits
> them:
> - I have gazillion of my own, custom classes that I reuse in every project.
> Why isn't this X Y Z functionality already in the framework?
>

I'm sorry but I must ask, why not write an integration layer with any of the
already existing and mature AR implementations instead of re-inventing the
wheel ?


>
> So now it hit me (again), so I (finally) sent that CLA and started giving
> some lovin to a project, that I've been feeding from for the last 4 years
> or
> so.
> As I'm not anonymous anymore, I'm sending my first proposal, based on my
> 10-year experience with ActiveRecord pattern.
>
> I've been tracking Zend\Db\* for some time now and I could not understand
> why it wasn't implemented. It's an extremely simple pattern to work with, a
> bit more tricky to implement, but that's what frameworks are for, right?
>
> On the other hand ActiveRecord is an elementary topic for every beginner
> PHP
> programmer that learns LAMP and creates his/her first class. Yet, the most
> popular and hyped framework (ekhm.. ZF) did not have anything that would
> resemble that.  Also agile programming (think 2011), in general, is all
> about efficiency and time-to-market, so AR is a great alternative to a
> full-blown ORM in terms of development and maintenance time.
>
>
> Because AR is so simple, it is a blast to use.
> Because it's an universal component, I will optimize it "to the bone" to
> make it feasible for high-load and large data applications.
>
>
> For all hard-core devs out there, and "pattern cops": I swear I will never
> ever tell anyone that AR is the same as a model ;-) I will also never try
> to
> replace or sabotage Doctrine or Proper integration efforts. What I've
> created is an "implementation of pareto" for database access. Observing my
> own development efforts: when my OO app have a robust AR, I rarely need
> anything else for DB access.
>
>
> Here is the proposal:
> http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera
>
> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
>
>
> Here is my branch with working implementation:
> https://github.com/Thinkscape/zf2/branches/ActiveRecord
>
> Unit tests: require a working db connection, so configure it in
> TestConfiguration.php. Then run:
> # phpunit tests/Zend/Db/ActiveRecord
>
>
> This is the first version. As I'm writing these classes from scratch (using
> and refactoring my custom classes), not everything is implemented yet and
> expect some bugs.
>
>
>
> Have a nice day!
>
>
> Arthur
>
>
> --
>
>      __
>     /.)\   +48 695 600 936
>     \(./   [hidden email]
>



--
Nicolas A. Bérard-Nault ([hidden email])
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Artur Bodera
There are a few ORM which can be auto-loaded and used together with ZF
(think Doctrine)

There are other frameworks, which have ActiveRecord implementations you can
auto-load and use them together with ZF.

There is phpactiverecord.org which can be bootstrapped, given a (second) DB
connection and it will work too.

None of the above are built on top of ZF and integrate with it they way they
should.

1. My component uses Zend\Db for connecting, querying and escaping
(securing) data. This means you can use your existing Zend\Db adapter (i.e.
connection) seamlessly with AR.
2. My component will use Zend\Filter and Zend\Validate for validation - this
means you can re-use what is already a neat filtering feature-set built into
ZF.
3. My component uses Zend\Db\Select, so you can use familiar methods (i.e.
->order()->join()->where() ) to fine-tune the behavior of AR or perform
complex queries.
4. and a few more integration points...  modules,
scaffolding/code-generation, DI, ACL etc.



Because it's a very simple db-oriented pattern I don't see it as
"reinventing the wheel". It's more of an implementation using existing ZF
features.
Otherwise, what's the point of having Zend\Db\Table when you have (mature)
Doctrine/Propel frameworks?


A.

--

      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


2011/7/19 Nicolas A. Bérard-Nault <[hidden email]>

>
> On Tue, Jul 19, 2011 at 9:35 AM, Artur Bodera <[hidden email]> wrote:
>
>> Hey ZF hackers!
>>
>> Most of PHP developers using frameworks have this moment, when it hits
>> them:
>> - I have gazillion of my own, custom classes that I reuse in every
>> project.
>> Why isn't this X Y Z functionality already in the framework?
>>
>
> I'm sorry but I must ask, why not write an integration layer with any of
> the already existing and mature AR implementations instead of re-inventing
> the wheel ?
>
>
>>
>> So now it hit me (again), so I (finally) sent that CLA and started giving
>> some lovin to a project, that I've been feeding from for the last 4 years
>> or
>> so.
>> As I'm not anonymous anymore, I'm sending my first proposal, based on my
>> 10-year experience with ActiveRecord pattern.
>>
>> I've been tracking Zend\Db\* for some time now and I could not understand
>> why it wasn't implemented. It's an extremely simple pattern to work with,
>> a
>> bit more tricky to implement, but that's what frameworks are for, right?
>>
>> On the other hand ActiveRecord is an elementary topic for every beginner
>> PHP
>> programmer that learns LAMP and creates his/her first class. Yet, the most
>> popular and hyped framework (ekhm.. ZF) did not have anything that would
>> resemble that.  Also agile programming (think 2011), in general, is all
>> about efficiency and time-to-market, so AR is a great alternative to a
>> full-blown ORM in terms of development and maintenance time.
>>
>>
>> Because AR is so simple, it is a blast to use.
>> Because it's an universal component, I will optimize it "to the bone" to
>> make it feasible for high-load and large data applications.
>>
>>
>> For all hard-core devs out there, and "pattern cops": I swear I will never
>> ever tell anyone that AR is the same as a model ;-) I will also never try
>> to
>> replace or sabotage Doctrine or Proper integration efforts. What I've
>> created is an "implementation of pareto" for database access. Observing my
>> own development efforts: when my OO app have a robust AR, I rarely need
>> anything else for DB access.
>>
>>
>> Here is the proposal:
>> http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera
>>
>> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
>>
>>
>> Here is my branch with working implementation:
>> https://github.com/Thinkscape/zf2/branches/ActiveRecord
>>
>> Unit tests: require a working db connection, so configure it in
>> TestConfiguration.php. Then run:
>> # phpunit tests/Zend/Db/ActiveRecord
>>
>>
>> This is the first version. As I'm writing these classes from scratch
>> (using
>> and refactoring my custom classes), not everything is implemented yet and
>> expect some bugs.
>>
>>
>>
>> Have a nice day!
>>
>>
>> Arthur
>>
>>
>> --
>>
>>      __
>>     /.)\   +48 695 600 936
>>     \(./   [hidden email]
>>
>
>
>
> --
> Nicolas A. Bérard-Nault ([hidden email])
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Pieter Kokx
Hi Artur,

Instead of ActiveRecord<http://martinfowler.com/eaaCatalog/activeRecord.html>,
we implemented the Table Data
Gateway<http://martinfowler.com/eaaCatalog/tableDataGateway.html>and
Row
Data Gateway <http://martinfowler.com/eaaCatalog/rowDataGateway.html>patterns
into ZF (Zend_Db_Table). Both options offer similiar value to how
we use a database.

Though this might give some confusion to people who are used to using
ActiveRecord, I think it is a lot better to do it this way. Because in my
eyes it helps a lot to prevent people from steering blindly into
interpreting MVC as "ActiveRecord-View-Controller".

Best Regards,

Pieter Kokx
Zend Framework contributor
Computer Science Undergraduate



2011/7/19 Artur Bodera <[hidden email]>

> There are a few ORM which can be auto-loaded and used together with ZF
> (think Doctrine)
>
> There are other frameworks, which have ActiveRecord implementations you can
> auto-load and use them together with ZF.
>
> There is phpactiverecord.org which can be bootstrapped, given a (second)
> DB
> connection and it will work too.
>
> None of the above are built on top of ZF and integrate with it they way
> they
> should.
>
> 1. My component uses Zend\Db for connecting, querying and escaping
> (securing) data. This means you can use your existing Zend\Db adapter (i.e.
> connection) seamlessly with AR.
> 2. My component will use Zend\Filter and Zend\Validate for validation -
> this
> means you can re-use what is already a neat filtering feature-set built
> into
> ZF.
> 3. My component uses Zend\Db\Select, so you can use familiar methods (i.e.
> ->order()->join()->where() ) to fine-tune the behavior of AR or perform
> complex queries.
> 4. and a few more integration points...  modules,
> scaffolding/code-generation, DI, ACL etc.
>
>
>
> Because it's a very simple db-oriented pattern I don't see it as
> "reinventing the wheel". It's more of an implementation using existing ZF
> features.
> Otherwise, what's the point of having Zend\Db\Table when you have (mature)
> Doctrine/Propel frameworks?
>
>
> A.
>
> --
>
>      __
>     /.)\   +48 695 600 936
>     \(./   [hidden email]
>
>
> 2011/7/19 Nicolas A. Bérard-Nault <[hidden email]>
>
> >
> > On Tue, Jul 19, 2011 at 9:35 AM, Artur Bodera <[hidden email]> wrote:
> >
> >> Hey ZF hackers!
> >>
> >> Most of PHP developers using frameworks have this moment, when it hits
> >> them:
> >> - I have gazillion of my own, custom classes that I reuse in every
> >> project.
> >> Why isn't this X Y Z functionality already in the framework?
> >>
> >
> > I'm sorry but I must ask, why not write an integration layer with any of
> > the already existing and mature AR implementations instead of
> re-inventing
> > the wheel ?
> >
> >
> >>
> >> So now it hit me (again), so I (finally) sent that CLA and started
> giving
> >> some lovin to a project, that I've been feeding from for the last 4
> years
> >> or
> >> so.
> >> As I'm not anonymous anymore, I'm sending my first proposal, based on my
> >> 10-year experience with ActiveRecord pattern.
> >>
> >> I've been tracking Zend\Db\* for some time now and I could not
> understand
> >> why it wasn't implemented. It's an extremely simple pattern to work
> with,
> >> a
> >> bit more tricky to implement, but that's what frameworks are for, right?
> >>
> >> On the other hand ActiveRecord is an elementary topic for every beginner
> >> PHP
> >> programmer that learns LAMP and creates his/her first class. Yet, the
> most
> >> popular and hyped framework (ekhm.. ZF) did not have anything that would
> >> resemble that.  Also agile programming (think 2011), in general, is all
> >> about efficiency and time-to-market, so AR is a great alternative to a
> >> full-blown ORM in terms of development and maintenance time.
> >>
> >>
> >> Because AR is so simple, it is a blast to use.
> >> Because it's an universal component, I will optimize it "to the bone" to
> >> make it feasible for high-load and large data applications.
> >>
> >>
> >> For all hard-core devs out there, and "pattern cops": I swear I will
> never
> >> ever tell anyone that AR is the same as a model ;-) I will also never
> try
> >> to
> >> replace or sabotage Doctrine or Proper integration efforts. What I've
> >> created is an "implementation of pareto" for database access. Observing
> my
> >> own development efforts: when my OO app have a robust AR, I rarely need
> >> anything else for DB access.
> >>
> >>
> >> Here is the proposal:
> >>
> http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera
> >>
> >> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
> >>
> >>
> >> Here is my branch with working implementation:
> >> https://github.com/Thinkscape/zf2/branches/ActiveRecord
> >>
> >> Unit tests: require a working db connection, so configure it in
> >> TestConfiguration.php. Then run:
> >> # phpunit tests/Zend/Db/ActiveRecord
> >>
> >>
> >> This is the first version. As I'm writing these classes from scratch
> >> (using
> >> and refactoring my custom classes), not everything is implemented yet
> and
> >> expect some bugs.
> >>
> >>
> >>
> >> Have a nice day!
> >>
> >>
> >> Arthur
> >>
> >>
> >> --
> >>
> >>      __
> >>     /.)\   +48 695 600 936
> >>     \(./   [hidden email]
> >>
> >
> >
> >
> > --
> > Nicolas A. Bérard-Nault ([hidden email])
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Artur Bodera
On Tue, Jul 19, 2011 at 6:28 PM, Pieter Kokx <[hidden email]> wrote:

> Though this might give some confusion to people who are used to using
> ActiveRecord, I think it is a lot better to do it this way. Because in my
> eyes it helps a lot to prevent people from steering blindly into
> interpreting MVC as "ActiveRecord-View-Controller".
>
>>
Good point, but it is about education not functionality.
No pattern is universally better than any other and it's up to the user to
pick the one, that fits best.

ActiveRecord is a very different pattern from TDG and RDG.

Framework's job is to give as many options as possible (think: ZF many
different db adapters, custom form decorators, custom Controller_Dispatcher
etc.).
It's up to the designer (architect) to design.
It's up for the developer to choose tools and implement the design.

AR is just a "tool", which has been missing from ZF.

Also - it does interfere with Db\Table in any way, so you can always use
that instead.
And if you're designing something bigger, I would always recommend using a
"real" ORM.


A.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Tomáš Fejfar
In reply to this post by Pieter Kokx
I have nothing to say against the fact, that AR pattern is wrong for many
reasons 1:1 mirroring between DB and Objects being the most obvious, BUT....

Sometimes you build a simple webpage, where all you need is simple tool that
will help you do that fast and easily. That's where AR shines. Who cares if
it's AR-V-C and not MVC if it works. When building opensource CMS for
masses, you think about extensibility and maintainability, but for simple
webpage CMS for your friend with few pages in few categories and a contact
form, you cant beat the AR. You won't extend it in the future with eshop,
discussion board and stuff. You just need to have it by tomorrow ;)

I'm happy there is a chance to use AR with ZF's infrastructure (Zend_Db
especially). It wil help in many super-simple scenarios to get things done
fun&fast :)

Tomas Fejfar

On Tue, Jul 19, 2011 at 6:28 PM, Pieter Kokx <[hidden email]> wrote:

> Hi Artur,
>
> Instead of ActiveRecord<
> http://martinfowler.com/eaaCatalog/activeRecord.html>,
> we implemented the Table Data
> Gateway<http://martinfowler.com/eaaCatalog/tableDataGateway.html>and
> Row
> Data Gateway <http://martinfowler.com/eaaCatalog/rowDataGateway.html
> >patterns
> into ZF (Zend_Db_Table). Both options offer similiar value to how
> we use a database.
>
> Though this might give some confusion to people who are used to using
> ActiveRecord, I think it is a lot better to do it this way. Because in my
> eyes it helps a lot to prevent people from steering blindly into
> interpreting MVC as "ActiveRecord-View-Controller".
>
> Best Regards,
>
> Pieter Kokx
> Zend Framework contributor
> Computer Science Undergraduate
>
>
>
> 2011/7/19 Artur Bodera <[hidden email]>
>
> > There are a few ORM which can be auto-loaded and used together with ZF
> > (think Doctrine)
> >
> > There are other frameworks, which have ActiveRecord implementations you
> can
> > auto-load and use them together with ZF.
> >
> > There is phpactiverecord.org which can be bootstrapped, given a (second)
> > DB
> > connection and it will work too.
> >
> > None of the above are built on top of ZF and integrate with it they way
> > they
> > should.
> >
> > 1. My component uses Zend\Db for connecting, querying and escaping
> > (securing) data. This means you can use your existing Zend\Db adapter
> (i.e.
> > connection) seamlessly with AR.
> > 2. My component will use Zend\Filter and Zend\Validate for validation -
> > this
> > means you can re-use what is already a neat filtering feature-set built
> > into
> > ZF.
> > 3. My component uses Zend\Db\Select, so you can use familiar methods
> (i.e.
> > ->order()->join()->where() ) to fine-tune the behavior of AR or perform
> > complex queries.
> > 4. and a few more integration points...  modules,
> > scaffolding/code-generation, DI, ACL etc.
> >
> >
> >
> > Because it's a very simple db-oriented pattern I don't see it as
> > "reinventing the wheel". It's more of an implementation using existing ZF
> > features.
> > Otherwise, what's the point of having Zend\Db\Table when you have
> (mature)
> > Doctrine/Propel frameworks?
> >
> >
> > A.
> >
> > --
> >
> >      __
> >     /.)\   +48 695 600 936
> >     \(./   [hidden email]
> >
> >
> > 2011/7/19 Nicolas A. Bérard-Nault <[hidden email]>
> >
> > >
> > > On Tue, Jul 19, 2011 at 9:35 AM, Artur Bodera <[hidden email]>
> wrote:
> > >
> > >> Hey ZF hackers!
> > >>
> > >> Most of PHP developers using frameworks have this moment, when it hits
> > >> them:
> > >> - I have gazillion of my own, custom classes that I reuse in every
> > >> project.
> > >> Why isn't this X Y Z functionality already in the framework?
> > >>
> > >
> > > I'm sorry but I must ask, why not write an integration layer with any
> of
> > > the already existing and mature AR implementations instead of
> > re-inventing
> > > the wheel ?
> > >
> > >
> > >>
> > >> So now it hit me (again), so I (finally) sent that CLA and started
> > giving
> > >> some lovin to a project, that I've been feeding from for the last 4
> > years
> > >> or
> > >> so.
> > >> As I'm not anonymous anymore, I'm sending my first proposal, based on
> my
> > >> 10-year experience with ActiveRecord pattern.
> > >>
> > >> I've been tracking Zend\Db\* for some time now and I could not
> > understand
> > >> why it wasn't implemented. It's an extremely simple pattern to work
> > with,
> > >> a
> > >> bit more tricky to implement, but that's what frameworks are for,
> right?
> > >>
> > >> On the other hand ActiveRecord is an elementary topic for every
> beginner
> > >> PHP
> > >> programmer that learns LAMP and creates his/her first class. Yet, the
> > most
> > >> popular and hyped framework (ekhm.. ZF) did not have anything that
> would
> > >> resemble that.  Also agile programming (think 2011), in general, is
> all
> > >> about efficiency and time-to-market, so AR is a great alternative to a
> > >> full-blown ORM in terms of development and maintenance time.
> > >>
> > >>
> > >> Because AR is so simple, it is a blast to use.
> > >> Because it's an universal component, I will optimize it "to the bone"
> to
> > >> make it feasible for high-load and large data applications.
> > >>
> > >>
> > >> For all hard-core devs out there, and "pattern cops": I swear I will
> > never
> > >> ever tell anyone that AR is the same as a model ;-) I will also never
> > try
> > >> to
> > >> replace or sabotage Doctrine or Proper integration efforts. What I've
> > >> created is an "implementation of pareto" for database access.
> Observing
> > my
> > >> own development efforts: when my OO app have a robust AR, I rarely
> need
> > >> anything else for DB access.
> > >>
> > >>
> > >> Here is the proposal:
> > >>
> >
> http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera
> > >>
> > >> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
> > >>
> > >>
> > >> Here is my branch with working implementation:
> > >> https://github.com/Thinkscape/zf2/branches/ActiveRecord
> > >>
> > >> Unit tests: require a working db connection, so configure it in
> > >> TestConfiguration.php. Then run:
> > >> # phpunit tests/Zend/Db/ActiveRecord
> > >>
> > >>
> > >> This is the first version. As I'm writing these classes from scratch
> > >> (using
> > >> and refactoring my custom classes), not everything is implemented yet
> > and
> > >> expect some bugs.
> > >>
> > >>
> > >>
> > >> Have a nice day!
> > >>
> > >>
> > >> Arthur
> > >>
> > >>
> > >> --
> > >>
> > >>      __
> > >>     /.)\   +48 695 600 936
> > >>     \(./   [hidden email]
> > >>
> > >
> > >
> > >
> > > --
> > > Nicolas A. Bérard-Nault ([hidden email])
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Ralph Schindler-2
In reply to this post by Artur Bodera
Zend\Db is being refactored right now, and ActiveRecord was planned.

Check the requirements here:

http://framework.zend.com/wiki/display/ZFDEV2/Zend+Db+2.0+Requirements

And its progress in my feature branch here:

https://github.com/ralphschindler/zf2/tree/feature/db

Significant work is being done, particularly of interest in the metadata
and query builder components.  The adapter API is fairly complete
currently as it supports Mysql and SQL server and PDO.

Over the next month or so, watch this development.  The activerecord
implementation should work by utilizing the adapter, query builder and
metadata components - and, once formalized, the plugin api.

So, to reiterate, there is no objection on my end for having an
ActiveRecord implementation, it just needs to be built off of the newly
refactored Zend\Db :)

-ralph

On 7/19/11 8:35 AM, Artur Bodera wrote:

> Hey ZF hackers!
>
> Most of PHP developers using frameworks have this moment, when it hits them:
> - I have gazillion of my own, custom classes that I reuse in every project.
> Why isn't this X Y Z functionality already in the framework?
>
> So now it hit me (again), so I (finally) sent that CLA and started giving
> some lovin to a project, that I've been feeding from for the last 4 years or
> so.
> As I'm not anonymous anymore, I'm sending my first proposal, based on my
> 10-year experience with ActiveRecord pattern.
>
> I've been tracking Zend\Db\* for some time now and I could not understand
> why it wasn't implemented. It's an extremely simple pattern to work with, a
> bit more tricky to implement, but that's what frameworks are for, right?
>
> On the other hand ActiveRecord is an elementary topic for every beginner PHP
> programmer that learns LAMP and creates his/her first class. Yet, the most
> popular and hyped framework (ekhm.. ZF) did not have anything that would
> resemble that.  Also agile programming (think 2011), in general, is all
> about efficiency and time-to-market, so AR is a great alternative to a
> full-blown ORM in terms of development and maintenance time.
>
>
> Because AR is so simple, it is a blast to use.
> Because it's an universal component, I will optimize it "to the bone" to
> make it feasible for high-load and large data applications.
>
>
> For all hard-core devs out there, and "pattern cops": I swear I will never
> ever tell anyone that AR is the same as a model ;-) I will also never try to
> replace or sabotage Doctrine or Proper integration efforts. What I've
> created is an "implementation of pareto" for database access. Observing my
> own development efforts: when my OO app have a robust AR, I rarely need
> anything else for DB access.
>
>
> Here is the proposal:
> http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera
>
> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
>
>
> Here is my branch with working implementation:
> https://github.com/Thinkscape/zf2/branches/ActiveRecord
>
> Unit tests: require a working db connection, so configure it in
> TestConfiguration.php. Then run:
> # phpunit tests/Zend/Db/ActiveRecord
>
>
> This is the first version. As I'm writing these classes from scratch (using
> and refactoring my custom classes), not everything is implemented yet and
> expect some bugs.
>
>
>
> Have a nice day!
>
>
> Arthur
>
>

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveRecord proposal

Artur Bodera
Great!
That means we're that much ahead.

Thanks for the heads up.
My implementation is working well on ZF1 / ZF2dev3 version of DB.

After you've re-factored DB to v2, I'll adjust AR to match and (possibly)
make use of new conventions and features.
I'm also planning some simple mapping and migration tools (Zend\Tool
providers).

Please, do drop a line on the list when you think your branch's API is
mature enough and I could start testing it out.

Thanks.


--

      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


On Wed, Jul 20, 2011 at 1:36 AM, Ralph Schindler
<[hidden email]>wrote:

> Zend\Db is being refactored right now, and ActiveRecord was planned.
>
> Check the requirements here:
>
> http://framework.zend.com/**wiki/display/ZFDEV2/Zend+Db+2.**0+Requirements<http://framework.zend.com/wiki/display/ZFDEV2/Zend+Db+2.0+Requirements>
>
> And its progress in my feature branch here:
>
> https://github.com/**ralphschindler/zf2/tree/**feature/db<https://github.com/ralphschindler/zf2/tree/feature/db>
>
> Significant work is being done, particularly of interest in the metadata
> and query builder components.  The adapter API is fairly complete currently
> as it supports Mysql and SQL server and PDO.
>
> Over the next month or so, watch this development.  The activerecord
> implementation should work by utilizing the adapter, query builder and
> metadata components - and, once formalized, the plugin api.
>
> So, to reiterate, there is no objection on my end for having an
> ActiveRecord implementation, it just needs to be built off of the newly
> refactored Zend\Db :)
>
> -ralph
>
>
> On 7/19/11 8:35 AM, Artur Bodera wrote:
>
>> Hey ZF hackers!
>>
>> Most of PHP developers using frameworks have this moment, when it hits
>> them:
>> - I have gazillion of my own, custom classes that I reuse in every
>> project.
>> Why isn't this X Y Z functionality already in the framework?
>>
>> So now it hit me (again), so I (finally) sent that CLA and started giving
>> some lovin to a project, that I've been feeding from for the last 4 years
>> or
>> so.
>> As I'm not anonymous anymore, I'm sending my first proposal, based on my
>> 10-year experience with ActiveRecord pattern.
>>
>> I've been tracking Zend\Db\* for some time now and I could not understand
>> why it wasn't implemented. It's an extremely simple pattern to work with,
>> a
>> bit more tricky to implement, but that's what frameworks are for, right?
>>
>> On the other hand ActiveRecord is an elementary topic for every beginner
>> PHP
>> programmer that learns LAMP and creates his/her first class. Yet, the most
>> popular and hyped framework (ekhm.. ZF) did not have anything that would
>> resemble that.  Also agile programming (think 2011), in general, is all
>> about efficiency and time-to-market, so AR is a great alternative to a
>> full-blown ORM in terms of development and maintenance time.
>>
>>
>> Because AR is so simple, it is a blast to use.
>> Because it's an universal component, I will optimize it "to the bone" to
>> make it feasible for high-load and large data applications.
>>
>>
>> For all hard-core devs out there, and "pattern cops": I swear I will never
>> ever tell anyone that AR is the same as a model ;-) I will also never try
>> to
>> replace or sabotage Doctrine or Proper integration efforts. What I've
>> created is an "implementation of pareto" for database access. Observing my
>> own development efforts: when my OO app have a robust AR, I rarely need
>> anything else for DB access.
>>
>>
>> Here is the proposal:
>> http://framework.zend.com/**wiki/display/ZFDEV2/**
>> ActiveRecord+-+Arthur+Bodera<http://framework.zend.com/wiki/display/ZFDEV2/ActiveRecord+-+Arthur+Bodera>
>>
>> ps: I have put it in ZFDEV2 space, because it is ZF2 only (for now).
>>
>>
>> Here is my branch with working implementation:
>> https://github.com/Thinkscape/**zf2/branches/ActiveRecord<https://github.com/Thinkscape/zf2/branches/ActiveRecord>
>>
>> Unit tests: require a working db connection, so configure it in
>> TestConfiguration.php. Then run:
>> # phpunit tests/Zend/Db/ActiveRecord
>>
>>
>> This is the first version. As I'm writing these classes from scratch
>> (using
>> and refactoring my custom classes), not everything is implemented yet and
>> expect some bugs.
>>
>>
>>
>> Have a nice day!
>>
>>
>> Arthur
>>
>>
>>
> --
> List: [hidden email]
> Info: http://framework.zend.com/**archives<http://framework.zend.com/archives>
> Unsubscribe: zf-contributors-unsubscribe@**lists.zend.com<[hidden email]>
>
>
>
Loading...