public function set_charge(OpenpearCharge $charge) { $this->handlename($charge->maintainer()->name()); $this->name(str($charge->maintainer())); $this->mail($charge->maintainer()->mail()); $this->role($charge->role()); return $this; }
/** * 参加しているパッケージリストを取得 * @return array OpenpearPackage[] **/ public function packages() { return OpenpearCharge::packages($this); }
/** * パッケージにメンテナを追加する * @param string $package_name 追加するパッケージ名 * @request string $maintainer_name メンテナ名 */ public function package_add_maintainer($package_name) { if ($this->is_post() && $this->is_vars('maintainer_name')) { try { $package = C(OpenpearPackage)->find_get(Q::eq('name', $package_name)); $maintainer = C(OpenpearMaintainer)->find_get(Q::eq('name', $this->in_vars('maintainer_name'))); $package->permission($this->user()); $charge = new OpenpearCharge(); $charge->maintainer_id($maintainer->id()); $charge->package_id($package->id()); $charge->role($this->in_vars('role', 'lead')); $charge->save(); } catch (NotfoundDaoException $e) { $this->not_found(); } catch (Exception $e) { Log::debug($e); } } $this->redirect_by_map('package_manage', $package_name); }
/** * メンテナを追加する * @param OpenpearMaintainer $maintainer * @param string $role * @return void **/ public function add_maintainer(OpenpearMaintainer $maintainer, $role = 'lead') { $charge = new OpenpearCharge(); $charge->maintainer_id($maintainer->id()); $charge->package_id($this->id()); $charge->role($role); $charge->save(); }