private function updateAuthors(AddonVersion $version, CompletePackage $package) { if ($package->getAuthors()) { foreach ($package->getAuthors() as $details) { $author = null; if (!$details->getName() && !$details->getEmail()) { continue; } if ($details->getEmail()) { $author = AddonAuthor::get()->filter('Email', $details->getEmail())->first(); } if (!$author && $details->getHomepage()) { $author = AddonAuthor::get()->filter('Name', $details->getName())->filter('Homepage', $details->getHomepage())->first(); } if (!$author && $details->getName()) { $author = AddonAuthor::get()->filter('Name', $details->getName())->filter('Versions.Addon.Name', $package->getName())->first(); } if (!$author) { $author = new AddonAuthor(); } if ($details->getName()) { $author->Name = $details->getName(); } if ($details->getEmail()) { $author->Email = $details->getEmail(); } if ($details->getHomepage()) { $author->Homepage = $details->getHomepage(); } //to-do not supported by API //if(isset($details['role'])) $author->Role = $details['role']; $version->Authors()->add($author->write()); } } }
public function Authors() { return AddonAuthor::get(); }