本文整理汇总了PHP中AIR2_Record::postInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP AIR2_Record::postInsert方法的具体用法?PHP AIR2_Record::postInsert怎么用?PHP AIR2_Record::postInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIR2_Record
的用法示例。
在下文中一共展示了AIR2_Record::postInsert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postInsert
/**
* Post-insert hook to log an activity for "manual-entry" submissions.
* (Can't use regular AIR2Logger, since we need the postInsert xid).
*
* @param DoctrineEvent $event
*/
public function postInsert($event)
{
parent::postInsert($event);
// only manual-entries, and only if requestion
if ($this->srs_type != self::$TYPE_MANUAL_ENTRY) {
return;
}
if (!self::$LOG_MANUAL_ENTRY) {
return;
}
// figure out what type of entry this is
$actm_id = false;
foreach (Inquiry::$MANUAL_TYPES as $code => $config) {
if ($this->SrcResponse[0]->sr_orig_value == $config['label']) {
$actm_id = $config['actm'];
break;
}
}
// find project id
$prj_id = false;
if (count($this->Inquiry->ProjectInquiry) > 0) {
$prj_id = $this->Inquiry->ProjectInquiry[0]->pinq_prj_id;
}
// only log if the type matched something
if ($actm_id && $prj_id) {
$sact = new SrcActivity();
$sact->sact_src_id = $this->srs_src_id;
$sact->sact_actm_id = $actm_id;
$sact->sact_prj_id = $prj_id;
$sact->sact_dtim = $this->srs_date;
$sact->sact_desc = '{USER} entered {XID} for source {SRC}';
$sact->sact_notes = null;
$sact->sact_xid = $this->srs_id;
$sact->sact_ref_type = SrcActivity::$REF_TYPE_RESPONSE;
$sact->save();
}
}
示例2: postInsert
/**
* Make sure new Organizations get default projects
*
* @param Doctrine_Event $event
*/
public function postInsert($event)
{
if (self::$CREATE_DEFAULT_PRJ && $this->org_default_prj_id == 1 && $this->org_type != 'T') {
$p = new Project();
$p->prj_name = air2_urlify($this->org_name);
$p->prj_display_name = 'Project ' . $this->org_display_name;
$p->prj_desc = 'Default project for organization "' . $this->org_display_name . '"';
$p->ProjectOrg[0]->porg_org_id = $this->org_id;
$p->ProjectOrg[0]->porg_contact_user_id = $this->org_cre_user;
// make sure prj_name is unique
$count = 0;
$orig = $p->prj_name;
$tbl = Doctrine::getTable('Project');
$name = $tbl->findOneBy('prj_name', $p->prj_name);
while ($name) {
$p->prj_name = $orig . '_' . $count;
$name = $tbl->findOneBy('prj_name', $p->prj_name);
}
// save, and make default
$p->save();
$this->org_default_prj_id = $p->prj_id;
$this->save();
}
parent::postInsert($event);
}