示例#1
0
文件: Inserter.php 项目: anroots/dag
 /**
  * Return organization ID by its name. If the organization does not exist, create it
  *
  * @param string $organizationName
  * @return int The ID of the organization
  */
 private function insertOrFetch(string $organizationName) : int
 {
     $organization = $this->organization->getByName($organizationName);
     if ($organization !== null) {
         return $organization->id;
     }
     return DB::table('organizations')->insertGetId(['name' => $organizationName]);
 }
示例#2
0
文件: Query.php 项目: anroots/dag
 /**
  * {@inheritdoc}
  */
 public function getRelatedByName(string $name) : array
 {
     $organization = $this->organization->getByName($name);
     if ($organization === null) {
         throw new ModelNotFoundException();
     }
     return $this->getRelated($organization->id);
 }