On Sun, 16 Dec 2012, Lester Caine wrote:
> > > I'm not really against that, but we do need to use the Date namespace -
> > > >>so DateTimeImmutable. It might be trickier to do than it sounds
> > > >>though...
> > >
> > > I've started hacking on this - with some luck I'm done before PHP 5.5
> > > beta1.
>
> Am I missing something here?
> Isn't this just making the object content read only?
Sortof. But as that is how things work, making an immutable variant
isn't that easy.
> Haven't we been having a separate discussion on that?
>
> On the whole I'm only using DateTime objects when I need to display the
> content in a different timezone, so the timezone needs to be changeable, but
> the base date is read only. Alternatively I'm building a calendar so need 'all
> the days for month x' as an array, and then use those dates to generate the
> database query. If it's a 'local' calendar then there will be a time offset
> incorporated as well.
Al the methods will *still* return the modified DateTime object - it's
just that the one that you *call* f.e. ->modify() on won't change
anymore.
cheers,
Derick