示例#1
0
 function __construct(\Tracker\Tabular\Schema $schema, \Search_Query $query)
 {
     $def = $schema->getDefinition();
     $this->trackerId = $def->getConfiguration('trackerId');
     $this->query = $query;
     $this->schema = $schema;
 }
示例#2
0
 function __construct(\Tracker_Definition $definition, $fileName)
 {
     $file = new \SplFileObject($fileName, 'r');
     $headers = $file->fgetcsv();
     $schema = new Schema($definition);
     foreach ($headers as $header) {
         if (preg_match(Schema\Column::HEADER_PATTERN, $header, $parts)) {
             list($full, $pk, $field, $mode) = $parts;
             $schema->addColumn($field, $mode);
             if ($pk === '*') {
                 $schema->setPrimaryKey($field);
             }
         } else {
             // Column without definition, add fake entry to skip column
             $schema->addNew('ignore', 'ignore')->setReadOnly(true);
         }
     }
     $this->source = new CsvSource($schema, $fileName);
 }
示例#3
0
 function __construct(\Tracker\Tabular\Schema $schema, $fileName)
 {
     $this->schema = $schema->getPlainOutputSchema();
     $this->file = new \SplFileObject($fileName, 'r');
 }
示例#4
0
 function validateAgainst(\Tracker\Tabular\Schema $schema)
 {
     if ($this->isPrimary && $this->isReadOnly) {
         throw new \Exception(tr('Primary Key fields cannot be read-only.'));
     }
     $selfCount = 0;
     foreach ($schema->getColumns() as $column) {
         if ($column->is($this->permName, $this->mode)) {
             $selfCount++;
         }
         foreach ($this->incompatibilities as $entry) {
             list($field, $mode) = $entry;
             if ($column->is($field, $mode)) {
                 // Skip incompatibility if either field is read-only
                 if ($this->isReadOnly() || $column->isReadOnly()) {
                     continue;
                 }
                 throw new \Exception(tr('Column "%0" cannot co-exist with "%1".', $column->getEncodedHeader(), $this->getEncodedHeader()));
             }
         }
     }
     if ($selfCount > 1) {
         throw new \Exception(tr('Column "%0:%1" found multiple times.', $this->permName, $this->mode));
     }
 }
示例#5
0
 function __construct(\Tracker\Tabular\Schema $schema)
 {
     $def = $schema->getDefinition();
     $this->trackerId = $def->getConfiguration('trackerId');
     $this->schema = $schema;
 }