コード例 #1
0
ファイル: PluginTest.php プロジェクト: anime-db/app-bundle
 public function testGetWebPath()
 {
     $this->assertEmpty($this->plugin->getWebPath());
     $this->plugin->setLogo('foo');
     $this->assertEquals('/media/plugin//foo', $this->plugin->getWebPath());
     $this->plugin->setName('foo/bar');
     $this->assertEquals('/media/plugin/foo/bar/foo', $this->plugin->getWebPath());
 }
コード例 #2
0
ファイル: Package.php プロジェクト: anime-db/app-bundle
 /**
  * Add plugin from package.
  *
  * @param ComposerPackage $package
  */
 protected function addPackage(ComposerPackage $package)
 {
     $plugin = $this->rep->find($package->getName());
     // create new plugin if not exists
     if (!$plugin) {
         $plugin = new Plugin();
         $plugin->setName($package->getName());
     }
     list($vendor, $package) = explode('/', $plugin->getName());
     try {
         $data = $this->client->getPlugin($vendor, $package);
         $plugin->setTitle($data['title'])->setDescription($data['description']);
         if ($data['logo']) {
             $this->downloader->entity($data['logo'], $plugin, true);
         }
     } catch (\Exception $e) {
         // is not a critical error
     }
     $this->em->persist($plugin);
     $this->em->flush();
 }