/** * 添加一个可被引入的项. * * @param Includable $includable * * @throws Exception */ public function add(Includable $includable) { if ($includable->isNested()) { $parent_includable = $this->getIncludable($includable->getParentName()); if (null === $parent_includable) { throw new Exception('You must define includable ' . $includable->getParentName()); } $parent_includable->addChildren($includable); } $this->available_includes[$includable->getName()] = $includable; $this->foreign_keys[$includable->getName()] = $includable->getForeignKey(); }