本文整理汇总了PHP中Domain::setAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::setAccount方法的具体用法?PHP Domain::setAccount怎么用?PHP Domain::setAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::setAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doAddDomain
/**
* @param Domain $domain The domain object to add.
*/
protected function doAddDomain($domain)
{
$this->collDomains[] = $domain;
$domain->setAccount($this);
}
示例2: do_update
/**
* Updates a domain
*
* @param int $intId
* @param array $arrData
* @return int The domain ID
*/
public function do_update($intId, $arrData)
{
$domain = null;
$con = Propel::getConnection();
if (!$con->beginTransaction()) {
throw new Exception('Could not start transaction.');
}
try {
$user = $this->requireUser();
$account = $user->getAccount($con);
// Validate input data
$validator = new KickstartValidator();
$locale = Localizer::getInstance();
$warnings = $validator->filterErrors($arrData, $this->initFilter($this->filter_basic, $locale));
if ($warnings) {
$con->rollBack();
return array('result' => false, 'warnings' => $warnings);
}
$query = DomainQuery::create()->filterByAccount($account);
if ($intId !== null) {
$domain = DomainQuery::create()->filterByAccount($account)->findOneById($intId, $con);
if ($domain === null) {
throw new Exception('Domain not found; ID: ' . $intId);
}
$query->filterById($intId, Criteria::NOT_EQUAL);
} else {
$domain = new Domain();
$domain->setAccount($account);
}
// Check for duplicates
if ($query->findOneByName($arrData['Name'], $con)) {
throw new Exception($locale->insert('error.taken', array('value' => '"' . $arrData['Name'] . '"')));
}
$domain->fromArray(array_intersect_key($arrData, array('AddressId' => true, 'Name' => true, 'Description' => true, 'Number' => true)));
$domain->save($con);
if (!empty($arrData['Properties'])) {
$domain->setProperties($arrData['Properties'], $con);
}
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
if (!$con->commit()) {
throw new Exception('Could not commit transaction.');
}
return $domain->getId();
}