本文整理汇总了PHP中Nette\Database\Connection::table方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::table方法的具体用法?PHP Connection::table怎么用?PHP Connection::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Database\Connection
的用法示例。
在下文中一共展示了Connection::table方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTable
/**
* @param string $tableName
* @return Nette\Database\Table\Selection
*/
protected function getTable($tableName = NULL)
{
if ($tableName == NULL) {
// table name from class name
preg_match('#(\\w+)Repository$#', get_class($this), $m);
$tableName = lcfirst($m[1]);
}
return $this->database->table($tableName);
}
示例2: authenticate
/**
* Performs an authentication.
* @return Nette\Security\Identity
* @throws Nette\Security\AuthenticationException
*/
public function authenticate(array $credentials)
{
list($username, $password) = $credentials;
$row = $this->database->table('user')->where('username', $username)->fetch();
if (!$row) {
throw new Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
}
if (!$this->checkPassword($row->password, $password)) {
throw new Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
}
$roles = $this->database->table('permission')->where('user_id', $row->id)->fetchPairs('server_id', 'role');
$arr = array('username' => $row->username, 'serverRoles' => $roles);
if ($row->role == 'admin') {
return new Nette\Security\Identity($row->id, 'admin', $arr);
} else {
return new Nette\Security\Identity($row->id, 'player', $arr);
}
}
示例3: log
/**
* Log
*
* @param string $type
* @param string $message
*/
private function log($type, $message = NULL)
{
$selection = $this->connection->table('logs');
$selection->insert(array('datetime' => date("Y-m-d H:i:s"), 'type' => $type, 'message' => $message));
if ($this->debug) {
echo date("Y-m-d H:i:s.") . substr(microtime(TRUE) - time() . "", 2, 4) . " @ " . $type . " # " . $message . "\n";
if (!defined('STDIN')) {
//Next code is realy FUCKING hack
@ob_end_flush();
@ob_flush();
@flush();
@ob_start();
}
}
}
示例4: getTable
/**
* Vrací celou tabulku z databáze
* @return \Nette\Database\Table\Selection
*/
protected function getTable()
{
return $this->connection->table($this->tableName);
}
示例5: getTable
/**
* Vrací objekt reprezentující databázovou tabulku.
* @return Nette\Database\Table\Selection
*/
protected function getTable()
{
// název tabulky odvodíme z názvu třídy
preg_match('#(\\w+)Repository$#', get_class($this), $m);
return $this->context->table(lcfirst($m[1]));
}
示例6: registerUser
public function registerUser(array $values)
{
// todo validate values
$this->database->table('users')->insert($values);
}