Esempio n. 1
0
 public function __construct(Project $project, $inTests = FALSE)
 {
     parent::__construct($project);
     $this->entitiesNamespace = Config::get('doctrine.entities.namespace') ?: $this->project->getNamespace() . '\\Entities';
     $this->manager = PSC::getEventManager();
     $this->connectionName = $inTests ? 'tests' : 'default';
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = $input->getArgument('file');
     $compile = (bool) $input->getOption('compile');
     if ($file == '') {
         $output->writeln('Datei nicht angegeben');
         return;
     }
     $file = new File($file);
     /* Performance: kein file_exists() */
     //if (!$file->exists()) {
     //  $output->writeln('Datei existiert nicht.');
     //  return;
     //}
     /* Der Source Path vom CMS */
     $cp = PSC::getProjectsFactory()->getProject('psc-cms')->getClassPath();
     //$output->writeln($file->getDirectory().' subDirOf ');
     //$output->writeln((string) $cp);
     /* Die Datei ist für uns (erstmal) nur interessant, wenn Sie im PSC-CMS Verzeichnis liegt
           Sie ist damit also eine SRC Datei und triggered das compilieren des Phars
        */
     if ($file->getDirectory()->isSubdirectoryOf($cp) || $file->getDirectory()->equals($cp)) {
         PSC::getEventManager()->dispatchEvent('Psc.SourceFileChanged', (object) array('file' => $file, 'compile' => $compile), $this);
         if ($compile) {
             $output->writeln('SourceDatei in psc-cms ' . $file->getName() . ' wurde compiled.');
         } else {
             $output->writeln('SourceDatei in psc-cms ' . $file->getName() . ' wurde als geändert markiert.');
         }
     } else {
         $output->writeln('SourceDatei ' . $file . ' wurde nicht markiert.');
     }
 }
Esempio n. 3
0
 public function bootstrap()
 {
     parent::bootstrap();
     /* wir registrieren das sourcefilechanged event */
     PSC::getEventManager()->bind($this, 'Psc.SourceFileChanged');
     $this->getCache()->create();
     return $this;
 }
Esempio n. 4
0
 /**
  * Erstellt ein neues Modul
  *
  * wird nur einmal aufgerufen pro Request
  * vorher wurde mit isModule ($name) bereits überprüft
  * @return Psc\CMS\Module
  */
 protected function create($name)
 {
     $c = $this->avaibleModules[$name]['class'];
     $module = new $c($this->project, $this->inTests);
     $module->setName($name);
     $this->modules[$name] = $module;
     PSC::getEventManager()->dispatchEvent('Psc.ModuleCreated', NULL, $module);
     return $module;
 }
Esempio n. 5
0
 /**
  * Sollte unbedingt nach bootstrap() aufgerufen werden
  */
 public function dispatchBootstrapped()
 {
     PSC::getEventManager()->dispatchEvent('Psc.ModuleBootstrapped', NULL, $this);
     PSC::getEventManager()->dispatchEvent('Psc.' . $this->getName() . '.ModuleBootstrapped', NULL, $this);
 }
Esempio n. 6
0
 public function testPscEventManagerIsReturnedFromPSC()
 {
     $this->assertInstanceOf('Psc\\Code\\Event\\Manager', PSC::getEventManager());
 }