예제 #1
0
 /**
  * Locate every available Symfony command using Tokenizer.
  *
  * @return array
  */
 public function findCommands()
 {
     $this->commands = [];
     foreach ($this->tokenizer->getClasses(SymfonyCommand::class, null, 'Command') as $class) {
         if ($class['abstract']) {
             continue;
         }
         $this->commands[] = $class['name'];
     }
     $this->memory->saveData('commands', $this->commands);
     return $this->commands;
 }
예제 #2
0
 /**
  * Locate every available Record class.
  *
  * @param TokenizerInterface $tokenizer
  * @throws SchemaException
  */
 protected function locateRecords(TokenizerInterface $tokenizer)
 {
     //Table names associated with records
     $sources = [];
     foreach ($tokenizer->getClasses(RecordEntity::class) as $class => $definition) {
         if ($class == RecordEntity::class || $class == Record::class) {
             continue;
         }
         $this->records[$class] = $record = new RecordSchema($this, $class);
         if (!$record->isAbstract()) {
             //See comment near exception
             continue;
         }
         //Record associated tableID (includes resolved database name)
         $sourceID = $record->getSourceID();
         if (isset($sources[$sourceID])) {
             //We are not allowing multiple records talk to same database, unless they one of them
             //is abstract
             throw new SchemaException("Record '{$record}' associated with " . "same source table '{$sourceID}' as '{$sources[$sourceID]}'.");
         }
         $sources[$sourceID] = $record;
     }
 }
예제 #3
0
 /**
  * Locate every available Document class.
  *
  * @param TokenizerInterface $tokenizer
  */
 protected function locateDocuments(TokenizerInterface $tokenizer)
 {
     foreach ($tokenizer->getClasses(DocumentEntity::class) as $class => $definition) {
         if ($class == DocumentEntity::class || $class == Document::class) {
             continue;
         }
         $this->documents[$class] = new DocumentSchema($this, $class);
     }
 }