本文整理汇总了PHP中Domain::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::setType方法的具体用法?PHP Domain::setType怎么用?PHP Domain::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAdd
/**
* Add
*/
public function executeAdd()
{
if ($this->isGET()) {
return $this->renderJson(array("success" => false, "info" => "POST only."));
} else {
$name = $this->getRequestParameter('name');
$domain = new Domain();
$domain->setName($name);
$domain->setType($this->template->getType());
$domain->save();
foreach ($this->template->getTemplateRecords() as $tr) {
$record = new Record();
$record->setDomainId($domain->getId());
$record->setName(str_replace("%DOMAIN%", $name, $tr->getName()));
$record->setType($tr->getType());
if ($tr->getType() == 'SOA') {
$content = str_replace("%DOMAIN%", $name, $tr->getContent());
$content = str_replace("%SERIAL%", date("Ymd") . "01", $content);
} else {
$content = $tr->getContent();
}
$record->setContent($content);
$record->setTtl($tr->getTtl());
$record->setPrio($tr->getPrio());
$record->save();
}
return $this->renderJson(array("success" => true, "info" => "Domain added."));
}
}
示例2: setTypeFromString
/**
* Set the column type from a string property
* (normally a string from an sql input file)
*
* @deprecated Do not use; this will be removed in next release.
*/
public function setTypeFromString($typeName, $size)
{
$tn = strtoupper($typeName);
$this->setType($tn);
if ($size !== null) {
$this->size = $size;
}
if (strpos($tn, "CHAR") !== false) {
$this->domain->setType(PropelTypes::VARCHAR);
} elseif (strpos($tn, "INT") !== false) {
$this->domain->setType(PropelTypes::INTEGER);
} elseif (strpos($tn, "FLOAT") !== false) {
$this->domain->setType(PropelTypes::FLOAT);
} elseif (strpos($tn, "DATE") !== false) {
$this->domain->setType(PropelTypes::DATE);
} elseif (strpos($tn, "TIME") !== false) {
$this->domain->setType(PropelTypes::TIMESTAMP);
} elseif (strpos($tn, "BINARY") !== false) {
$this->domain->setType(PropelTypes::LONGVARBINARY);
} else {
$this->domain->setType(PropelTypes::VARCHAR);
}
}