fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10098] Logistic: Added method toArray


From: Torstein
Subject: [Fmsystem-commits] [10098] Logistic: Added method toArray
Date: Wed, 03 Oct 2012 08:05:14 +0000

Revision: 10098
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10098
Author:   vator
Date:     2012-10-03 08:05:13 +0000 (Wed, 03 Oct 2012)
Log Message:
-----------
Logistic: Added method toArray

Modified Paths:
--------------
    trunk/logistic/inc/model/class.activity.inc.php

Modified: trunk/logistic/inc/model/class.activity.inc.php
===================================================================
--- trunk/logistic/inc/model/class.activity.inc.php     2012-10-03 07:11:43 UTC 
(rev 10097)
+++ trunk/logistic/inc/model/class.activity.inc.php     2012-10-03 08:05:13 UTC 
(rev 10098)
@@ -33,16 +33,19 @@
                {
                                public static $so;
 
-                               protected static $id;
-                               protected static $name;
-                               protected static $description;
-                               protected static $parent_id;
-                               protected static $project_id;
-                               protected static $start_date;
-                               protected static $end_date;
-                               protected static $responsible_user_id;
-                               protected static $update_user;
-                               protected static $update_date;
+                               protected $id;
+                               protected $name;
+                               protected $description;
+                               protected $parent_id;
+                               protected $project_id;
+                               protected $start_date;
+                               protected $end_date;
+                               protected $responsible_user_id;
+                               protected $update_user;
+                               protected $update_date;
+                               
+                               // Arrays
+                               protected $sub_activities = array();
 
                                /**
                                * Constructor.  Takes an optional ID.  If a 
contract is created from outside
@@ -154,6 +157,16 @@
                                {
                                        return $this->update_date;
                                }
+                               
+                               public function 
set_sub_activities($sub_activities)
+                               {
+                                       $this->sub_activities = $sub_activities;
+                               }
+                               
+                               public function get_sub_activities()
+                               {
+                                       return $this->sub_activities;
+                               }
 
                                /**
                                * Get a static reference to the storage object 
associated with this model object
@@ -187,4 +200,18 @@
                                                'responsible_user_id' => 
$responsible_user
                                        );
                                }
+
+                               public function toArray()
+                               {
+                                       $converted_obj_array = 
parent::toArray();
+                                       
+                                       $converted_obj_array['sub_activities'] 
= array();
+                                       
+                                       foreach($this->sub_activities as 
$activitiy)
+                                       {
+                                               
$converted_obj_array['sub_activities'][] = $activitiy->toArray();
+                                       }
+                                                               
+                                       return $converted_obj_array;
+                               }
                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]