/**
  * Constructs a new RedBeanModels which is a collection of classes extending model.
  * The models are created lazily.
  * Models are only constructed with beans by the model. Beans are
  * never used by the application directly.
  */
 public function __construct(RedBean_OODBBean $bean, $modelClassName, $linkType, $linkName = null)
 {
     assert('is_string($modelClassName)');
     assert('$modelClassName != ""');
     assert('is_int($linkType)');
     assert('is_string($linkName) || $linkName == null');
     assert('($linkType == RedBeanModel::LINK_TYPE_ASSUMPTIVE && $linkName == null) ||
                 ($linkType == RedBeanModel::LINK_TYPE_SPECIFIC && $linkName != null)');
     $this->modelClassName = $modelClassName;
     $tableName = $modelClassName::getTableName();
     $this->bean = $bean;
     $this->linkName = $linkName;
     if ($this->bean->id > 0) {
         $this->relatedBeansAndModels = array_values(ZurmoRedBean::related($this->bean, $tableName, null, array(), $this->getTableName(ZurmoRedBean::dispense($tableName))));
     } else {
         $this->relatedBeansAndModels = array();
     }
 }