public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Added the CmsDateTime class that extends the DateTime class in php 5.2
Changed the ORM select sequence to pull out date fields and put them in 
CmsDateTime objects

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4232 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Mon Oct 15 18:21:27 -0700 2007
commit  b9fa75969168bd17116799b7297d0ee68923a30d
tree    f0dae58ec21a8cd8c2a7a5baa2c04c1d4971c768
parent  69bbda166d7da249fdb700e97f94089a319315ac
...
969
970
971
972
 
973
974
975
 
 
 
976
977
 
 
 
 
978
979
 
 
 
 
 
 
 
 
 
980
981
982
...
969
970
971
 
972
973
974
975
976
977
978
979
980
981
982
983
984
985
 
986
987
988
989
990
991
992
993
994
995
996
997
0
@@ -969,14 +969,29 @@ abstract class CmsObjectRelationalMapping extends CmsObject implements ArrayAcce
0
    *
0
    * @param array Reference to the hash for this record that came from the database
0
    * @param mixed Reference to the object we should fill
0
- * @return The object we filled (php4 doesn't seem to handle the reference right)
0
+ * @return The object we filled
0
    */
0
   function fill_object(&$resulthash, &$object)
0
   {
0
+ $db = cms_db();
0
+ $fields = $this->get_columns_in_table(); //Relax, it's cached
0
+
0
     foreach ($resulthash as $k=>$v)
0
     {
0
+ $datetime = false;
0
+ if (array_key_exists($k, $fields) && strtolower($fields[$k]->type) == 'datetime')
0
+ $datetime = true;
0
+
0
       if (array_key_exists($k, $this->field_maps)) $k = $this->field_maps[$k];
0
- $object->params[$k] = $v;
0
+
0
+ if ($datetime)
0
+ {
0
+ $object->params[$k] = new CmsDateTime($v);
0
+ }
0
+ else
0
+ {
0
+ $object->params[$k] = $v;
0
+ }
0
     }
0
     
0
     $this->dirty = false;

Comments

    No one has commented yet.