本文整理汇总了PHP中AppModel::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::afterSave方法的具体用法?PHP AppModel::afterSave怎么用?PHP AppModel::afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::afterSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave($created)
{
parent::afterSave($created);
Cache::delete('blog_archives');
Cache::delete('blog_categories');
Cache::delete('blog_tags');
}
示例2: afterSave
function afterSave($created)
{
$results = parent::afterSave($created);
$acts = array();
$minRange = 0;
App::import('Lib', 'SetMulti');
foreach ($this->updateActions as $name => $act) {
if (SetMulti::testCond($act['event'], $this)) {
$acts[$name] = $act;
$minRange = max($minRange, $act['range']);
}
}
//debug($acts);
//debug($minRange);
if (!empty($acts)) {
$pos = $this->getPos();
//debug($pos);
$this->updateTilesRect($pos['x'] - $minRange * 2, $pos['y'] - $minRange * 2, $pos['zone_id'], $minRange * 4 + 1, $minRange * 4 + 1, $acts);
//return false;
}
if ($created) {
if (empty($pos)) {
$pos = $this->getPos();
}
$this->checkChunkUpdater($pos['x'], $pos['y'], $pos['zone_id']);
}
return $results;
}
示例3: afterSave
function afterSave($created)
{
parent::afterSave($created);
$barra_lateral = null;
$posicao_menu = null;
$tamanho = 'grande';
// die($this->data['Configuracao']['pin']);
if ($this->data['Configuracao']['pin'] == 'usa_barra_lateral') {
$barra_lateral = $this->data['Configuracao']['conteudo'];
$registro = $this->find('first', array('conditions' => array('pin' => 'posicao_menu')));
$posicao_menu = $registro['Configuracao']['conteudo'];
} elseif ($this->data['Configuracao']['pin'] == 'posicao_menu') {
$posicao_menu = $this->data['Configuracao']['conteudo'];
$registro = $this->find('first', array('conditions' => array('pin' => 'usa_barra_lateral')));
$barra_lateral = $registro['Configuracao']['conteudo'];
}
// die($barra_lateral . ' --- ' . $posicao_menu);
if (!is_null($posicao_menu) && !is_null($barra_lateral)) {
if ($posicao_menu == 1 && $barra_lateral || $posicao_menu == 2 && !$barra_lateral) {
$tamanho = 'medio';
} elseif ($posicao_menu == 2 && $barra_lateral) {
$tamanho = 'pequeno';
}
$tamanho_centro = $this->find('first', array('conditions' => array('pin' => 'tamanho_centro')));
// die($tamanho);
$tamanho_centro['Configuracao']['conteudo'] = $tamanho;
$this->save($tamanho_centro);
}
return true;
}
示例4: afterSave
public function afterSave($created, $options = array())
{
parent::afterSave($created, $options);
if (isset($this->data["Combination"]['Combination'][0])) {
$x = $this->Combination->find("first", array("conditions" => array("Combination.id" => $this->data["Combination"]['Combination'][0])));
$x2 = $this->Combination->find("all", array("contain" => false, "conditions" => array("Combination.reviewkey" => $x['Combination']['reviewkey']), "fields" => array("id")));
foreach ($x2 as $v) {
App::uses("CombinationsReview", "Model");
$a = new CombinationsReview();
$a->create();
if (!$a->hasAny(array("CombinationsReview.combination_id" => $v['Combination']['id'], "CombinationsReview.review_id" => $this->getLastInsertID()))) {
$a->save(array("CombinationsReview" => array('combination_id' => $v['Combination']['id'], 'review_id' => $this->getLastInsertID())));
}
}
} elseif ($this->data["Review"]['combination_reviewkey']) {
$x2 = $this->Combination->find("all", array("contain" => false, "conditions" => array("Combination.reviewkey" => $this->data["Review"]['combination_reviewkey']), "fields" => array("id")));
foreach ($x2 as $v) {
App::uses("CombinationsReview", "Model");
$a = new CombinationsReview();
$a->create();
if (!$a->hasAny(array("CombinationsReview.combination_id" => $v['Combination']['id'], "CombinationsReview.review_id" => $this->getLastInsertID()))) {
$a->save(array("CombinationsReview" => array('combination_id' => $v['Combination']['id'], 'review_id' => $this->getLastInsertID())));
}
}
}
}
示例5: afterSave
function afterSave($created)
{
parent::afterSave($created);
if ($created) {
$this->updatePathing();
}
}
示例6: afterSave
public function afterSave($created)
{
parent::afterSave($created);
if ($this->id) {
Cache::delete('getPracticeTitleById' . $this->id);
}
}
示例7: afterSave
public function afterSave($created)
{
$question_id = $this->getLastInsertID() ? $this->getLastInsertID() : $this->id;
if (isset($this->data['SaveAnswer']['content']) && !empty($this->data['SaveAnswer']['content'])) {
//delete old answer
$this->Answer->deleteAll(array('Answer.question_id' => $question_id));
$rightAnswer_Index = Set::extract("/right_answer", $this->data['SaveAnswer']);
//
$answerData = null;
$right_answer = null;
$idx = 0;
foreach ($this->data['SaveAnswer']['content'] as $answer) {
if (!$answer) {
continue;
}
$this->data['Answer']['question_id'] = $question_id;
$this->data['Answer']['content'] = $answer;
$this->Answer->save($this->data['Answer']);
if (in_array($idx, $this->data['SaveAnswer']['right_answer'])) {
$right_answer = $this->Answer->getLastInsertID() ? $this->Answer->getLastInsertID() : $this->Answer->id;
}
$this->Answer->id = false;
$idx++;
}
$question['Question']['id'] = $question_id;
$question['Question']['right_answer'] = $right_answer;
$this->saveAll($question['Question'], array('validate' => false));
}
parent::afterSave($created);
}
示例8: afterSave
public function afterSave($created, $options = array())
{
parent::afterSave($created, $options);
if (AuthComponent::user()) {
App::uses('CakeSession', 'Model/Datasource');
CakeSession::write('Auth', $this->findById(AuthComponent::user('id')));
}
return true;
}
示例9: afterSave
public function afterSave($created, $options = array())
{
parent::afterSave($created, $options);
if (!empty($this->data[$this->alias]['movefile'])) {
$path = $this->data[$this->alias]['movefile']['tmp_name'];
$destination = "files/splash/" . $this->data[$this->alias]['movefile']['name'];
move_uploaded_file($path, $destination);
}
}
示例10: afterSave
public function afterSave($created)
{
if ($created) {
$this->data['Subscription']['id'] = $this->id;
$this->Feed->id = $this->data['Subscription']['feed_id'];
$this->Feed->updateSubscribersCount();
}
parent::afterSave($created);
}
示例11: afterSave
public function afterSave($options = null)
{
parent::afterSave($options);
switch ($this->alias) {
case "Feed":
$this->save_feeds_authors($this->data);
break;
}
return true;
}
示例12: afterSave
public function afterSave($created)
{
$id = $this->id;
$_SERVER['FORCEMASTER'] = true;
$post = $this->returnPost(array("Dailyop.id" => $id), true, true);
//make the keywords
$s = $this->extractSearchValues($post);
$SearchItem = ClassRegistry::init("SearchItem");
$SearchItem->insertItem($s);
return parent::afterSave();
}
示例13: afterSave
function afterSave($created)
{
$results = parent::afterSave($created);
if (!in_array($this->data['Event']['event_type_id'], array(15, 22))) {
$eventType = $created ? 22 : 15;
$eventOption = array('name' => $eventType, 'aros' => $this->data['Event']['aro_id'], 'acos' => $this->data['Event']['aco_id'], 'bindedEvent' => $this->unserialize($this->data), 'phase' => 2, 'strict' => false);
//debug($eventOption);
$this->dispatchEvent($eventOption);
}
return $results;
}
示例14: afterSave
function afterSave($created)
{
if (!empty($this->data) && $created) {
// if the event is created, NOT merely updated!
$event = $this->data['Event'];
$e_id = $this->id;
if (array_key_exists('summary', $event) && !empty($event['summary'])) {
$this->addtotimeline(array('summary' => $event['summary'], 'uid' => $event['uid'], 'start_time' => $event['start_time'], 'end_time' => $event['end_time']), null, 'timelineevent-newevent', null, 'Event', $e_id);
}
}
parent::afterSave($created);
}
示例15: afterSave
public function afterSave($created, $options = array())
{
parent::afterSave($created, $options);
if ($this->data[$this->alias]['id'] == AuthComponent::user('id')) {
if (isset($this->data[$this->alias]['password'])) {
unset($this->data[$this->alias]['password']);
}
$newData = array_merge(AuthComponent::user(), $this->data[$this->alias]);
App::uses('SessionComponent', 'Controller/Component');
CakeSession::write(AuthComponent::$sessionKey, $newData);
}
if ($created) {
$event = new CakeEvent('Model.User.add', $this);
$this->getEventManager()->dispatch($event);
}
}