BMLT Root Server
Public Member Functions | Private Attributes | List of all members
t_local_id_class Class Reference

This class allows us to assign a unique ID to each of its derived instances. More...

Public Member Functions

 SetParentObj ($in_parent_obj)
 Sets the object's "parent" (Container) object, as a reference. More...
 
 GetParentObj ()
 Returns a reference to the object's container. More...
 

Private Attributes

 $_local_id_parent_obj = null
 This is the parent (container) object that holds this instance. More...
 

Detailed Description

This class allows us to assign a unique ID to each of its derived instances.

We keep a static array of instantiated subclasses. When a new instance is created, the array is consulted to assign a new ID. When

Definition at line 147 of file base_templates.inc.php.

Member Function Documentation

GetParentObj ( )

Returns a reference to the object's container.

Returns
A reference to the object's parent object.

Implements i_comdef_has_parent.

Definition at line 216 of file base_templates.inc.php.

217  {
218  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
220  }
$_local_id_parent_obj
This is the parent (container) object that holds this instance.
SetParentObj (   $in_parent_obj)

Sets the object's "parent" (Container) object, as a reference.

We check for recursion here. We go up to a hundred levels deep (should never get close to that).

Prevent looping forever, in case a recursed object is presented.

Parameters
$in_parent_objA reference to the parent object.

Implements i_comdef_has_parent.

Definition at line 159 of file base_templates.inc.php.

References $_COMDEF_DEBUG.

161  {
162  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
163  global $_COMDEF_DEBUG;
164 
165  /// We check for recursion here. We go up to a hundred levels deep (should never get close to that).
166  $next_obj = $in_parent_obj;
167  if (true == $_COMDEF_DEBUG) {
168  echo "[t_local_id_class::SetParentObj] Starting Parent Object:<pre>";
169  var_dump($next_obj);
170  echo "</pre><br/>";
171  }
172  $count = 100; /// Prevent looping forever, in case a recursed object is presented.
173 
174  while ($count-- && is_object($next_obj)) {
175  if ($next_obj === $this) {
176  throw ( new Exception("(t_local_id_class::SetParentObj) Recursion!") );
177  }
178 
179  if (is_object($next_obj) && method_exists($next_obj, 'GetParentObj')) {
180  $next_obj = $next_obj->GetParentObj();
181  if (true == $_COMDEF_DEBUG) {
182  echo "[t_local_id_class::SetParentObj] Next Parent Object:<pre>";
183  var_dump($next_obj);
184  echo "</pre><br/>";
185  }
186  } else {
187  $next_obj = $in_parent_obj;
188  break;
189  }
190  }
191 
192  if (!$count) {
193  throw ( new Exception("(t_local_id_class::SetParentObj) Recursion Count Exceeded!") );
194  }
195 
196  if (true == $_COMDEF_DEBUG) {
197  echo "[t_local_id_class::SetParentObj] Ending Parent Object:<pre>";
198  var_dump($next_obj);
199  echo "</pre><br/>";
200  }
201 
202  if (is_object($in_parent_obj)) {
203  $this->_local_id_parent_obj = null;
204  $this->_local_id_parent_obj = $in_parent_obj;
205  } elseif (null == $in_parent_obj) {
206  $this->_local_id_parent_obj = null;
207  }
208  }
global $_COMDEF_DEBUG
This flag, when set to true, will cause extra debug information to be output.

Member Data Documentation

$_local_id_parent_obj = null
private

This is the parent (container) object that holds this instance.

Definition at line 153 of file base_templates.inc.php.


The documentation for this class was generated from the following file: