Example #1
0
 /**
  * 获得 BelongTo Bean
  *
  * @param $name
  * @throws \Exception
  * @return Bean|null
  */
 public function getBelongTo($name)
 {
     $foreignKey = Relation::getForeignKey($name);
     if (!isset($this->data[$foreignKey])) {
         return null;
     }
     $foreignTable = $this->table->getBelongToTable($name);
     $m = $this->getManagerFactory()->getManager($foreignTable);
     return $m->get($this->data[$foreignKey]);
 }