当前位置: 首页>>代码示例>>PHP>>正文


PHP R::inspect方法代码示例

本文整理汇总了PHP中RedBeanPHP\R::inspect方法的典型用法代码示例。如果您正苦于以下问题:PHP R::inspect方法的具体用法?PHP R::inspect怎么用?PHP R::inspect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanPHP\R的用法示例。


在下文中一共展示了R::inspect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editRota

 public function editRota(Request $request, Response $response, array $args)
 {
     $id = $this->authenticator->getIdentity();
     if (strtolower($id['name']) != 'admin') {
         $this->flash->addMessage('flash', 'Access Denied');
         return $response->withRedirect($this->router->pathFor('homepage'));
     }
     $name = $args['name'];
     if (empty($name)) {
         $this->flash->addMessage('flash', 'No rota specified');
         return $response->withRedirect($this->router->pathFor('rotas'));
     }
     if ($name != 'new') {
         $rota = R::findOrCreate('rotas', ['name' => $name]);
     } else {
         $rota = R::dispense('rotas');
     }
     if ($request->isPost()) {
         $data = $request->getParams();
         //$username = $request->getParam('username');
         $rota->import($data, 'name,fullname,title,comment');
         $rota->sharedUsersList = [];
         foreach ($data['users'] as $checkUserID) {
             $rotaUser = R::load('users', $checkUserID);
             $rota->sharedUsersList[] = $rotaUser;
         }
         $id = R::store($rota);
         try {
             $fieldtest = R::inspect($rota->name);
         } catch (\Exception $e) {
             //thaw for creation
             R::freeze(['users']);
             $rotaUser = R::load('users', 1);
             $rotaDay = R::findOrCreate($rota->name, ['day' => 29, 'month' => 2, 'year' => 2015]);
             $rotaUser = R::load('users', 1);
             $rotaDay->name = $rotaUser;
             $rotaDay->who = $rotaUser;
             $rotaDay->stamp = date("Y-m-d H:i:s");
             R::store($rotaDay);
             R::freeze(true);
         }
         $this->flash->addMessage('flash', "{$rota->name} updated");
         return $response->withRedirect($this->router->pathFor('rotas'));
     }
     $userList = R::findAll('users');
     $data = $rota->export();
     $data['userList'] = $userList;
     $users = [];
     $userRota = $rota->sharedUsersList;
     foreach ($userRota as $userCheck) {
         $users[$userCheck->id] = 'checked';
     }
     $data['userCheck'] = $users;
     $this->view->render($response, 'rota.twig', $data);
     return $response;
 }
开发者ID:aodkrisda,项目名称:oncallslim,代码行数:56,代码来源:RotaAction.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $database = $input->getOption('database');
     $table = $input->getArgument('table');
     $databaseConnection = $this->resolveConnection($io, $database);
     if ($table) {
         $this->redBean = $this->getRedBeanConnection($database);
         $tableInfo = $this->redBean->inspect($table);
         $tableHeader = [$this->trans('commands.database.table.debug.messages.column'), $this->trans('commands.database.table.debug.messages.type')];
         $tableRows = [];
         foreach ($tableInfo as $column => $type) {
             $tableRows[] = ['column' => $column, 'type' => $type];
         }
         $io->table($tableHeader, $tableRows);
         return 0;
     }
     $schema = $this->database->schema();
     $tables = $schema->findTables('%');
     $io->comment(sprintf($this->trans('commands.database.table.debug.messages.table-show'), $databaseConnection['database']));
     $io->table([$this->trans('commands.database.table.debug.messages.table')], $tables);
     return 0;
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:26,代码来源:TableDebugCommand.php

示例3: loadFieldsInfoFromDatabase

 private function loadFieldsInfoFromDatabase()
 {
     try {
         $this->fieldsInfoFromDatabase = R::inspect($this->tableName);
     } catch (Exception $ex) {
         $this->createTable();
         // Load again
         $this->loadFieldsInfoFromDatabase();
     }
 }
开发者ID:louislam,项目名称:louislam-crud,代码行数:10,代码来源:LouisCRUD.php


注:本文中的RedBeanPHP\R::inspect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。