示例#1
0
 /**
  * Returns the POST response
  *
  * @param \PSX\Data\RecordInterface $record
  * @param \PSX\Api\Version $version
  * @return array|\PSX\Data\RecordInterface
  */
 protected function doCreate(RecordInterface $record, Version $version)
 {
     $this->tableManager->getTable('Fusio\\Impl\\Backend\\Table\\Action')->create(array('status' => Action::STATUS_ACTIVE, 'name' => $record->getName(), 'class' => $record->getClass(), 'config' => $record->getConfig()->getRecordInfo()->getData(), 'date' => new \DateTime()));
     return array('success' => true, 'message' => 'Action successful created');
 }
示例#2
0
文件: Entity.php 项目: uqiauto/fusio
 /**
  * Returns the PUT response
  *
  * @param \PSX\Data\RecordInterface $record
  * @param \PSX\Api\Version $version
  * @return array|\PSX\Data\RecordInterface
  */
 protected function doUpdate(RecordInterface $record, Version $version)
 {
     $connectionId = (int) $this->getUriFragment('connection_id');
     $connection = $this->tableManager->getTable('Fusio\\Impl\\Backend\\Table\\Connection')->get($connectionId);
     if (!empty($connection)) {
         $this->tableManager->getTable('Fusio\\Impl\\Backend\\Table\\Connection')->update(array('id' => $connection->getId(), 'name' => $record->getName(), 'class' => $record->getClass(), 'config' => $record->getConfig()->getRecordInfo()->getData()));
         return array('success' => true, 'message' => 'Connection successful updated');
     } else {
         throw new StatusCode\NotFoundException('Could not find connection');
     }
 }