示例#1
0
 public function __construct()
 {
     parent::__construct(static::NAME, static::VERSION);
     //Add Doctrine support to console
     $em = Configuration::getEntityManager();
     $doctrineHelperSet = new HelperSet(['db' => new ConnectionHelper($em->getConnection()), 'em' => new EntityManagerHelper($em)]);
     $this->setHelperSet($doctrineHelperSet);
     ConsoleRunner::addCommands($this);
     $this->addCommands([new Command\ModuleUpdateCommand()]);
 }
示例#2
0
 public function run()
 {
     $em = Configuration::getEntityManager();
     //crea
     //$test = new Test();
     //$test->setName("vincent");
     //$test->setAge(99);
     //$em->persist($test);
     //
     //$test2 = new Test2();
     //$test2->setSurname("Rossi");
     //$test2->setYearOfBith("2010");
     //$em->persist($test2);
     $tests = $em->getRepository('Mekit\\Entity\\Test')->findAll();
     $template = $this->twig->loadTemplate("test2.twig");
     $output = $template->render(["alltests" => $tests]);
     print $output;
 }
示例#3
0
 /**
  * @param string $moduleName
  * @param string $apiVersion
  * @return bool|array
  */
 protected function getReleaseInfoForModule($moduleName, $apiVersion)
 {
     $answer = false;
     $cfg = Configuration::getConfiguration();
     $mekitDownloader = new Downloader();
     $moduleInfoUrlTpl = $cfg["url"]["module_info"];
     $moduleInfoUrl = str_replace(['{MODULE}', '{VERSION}'], [$moduleName, $apiVersion], $moduleInfoUrlTpl);
     $mekitDownloader->setOption(CURLOPT_URL, $moduleInfoUrl);
     $moduleInfoArray = $mekitDownloader->getRemoteContent("xml_to_array");
     if (isset($moduleInfoArray["releases"])) {
         //Last Release Info
         $lastReleaseInfo = isset($moduleInfoArray["releases"]["release"][0]) ? $moduleInfoArray["releases"]["release"][0] : $moduleInfoArray["releases"]["release"];
         $answer = $lastReleaseInfo;
     }
     return $answer;
 }