I know that Doctrine 2.0 is going to work with only one file per
model.
Is it possible that methods within the ModelTable class can be
declared as static methods (ActiveRecord-like) now that PHP 5.3
supports late static bindings ?
In Doctrine 2.0 the ModelTable does not exist. Things are pretty different.
But, we haven't begun to think about how or if we will use the late static
binding features of php 5.3
- Jon
On Fri, Jun 26, 2009 at 3:40 PM, Sailor <salim.semao...@gmail.com> wrote:
> Hi all,
> I know that Doctrine 2.0 is going to work with only one file per
> model.
> Is it possible that methods within the ModelTable class can be
> declared as static methods (ActiveRecord-like) now that PHP 5.3
> supports late static bindings ?
> Salim
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related questions
at jonathan.w...@sensio.com
From: doctrine-dev@googlegroups.com [mailto:doctrine-dev@googlegroups.com]
On Behalf Of Jonathan Wage
Sent: Friday, June 26, 2009 5:28 PM
To: doctrine-dev@googlegroups.com
Subject: [doctrine-dev] Re: Late static bindings
In Doctrine 2.0 the ModelTable does not exist. Things are pretty
different. But, we haven't begun to think about how or if we will use the
late static binding features of php 5.3
- Jon
On Fri, Jun 26, 2009 at 3:40 PM, Sailor <salim.semao...@gmail.com> wrote:
Hi all,
I know that Doctrine 2.0 is going to work with only one file per
model.
Is it possible that methods within the ModelTable class can be
declared as static methods (ActiveRecord-like) now that PHP 5.3
supports late static bindings ?
Salim
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related
questions at jonathan.w...@sensio.com
On Jun 26, 2009, at 11:28 PM, Jonathan Wage wrote:
> In Doctrine 2.0 the ModelTable does not exist. Things are pretty > different. But, we haven't begun to think about how or if we will > use the late static binding features of php 5.3
> - Jon
The thing that comes nearest is probably the EntityRepository. However, it doesnt make much sense to add static methods to your own, derived repositories, just add normal methods. In fact static methods have a downside: harder to test (if at all).
The only use for late static binding is maybe in rails-like ActiveRecord implementations but even then you got the problem of testability (except if you dont ever want to stub/mock these finders...).
I currently dont see a good use for late static binding in doctrine 2. Maybe an extension could provide an "ActiveRecord" base class that uses it for people who want it but it will not be in the Doctrine 2 core distribution.
From: doctrine-dev@googlegroups.com [mailto:doctrine-dev@googlegroups.com]
On Behalf Of Adam Huttler
Sent: Friday, June 26, 2009 5:46 PM
To: doctrine-dev@googlegroups.com
Subject: [doctrine-dev] Re: Late static bindings
The obvious example to be has always been:
$user = User::find($id);
From: doctrine-dev@googlegroups.com [mailto:doctrine-dev@googlegroups.com]
On Behalf Of Jonathan Wage
Sent: Friday, June 26, 2009 5:28 PM
To: doctrine-dev@googlegroups.com
Subject: [doctrine-dev] Re: Late static bindings
In Doctrine 2.0 the ModelTable does not exist. Things are pretty
different. But, we haven't begun to think about how or if we will use the
late static binding features of php 5.3
- Jon
On Fri, Jun 26, 2009 at 3:40 PM, Sailor <salim.semao...@gmail.com> wrote:
Hi all,
I know that Doctrine 2.0 is going to work with only one file per
model.
Is it possible that methods within the ModelTable class can be
declared as static methods (ActiveRecord-like) now that PHP 5.3
supports late static bindings ?
Salim
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related
questions at jonathan.w...@sensio.com
Since by default models won't extend anything. This won't be something in
the core, but I think we'll have a DoctrineActiveRecord extension that
people can use to give them some cool active record style functionality. It
is yet to be decided tho.
adam.hutt...@fracturedatlas.org> wrote:
> The obvious example to be has always been:
> $user = User::find($id);
> *From:* doctrine-dev@googlegroups.com [mailto:
> doctrine-dev@googlegroups.com] *On Behalf Of *Jonathan Wage
> *Sent:* Friday, June 26, 2009 5:28 PM
> *To:* doctrine-dev@googlegroups.com
> *Subject:* [doctrine-dev] Re: Late static bindings
> In Doctrine 2.0 the ModelTable does not exist. Things are pretty different.
> But, we haven't begun to think about how or if we will use the late static
> binding features of php 5.3
> - Jon
> On Fri, Jun 26, 2009 at 3:40 PM, Sailor <salim.semao...@gmail.com> wrote:
> Hi all,
> I know that Doctrine 2.0 is going to work with only one file per
> model.
> Is it possible that methods within the ModelTable class can be
> declared as static methods (ActiveRecord-like) now that PHP 5.3
> supports late static bindings ?
> Salim
> --
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> training, consulting, application development, or business related questions
> at jonathan.w...@sensio.com
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related questions
at jonathan.w...@sensio.com
On Fri, Jun 26, 2009 at 5:04 PM, Jonathan Wage <jonw...@gmail.com> wrote:
> Since by default models won't extend anything. This won't be something in
> the core, but I think we'll have a DoctrineActiveRecord extension that
> people can use to give them some cool active record style functionality. It
> is yet to be decided tho.
> - Jon
> On Fri, Jun 26, 2009 at 4:45 PM, Adam Huttler <
> adam.hutt...@fracturedatlas.org> wrote:
>> The obvious example to be has always been:
>> $user = User::find($id);
>> *From:* doctrine-dev@googlegroups.com [mailto:
>> doctrine-dev@googlegroups.com] *On Behalf Of *Jonathan Wage
>> *Sent:* Friday, June 26, 2009 5:28 PM
>> *To:* doctrine-dev@googlegroups.com
>> *Subject:* [doctrine-dev] Re: Late static bindings
>> In Doctrine 2.0 the ModelTable does not exist. Things are pretty
>> different. But, we haven't begun to think about how or if we will use the
>> late static binding features of php 5.3
>> - Jon
>> On Fri, Jun 26, 2009 at 3:40 PM, Sailor <salim.semao...@gmail.com> wrote:
>> Hi all,
>> I know that Doctrine 2.0 is going to work with only one file per
>> model.
>> Is it possible that methods within the ModelTable class can be
>> declared as static methods (ActiveRecord-like) now that PHP 5.3
>> supports late static bindings ?
>> Salim
>> --
>> Jonathan H. Wage (+1 415 992 5468)
>> Open Source Software Developer & Evangelist
>> sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
>> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
>> training, consulting, application development, or business related questions
>> at jonathan.w...@sensio.com
> --
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> training, consulting, application development, or business related questions
> at jonathan.w...@sensio.com
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related questions
at jonathan.w...@sensio.com
Don't you think that it's a little weird to create an object just to
instantiate others ?
Plus, I don't see why it would be harder to test (i'm not a testing
guru ;))
On 27 juin, 00:04, Roman Borschel <r.borsc...@gmx.net> wrote:
> On Jun 26, 2009, at 11:28 PM, Jonathan Wage wrote:
> > In Doctrine 2.0 the ModelTable does not exist. Things are pretty
> > different. But, we haven't begun to think about how or if we will
> > use the late static binding features of php 5.3
> > - Jon
> The thing that comes nearest is probably the EntityRepository.
> However, it doesnt make much sense to add static methods to your own,
> derived repositories, just add normal methods. In fact static methods
> have a downside: harder to test (if at all).
> The only use for late static binding is maybe in rails-like
> ActiveRecord implementations but even then you got the problem of
> testability (except if you dont ever want to stub/mock these
> finders...).
> I currently dont see a good use for late static binding in doctrine 2.
> Maybe an extension could provide an "ActiveRecord" base class that
> uses it for people who want it but it will not be in the Doctrine 2
> core distribution.
In general, "static" is often considered not good style in an object- oriented program, though there are some valid uses. Probably the most useful scenario are factory methods and thats about the only area where you'll find static methods in doctrine 2 I think.
On Sat, Jun 27, 2009 at 9:53 AM, Roman Borschel <r.borsc...@gmx.net> wrote: > In general, "static" is often considered not good style in an object- > oriented program, though there are some valid uses. Probably the most > useful scenario are factory methods and thats about the only area > where you'll find static methods in doctrine 2 I think.
I'm reading the tests for 2.0 branch while grepp'ing for '::' in the lib/ folder. I agree that static methods should be banished after all.
In my users opinion, the table factory as it is today does not work
well with IDEs. When I do a Doctrine::getTable('XType'), my IDE does
not know the type of the result, so the missing auto-complete slows
the development time. I have no problem with instatiating a factory to
build a model, but something like User::getFactory()->find() would be
a lot better to the speed of the team if the IDE recognizes the type
of the built object.
2009/6/30 Giorgio Sironi <piccoloprincipeazzu...@gmail.com>:
> On Sat, Jun 27, 2009 at 9:53 AM, Roman Borschel <r.borsc...@gmx.net> wrote:
>> In general, "static" is often considered not good style in an object-
>> oriented program, though there are some valid uses. Probably the most
>> useful scenario are factory methods and thats about the only area
>> where you'll find static methods in doctrine 2 I think.
> I'm reading the tests for 2.0 branch while grepp'ing for '::' in the lib/
> folder. I agree that static methods should be banished after all.
On Tue, Jun 30, 2009 at 2:09 PM, Bruno Reis <bruno.p.r...@gmail.com> wrote: > I have no problem with instatiating a factory to > build a model, but something like User::getFactory()->find() would be > a lot better to the speed of the team if the IDE recognizes the type > of the built object.
Since the table/repository it's not a template class (which does not exist in php) it's not possible to provide a @return tag for every possible model, but if you subclass it you could put the tag you want for autocompletion.