Not really a problem of Zend_Date in my opinion.
When you clone a object you will have 2 different objects as per OOP definition.

This is nothing which can be manipulated by Zend_Date.
All methods you called are not static, so they only belong to the called instance.

You could try to use the copy method instead of cloning the object yourself... but this should not change anything.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "Juan Felipe Alvarez Saldarriaga" <[EMAIL PROTECTED]>
To: "fw-general" <fw-general@lists.zend.com>
Sent: Wednesday, October 29, 2008 5:25 PM
Subject: [fw-general] Zend_Date Issue Cloning Dates


Hey!

I have an issue when I try to store Zend_Date object into an array, I guess is not Zend_Date but I don't know what it happend, that's hwat I got:

I get some dates from the database, I create a Zend_Date object with this db date then I clone it and add some stuff to the object, then I store every object in an array, but when I try to print the $date->toString() date I have duplicated dates, I mean $objStart == $objEnd, like isn't cloned.

...

$arrTimes = array();

while ( $arrRowData = $objDbStatement->fetch() )
{
$objStart = new Zend_Date( $arrRowData['work_time_specific_date'], Zend_Date::ISO_8601, Zend_Registry::get( "objLocale" ) );

   $objStart->setTimeZone( 'UCT' );

   $objEnd = clone $objStart;

   $objStart->setTime( $arrRowData['time_start'] );

   $objEnd->setTime( $arrRowData['time_end'] );

   $arrTimes[] = array(
       'start' => $objStart,
       'end' => $objEnd,
       'type' => 'enabled'
   );
}

...

Thx for any help.

Reply via email to