/** * Adds a join * * @param ApiInterface $entity * @param string $alias * @param bool $forceFind * * @return ApiInterface|false False if sub part was not found * @throws Exception */ private function addJoin(ApiInterface $entity, $alias, $forceFind) { if (in_array($alias, $entity->getParentRelationships())) { $referencedModel = $entity->addJoin($this->getCriteriaHelper(), $alias); return new $referencedModel(); } else { if ($forceFind) { throw new Exception('Could Not Find Part in current entity: ' . $alias, 400); } return false; } }