* Refactor getLast method.
This commit is contained in:
@@ -122,7 +122,7 @@ class release extends control
|
||||
$this->view->productID = $productID;
|
||||
$this->view->builds = $builds;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
|
||||
$this->view->lastRelease = $this->release->getLast($productID, $branch);
|
||||
$this->view->lastRelease = $this->release->getLast($productID, (int)$branch);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -110,20 +110,20 @@ class releaseModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品下的最新创建的发布。
|
||||
* Get last release.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return bool | object
|
||||
* @return object|false
|
||||
*/
|
||||
public function getLast($productID, $branch = 0)
|
||||
public function getLast(int $productID, int $branch = 0): object|false
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_RELEASE)
|
||||
->where('product')->eq((int)$productID)
|
||||
->where('product')->eq($productID)
|
||||
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
|
||||
->orderBy('id DESC')
|
||||
->limit(1)
|
||||
->fetch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user