protected function getDatabseMetaData($tableName)
 {
     $table = new Table($tableName);
     $table->addColumn('tag_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->addColumn('tag_user_context', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('tag_date_created', 'datetime', array('notnull' => true));
     $table->addColumn('tag_weight', 'float', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('tag_title', 'string', array('length' => 45, 'notnull' => true));
     $table->setPrimaryKey(array("tag_id"));
     $table->addIndex(array('tag_user_context'));
     # vcolumn for counts
     $table->addVirtualColumn('tag_count', 'integer', array('unsigned' => true));
     return $table;
 }
 /**
  *  Register the setup code with the DI Container
  *
  * @access public
  * @param Application $app
  */
 public function register(Application $app)
 {
     $app[$this->index . '.options'] = array();
     $index = $this->index;
     #------------------------------------------------------------------
     # Table Meta Data
     #
     #------------------------------------------------------------------
     $app[$this->index . '.meta'] = $app->share(function () use($app, $index) {
         $table = new Table($app[$index . '.options']['tableName']);
         $table->addColumn('tag_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
         $table->addColumn('tag_user_context', 'integer', array("unsigned" => true, 'notnull' => false));
         $table->addColumn('tag_date_created', 'datetime', array('notnull' => true));
         $table->addColumn('tag_weight', 'float', array("unsigned" => true, 'notnull' => false));
         $table->addColumn('tag_title', 'string', array('length' => 45, 'notnull' => true));
         $table->setPrimaryKey(array("tag_id"));
         $table->addIndex(array('tag_user_context'));
         # vcolumn for counts
         $table->addVirtualColumn('tag_count', 'integer', array('unsigned' => true));
         return $table;
     });
     #------------------------------------------------------------------
     # Load the Tag Library API
     #
     #------------------------------------------------------------------
     $app[$this->index] = $app->share(function () use($app, $index) {
         # merge options with default struct
         $app[$index . '.options'] = array_replace(array('tableName' => 'quicktag_tags'), $app[$index . '.options']);
         $event = $app['dispatcher'];
         $monolog = $app['monolog'];
         $db = $app['db'];
         $meta = $app[$index . '.meta'];
         $tableName = $app[$index . '.options']['tableName'];
         $logBridge = new \QuickTag\Log\MonologBridge($monolog);
         $logSubscriber = new \QuickTag\Log\LogSubscriber($logBridge);
         $tagBuilder = new \QuickTag\Model\TagBuilder();
         # bind events to logbridge
         $event->addSubscriber($logSubscriber);
         $tagGateway = new \QuickTag\Model\TagGateway($tableName, $db, $event, $meta, null, $tagBuilder);
         $tagMapper = new \QuickTag\Model\TagMapper($event, $tagGateway);
         return new \QuickTag\Tag($event, $tagMapper);
     });
     #------------------------------------------------------------------
     # Load the Entity Formatters
     #
     #------------------------------------------------------------------
     $app[$this->index . '.tagFormatter'] = $app->share(function () {
         return new \QuickTag\Silex\Formatter\TagFormatter();
     });
 }
Esempio n. 3
0
 public function getMonitorTable()
 {
     $table = new Table($this->monitor_table);
     # setup pk
     $table->addColumn('monitor_id', 'integer', array("unsigned" => true, 'autoincrement' => true));
     $table->setPrimaryKey(array("monitor_id"));
     # date and hour
     $table->addColumn('monitor_dte', 'datetime', array());
     # add index
     $table->addUniqueIndex(array('monitor_dte'));
     # worker stats
     $table->addColumn('worker_max_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_min_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_throughput', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_max_throughput', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('worker_mean_utilization', 'float', array("unsigned" => true, 'notnull' => false));
     # queue stats
     $table->addColumn('queue_no_waiting_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_failed_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_error_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_completed_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_no_processing_jobs', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_mean_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_min_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('queue_max_service_time', 'integer', array("unsigned" => true, 'notnull' => false));
     $table->addColumn('monitor_complete', 'boolean', array('default' => false));
     return $table;
 }