示例#1
0
 /**
  * Returns the example object of {@link epObjectRelation}
  * 
  * The example object will only be created once and used later by changing the
  * values of its vars. This saves memory and a little execution time.
  * 
  * @param string $class_a name of class a
  * @param integer $oid_a object id of the class a object
  * @param integer $var_a the relational field of object a
  * @param string $base_b name of base b
  * @param string $class_b name of class b
  * @param integer $oid_b oid of the class b object
  * @return false|epObjectRelation
  */
 protected function &_relationExample($class_a = null, $oid_a = null, $var_a = null, $base_b = null, $class_b = null, $oid_b = null)
 {
     // check if the example object has been created
     if ($this->eo_obj_rel) {
         // set values to vars
         $this->eo_obj_rel->class_a = $class_a;
         $this->eo_obj_rel->oid_a = $oid_a;
         $this->eo_obj_rel->var_a = $var_a;
         $this->eo_obj_rel->base_b = $base_b;
         $this->eo_obj_rel->class_b = $class_b;
         $this->eo_obj_rel->oid_b = $oid_b;
         return $this->eo_obj_rel;
     }
     // need to create example object (false: no caching, false: no event dispatching)
     $this->eo_obj_rel =& parent::_create('epObjectRelation', false, false, array($class_a, $oid_a, $var_a, $base_b, $class_b, $oid_b));
     if (!$this->eo_obj_rel) {
         throw new epExceptionManager('Cannot create relation object');
         return false;
     }
     return $this->eo_obj_rel;
 }