本文整理汇总了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;
}
示例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;
}
示例3: loadFieldsInfoFromDatabase
private function loadFieldsInfoFromDatabase()
{
try {
$this->fieldsInfoFromDatabase = R::inspect($this->tableName);
} catch (Exception $ex) {
$this->createTable();
// Load again
$this->loadFieldsInfoFromDatabase();
}
}