* Add Associat function
This commit is contained in:
+31
-3
@@ -209,9 +209,6 @@ class gitlabModel extends model
|
||||
return array_key_exists($gitlabID, $projectID) ? $this->gitlab->getProjectPairs($gitlabID)[$projectID]: "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get gitlab api base url with access_token
|
||||
*
|
||||
@@ -227,6 +224,37 @@ class gitlabModel extends model
|
||||
return $gitlab_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create relationship between zentao product and gitlab project.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createAssociat($products, $gitlabID, $projectID)
|
||||
{
|
||||
$gitlabNamespace = $this->getProjectPairs($gitlabID);
|
||||
|
||||
$gitlabAssociat = new stdclass;
|
||||
$gitlabAssociat->execution = 0;
|
||||
$gitlabAssociat->AVersion = 0;
|
||||
$gitlabAssociat->relation = 'interrated';
|
||||
$gitlabAssociat->BVersion = 0;
|
||||
$gitlabAssociat->extra = 0;
|
||||
|
||||
foreach($products as $index => $prodcuct)
|
||||
{
|
||||
$gitlabAssociat->BType = $gitlabNamespace[$gitlabID];
|
||||
$gitlabAssociat->BID = $gitlabID;
|
||||
$gitlabAssociat->Project = $ProjectID;;
|
||||
$gitlabAssociat->Product = $product;
|
||||
|
||||
$this->dao->insert(TABLE_RELATION)->data($gitlabAssociat)->exec();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create webhook for zentao.
|
||||
*
|
||||
|
||||
@@ -233,7 +233,8 @@ class repoModel extends model
|
||||
{
|
||||
$this->loadModel("gitlab")->initLabels($this->post->gitlabHost, $this->post->gitlabProject);
|
||||
|
||||
// save the relationship between zentao product and gitlab project to zt_relation table.
|
||||
/* save the relationship between zentao product and gitlab project to zt_relation table.*/
|
||||
$this->loadModel("gitlab")->createAssociat($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
|
||||
/* create webhook for zentao */
|
||||
$this->loadModel("gitlab")->createWebhook($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
|
||||
Reference in New Issue
Block a user