本文整理汇总了PHP中Collection::bindType方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::bindType方法的具体用法?PHP Collection::bindType怎么用?PHP Collection::bindType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection::bindType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActiveBots
public function getActiveBots()
{
$sql = "SELECT id, queue_id, job_id\n\t\t\t\tFROM bots\n\t\t\t\tWHERE oauth_token_id = ?\n\t\t\t\tAND status != 'retired'\n\t\t\t\tORDER BY name";
$bots = new Collection($sql, array($this->id));
$bots->bindType('id', 'Bot');
$bots->bindType('queue_id', 'Queue');
$bots->bindType('job_id', 'Job');
return $bots;
}
示例2: pretty
public function pretty()
{
$this->assertAdmin();
$this->setTitle("Latest Completed Jobs");
$sql = "SELECT id, webcam_image_id FROM jobs WHERE webcam_image_id != 0 AND status = 'complete' ORDER BY finished_time DESC";
$available = new Collection($sql);
$available->bindType('id', 'Job');
$available->bindType('webcam_image_id', 'StorageInterface');
$this->set('jobs', $available->getRange(0, 24));
}
示例3: byContentAndType
public static function byContentAndType($id, $type)
{
if (!array_key_exists($type, self::$types)) {
$comments = Collection::none();
} else {
//look up the comments
$sql = "SELECT id, user_id\n\t\t\t\tFROM comments\n\t\t\t\tWHERE content_id = ?\n\t\t\t\tAND content_type = ?\n\t\t\t\tORDER BY comment_date ASC\n\t\t\t";
$comments = new Collection($sql, array($id, $type));
}
$comments->bindType('id', 'Comment');
$comments->bindType('user_id', 'User');
return $comments;
}
示例4: byContentAndType
public static function byContentAndType($id, $type)
{
//some validation
$id = (int) $id;
if (!in_array($type, array('job', 'bot'))) {
return new Comment();
}
//look up the comments
$sql = "SELECT id, user_id\n\t\t\t\tFROM comments\n\t\t\t\tWHERE content_id = ?\n\t\t\t\tAND content_type = ?\n \t\tORDER BY comment_date ASC\n\t\t\t";
$comments = new Collection($sql, array($id, $type));
$comments->bindType('id', 'Comment');
$comments->bindType('user_id', 'User');
return $comments;
}
示例5: getChildren
public function getChildren()
{
$sql = "SELECT id\n\t\t \tFROM s3_files\n\t\t \tWHERE parent_id = ?\n\t\t \tORDER BY id DESC";
$children = new Collection($sql, array($this->id));
$children->bindType('id', get_class($this));
return $children;
}
示例6: getStream
public static function getStream(User $user)
{
$sql = "SELECT id\n\t\t\t\tFROM activities\n\t\t\t\tWHERE user_id = ?\n\t\t\t\tORDER BY id DESC\n\t\t\t";
$stream = new Collection($sql, array($user->id));
$stream->bindType('id', 'Activity');
return $stream;
}
示例7: getSliceJobs
public function getSliceJobs()
{
$sql = "SELECT id\n \t\tFROM slice_jobs\n \t\tWHERE slice_config_id = ?\n \t\tORDER BY id DESC";
$sliceJobs = new Collection($sql, array($this->id));
$sliceJobs->bindType('id', 'SliceJob');
return $sliceJobs;
}
示例8: getStream
public static function getStream(User $user)
{
$sql = "SELECT activity, action_date\n\t\t\t\tFROM activities\n\t\t\t\tWHERE user_id = ?\n\t\t\t\tORDER BY id DESC\n\t\t\t";
$stream = new Collection($sql, array($user->id));
$stream->bindValue('activity');
$stream->bindType('action_date', 'DateTime');
$stream->bindData('user_link', $user->getLink());
return $stream;
}
示例9: getMine
public static function getMine($all = false)
{
if (User::isLoggedIn()) {
$sql = "SELECT id FROM notifications WHERE id > ? AND (to_user_id = ? or to_user_id IS NULL)";
$data = array();
if ($all === false) {
$data[] = User::$me->get('last_notification');
} else {
$data[] = 0;
// Get all of them
}
$data[] = User::$me->id;
$notifications = new Collection($sql, $data);
$notifications->bindType('id', 'Notification');
return $notifications;
} else {
// Return empty collection
return Collection::none();
}
}
示例10: live
public function live()
{
$this->assertAdmin();
$this->setTitle("Live Bots View");
$sql = "SELECT id, queue_id, job_id FROM bots WHERE webcam_image_id != 0 AND last_seen > NOW() - 3600 ORDER BY last_seen DESC";
$bots = new Collection($sql);
$bots->bindType('id', 'Bot');
$bots->bindType('queue_id', 'Queue');
$bots->bindType('job_id', 'Job');
$this->set('bots', $bots->getRange(0, 24));
$this->set('dashboard_style', 'medium_thumbnails');
}
示例11: getErrorLog
public function getErrorLog()
{
$sql = "SELECT id\n\t\t \tFROM error_log\n\t\t \tWHERE bot_id = ?\n\t\t \tORDER BY error_date DESC";
$logs = new Collection($sql, array($this->id));
$logs->bindType('id', 'ErrorLog');
return $logs;
}
示例12: getMyConfigs
public function getMyConfigs()
{
$sql = "SELECT id\n\t\t \tFROM slice_configs\n\t\t \tWHERE engine_id = ?\n\t\t \tAND (user_id = ? OR id = ?)\n\t\t \tORDER BY config_name";
$configs = new Collection($sql, array($this->id, User::$me->id, $this->get('default_config_id')));
$configs->bindType('id', 'SliceConfig');
return $configs;
}
示例13: getJobsRequiringAction
public static function getJobsRequiringAction()
{
$sql = "SELECT id, input_id, job_id\n\t\t \tFROM slice_jobs\n\t\t \tWHERE status = 'pending'\n\t\t \tORDER BY finish_date ASC";
$jobs = new Collection($sql);
$jobs->bindType('id', 'SliceJob');
$jobs->bindType('input_id', STORAGE_METHOD);
$jobs->bindType('job_id', 'Job');
return $jobs;
}
示例14: getApps
public function getApps()
{
$sql = "SELECT id\n\t\t\t\tFROM oauth_token\n\t\t\t\tWHERE consumer_id = ?\n\t\t\t\tAND user_id = ?";
$apps = new Collection($sql, array($this->id, User::$me->id));
$apps->bindType('id', 'OAuthToken');
return $apps;
}
示例15: getMySliceConfigs
public function getMySliceConfigs()
{
$sql = "SELECT id, engine_id\n\t\t\t\tFROM slice_configs\n\t\t\t\tWHERE user_id = ?\n\t\t\t\tORDER BY engine_id DESC";
$configs = new Collection($sql, array($this->id));
$configs->bindType('id', 'SliceConfig');
$configs->bindType('engine_id', 'SliceEngine');
return $configs;
}