本文整理汇总了PHP中DBObject::mutator方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObject::mutator方法的具体用法?PHP DBObject::mutator怎么用?PHP DBObject::mutator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObject
的用法示例。
在下文中一共展示了DBObject::mutator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mutate
/**
* Attempts the mutation.
*
* If the mutation completes abnormally, previous mutators are aborted.
*
* Otherwise returns the results of the mutation.
*
*/
final function mutate($class, $name, $arguments)
{
$this->mutation_pointer[] = $name;
$result = DBObject::mutator($class, $name, $arguments)->activate();
if ($result) {
$mutation = new stdclass();
$mutation->result = $result;
$mutation->class = $class;
$mutation->name = $name;
$mutation->arguments = $arguments;
$this->mutated($mutation);
return $result;
} else {
$this->abort();
}
}
示例2: applyMutator
public final function applyMutator($name, $parameters = array(), $toString = "__toString")
{
$results = array();
while ($managed_object = $this->nextObject()) {
$value = DBObject::mutator($this->managed_object(), $name, array_merge(array($managed_object), (array) $parameters))->activate();
$key = call_user_func(array($managed_object, $toString));
$results[$key] = $value;
unset($managed_object);
}
return $results;
}
示例3: send
function send($html_mode = false)
{
if (Config::isLive() || Config::isStaging()) {
$mail = $this->getEmailer();
if ($this->send_as_html) {
//many mail servers break 8bit encoding by adding newlines, QP prevents that for ASCII-only emails (like this)
$mail->Encoding = "quoted-printable";
$mail->isHTML(true);
}
$mail->Subject = $this->getSubjectWithReplacements();
$mail->Body = $this->getBodyWithReplacements();
if (!$mail->Send()) {
error_log("ERROR: mail not sent: {$mail->ErrorInfo}");
return false;
} else {
if ($this->recordMember) {
Loader::load('model', 'com/htmlgraphic/history/Transaction');
DBObject::mutator('Transaction', 'RecordContactEmailSentAction', array($this, $this->recordMember))->activate();
}
}
return true;
} else {
//this is so you can see if you would have sent an email on a dev box
if ($this->recordMember) {
Loader::load('model', 'com/htmlgraphic/history/Transaction');
DBObject::mutator('Transaction', 'RecordContactEmailSentAction', array($this, $this->recordMember))->activate();
}
//error_log(print_r($this->recordMember,true));
Debugger::log("<span style='color: #fff;'>Subject:</span> " . $this->getSubjectWithReplacements() . "<br><br><span style='color: #fff;'>-----Body-----</span><br>" . $this->getBodyWithReplacements() . "<br><span style='color: #fff;'>-----Body-----</span>");
return true;
}
}