本文整理汇总了PHP中Version::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::find方法的具体用法?PHP Version::find怎么用?PHP Version::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current_version
public function current_version()
{
try {
return Version::find('first', array('order' => 'created_at DESC', 'conditions' => array('package_id' => $this->id)));
} catch (NimbleRecordNotFound $e) {
return false;
}
}
示例2: testDeleteBobsPackage
public function testDeleteBobsPackage()
{
$_SERVER['SERVER_NAME'] = 'bob.localhost.com';
$count = Version::count();
$p = Package::find_by_name('bobs_other_package');
$v = Version::find('first', array('package_id' => $p->id, 'version' => '0.0.1'));
$this->delete('delete', array(), array('id' => $v->package_id, 'version' => $v->id), array('user' => User::find_by_username('bob')->id));
$this->assertEquals($count - 1, Version::count(array('cache' => false)));
$this->assertFalse(Version::exists('id', $v->id));
$this->assertRedirect(url_for('PackageController', 'show', $p->id));
}
示例3: Version
function _detectProjectId()
{
$project_id = null;
if (isset($this->controller->params['project_id'])) {
$project_id = $this->controller->params['project_id'];
}
if ($this->controller->name == 'Versions') {
$version_id = $this->controller->params['pass'][0];
App::uses('Version', 'Model');
$version = new Version();
$bind = array('belongsTo' => array('Project' => array('className' => 'Project')));
$version->bindModel($bind);
$version_row = $version->find('first', array('condtions' => array('id' => $version_id)));
$project_id = $version_row['Project']['identifier'];
}
return $project_id;
}
示例4: delete
public function delete()
{
$this->login_user();
try {
$package = Package::find($_GET['id']);
$version = Version::find($_GET['version']);
} catch (NimbleRecordNotFound $e) {
$this->redirect_to('/');
}
if ($version->package_id == $package->id && $package->user_id == $this->user->id) {
$file = $package->file_path($version->version);
@unlink($file);
Nimble::flash('notice', "Version: {$version->version} was deleted");
$version->delete();
$this->redirect_to(url_for('PackageController', 'show', $package->user->username, $package->name));
} else {
$this->redirect_to('/');
}
}
示例5: index
/**
* index
*/
public function index()
{
switch ($this->format) {
case 'xml':
if ($this->user->active == 0) {
exit;
}
$this->layout = false;
$this->render('channel/index.xml');
$this->header('Content-Type: text/xml', 200);
$this->current_version = Version::find('first', array('select' => 'versions.*', 'joins' => 'INNER JOIN packages on versions.package_id = packages.id INNER JOIN users ON users.id = packages.user_id', 'order' => 'versions.version DESC'));
$date = DateHelper::from_db($this->current_version->created_at);
$date = date(DATE_RFC822, $date);
$this->header("Last-Modified: {$date}");
break;
default:
$this->packages = $this->user->packages;
$this->header('Content-Type: text/html', 200);
break;
}
}
示例6: compare
public function compare()
{
//$this->output->enable_profiler(true);
$this->load->model('Version');
$this->form_validation->set_rules('version_before', 'Version', 'required|integer');
$this->form_validation->set_rules('version_after', 'Version', 'required|integer');
$data = array();
if ($this->form_validation->run() === true) {
$version_before = Version::find($this->input->post('version_before'));
$version_after = Version::find($this->input->post('version_after'));
if ($version_before !== false && $version_after !== false) {
$comparison = $version_after->compare_to($version_before);
/*
echo '<pre>';
var_dump($comparison);
echo '</pre>';
*/
$data['comparison'] = $comparison;
}
}
$this->layout->add_basic_assets()->menu()->action_view($data);
}
示例7: load_release
private function load_release()
{
$this->package = Package::find('first', array('conditions' => array('name' => $_GET['name'], 'user_id' => $this->user->id)));
$date = DateHelper::from_db($this->package->updated_at);
$date = date(DATE_RFC822, $date);
$this->header("Last-Modified: {$date}");
$this->version = Version::find('first', array('conditions' => array('version' => $_GET['version'], 'package_id' => $this->package->id)));
$this->data = unserialize($this->version->meta);
}
示例8: tag
public function tag()
{
if (empty($_GET['url'])) {
exit;
}
# TODO
$versions = Version::find(array("placeholders" => true, "where" => array("tags like" => "%: \"" . $_GET['url'] . "\"\n%")));
$this->display("extend/tag", array("versions" => new Paginator($versions, 25), "tag" => fix($_GET['url'])), fix(_f("Versions tagged with \"%s\"", $_GET['url'], "extend")));
}
示例9: storeLink
/**
* Links a plugin to an application
* GET /application/{appid}/link
*
* @param int $appid
* @return Response
*/
public function storeLink($appid, $pluginid)
{
intval($pluginid);
intval($appid);
$rules = ['version' => 'required|integer'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator->messages());
}
if (Version::find(Input::get('version')) && Application::find($appid)) {
Application::find($appid)->versions()->attach(Input::get('version'));
return Redirect::action('application.show', [$appid])->withSuccess('Plugin connected.');
} else {
return Redirect::action('application.index')->withErrors(['Version or application does not exist.']);
}
}
示例10: load_release
private function load_release()
{
$this->package = Package::find('first', array('conditions' => array('name' => $_GET['name'], 'user_id' => $this->user->id)));
$this->version = Version::find('first', array('conditions' => array('version' => $_GET['version'], 'package_id' => $this->package->id)));
$this->data = unserialize($this->version->meta);
}
示例11: destroy
/**
* Remove the specified resource from storage.
* DELETE /version/{id}
*
* @param int $id
* @return Response
*/
public function destroy($pluginid, $versionid)
{
intval($versionid);
intval($versionid);
Version::find($versionid)->delete();
return Redirect::action('PluginController@show', [$pluginid])->withSuccess('Version removed.');
}