private function createLicenses() { $license = new LicenseEntity('all-rights-reserved'); $license->setTitle('All Rights Reserved')->setEnabledForWeb(false)->setEnabledForUpload(true); $this->entityManager->persist($license); $license = new LicenseEntity('no-rights-reserved'); $license->setTitle('No Rights Reserved')->setEnabledForWeb(true)->setEnabledForUpload(true); $this->entityManager->persist($license); $ccVersions = ['1.0', '2.0', '2.5', '3.0', '4.0']; $ccNames = ['CC-BY' => 'Creative Commons Attribution', 'CC-BY-ND' => 'Creative Commons Attribution No Derivatives', 'CC-BY-NC' => 'Creative Commons Attribution Non Commercial', 'CC-BY-NC-ND' => 'Creative Commons Attribution Non Commercial No Derivatives', 'CC-BY-NC-SA' => 'Creative Commons Attribution Non Commercial Share Alike', 'CC-BY-SA' => 'Creative Commons Attribution Share Alike']; foreach ($ccVersions as $version) { foreach ($ccNames as $id => $name) { $urlId = strtolower(substr($id, 3)); $license = new LicenseEntity("{$id}-{$version}"); $license->setTitle("{$name} {$version}")->setUrl("http://creativecommons.org/licenses/{$urlId}/{$version}/")->setImageUrl("https://i.creativecommons.org/l/{$urlId}/{$version}/80x15.png")->setEnabledForWeb(true)->setEnabledForUpload(true)->setOutdated($version != '4.0'); $this->entityManager->persist($license); } } $this->entityManager->flush(); }
public function addLicense(LicenseEntity $licenseEntity) { $licenseEntity->getHookedObjects()->add($this); $this->licenses->add($licenseEntity); }