ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10103


Ignore:
Timestamp:
Jan 12, 2009, 5:16:11 PM (12 years ago)
Author:
ogawa
Message:

#3417:added File:delete:pre behavior for updating hasImage flag

Location:
OpenPNE3/plugins/opDiaryPlugin/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opDiaryPlugin/trunk/config/config.php

    r9550 r10103  
    11<?php
    22$this->dispatcher->connect('routing.load_configuration', array('opDiaryPluginRouting', 'listenToRoutingLoadConfigurationEvent'));
     3
     4sfPropelBehavior::registerHooks('diary_delete_image', array(
     5  ':delete:pre' => array('opDiaryPluginBehavior', 'deleteDiaryImage'),
     6));
     7sfPropelBehavior::add('File', array('diary_delete_image' => array()));
  • OpenPNE3/plugins/opDiaryPlugin/trunk/lib/model/DiaryImage.php

    r10102 r10103  
    1111class DiaryImage extends BaseDiaryImage
    1212{
     13  protected $deleteFile = true;
     14
    1315  public function save(PropelPDO $con = null)
    1416  {
     
    2224  public function delete(PropelPDO $con = null)
    2325  {
    24     $this->getFile()->delete();
     26    if ($this->deleteFile)
     27    {
     28      $this->getFile()->delete();
     29    }
    2530
    2631    parent::delete($con);
     
    2833    $this->getDiary()->updateHasImages();
    2934  }
     35
     36  public function setDeleteFile($value)
     37  {
     38    $this->deleteFile = $value;
     39  }
    3040}
Note: See TracChangeset for help on using the changeset viewer.