Development

Changeset 8655

You must first sign up to be able to contribute.

Changeset 8655

Show
Ignore:
Timestamp:
04/28/08 17:54:35 (5 years ago)
Author:
trivoallan
Message:

sfPropelNotificationPlugin :

  • added setBeforeSave() and getBeforeSave() methods to public API
  • fixed some documentation quirks
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelNotificationPlugin/trunk/README

    r8654 r8655  
    4646#!php 
    4747<?php 
    48 $this->getUser()->setAttribute('uid', $id, 'sfPropelNotificationPlugin'); 
    49 $this->getUser()->setAttribute('peer_class', 'UserPeer', 'sfPropelNotificationPlugin'); 
    50 }}} 
     48$user->setAttribute('uid', $id, 'sfPropelNotificationPlugin'); 
     49$user->setAttribute('peer_class', 'UserPeer', 'sfPropelNotificationPlugin'); 
     50}}} 
     51 
     52=== Update model === 
     53 
     54 * Enable behaviors in project's `propel.ini` 
     55 * Rebuild model : `propel-build-all` 
    5156 
    5257== Usage == 
     
    268273=== trunk === 
    269274 
     275==== 2008-04-28 ==== 
     276 * added setBeforeSave() and getBeforeSave() methods to public API 
     277 * changed svn repository layout in order to enabled branched development 
     278 * fixed some documentation quirks 
     279 
     280==== Sometime before ==== 
    270281 * removed hardcoded "User" model 
    271282 * wrote installation docs 
  • plugins/sfPropelNotificationPlugin/trunk/config/config.php

    r3560 r8655  
    1919  'setWasNew'         => array('sfPropelNotificationBehavior', 'setWasNew'), 
    2020  'getWasNew'         => array('sfPropelNotificationBehavior', 'getWasNew'), 
     21  'setBeforeSave'     => array('sfPropelNotificationBehavior', 'setBeforeSave'), 
     22  'getBeforeSave'     => array('sfPropelNotificationBehavior', 'getBeforeSave'), 
    2123)); 
  • plugins/sfPropelNotificationPlugin/trunk/lib/behavior/sfPropelNotificationBehavior.class.php

    r3560 r8655  
    2222 
    2323  /** 
    24    * This hook to keep object "novelty" once it is saved. 
     24   * This hook to keep object "novelty" once it is saved. It also saves object's state before saving 
     25   * it to enable later comparisons. 
    2526   *  
    2627   * @param    BaseObject    $object 
     
    3233      $object->setWasNew(true); 
    3334    } 
     35   
     36    // Save object state prior to saving 
     37    $object->setBeforeSave($object); 
    3438  } 
    3539   
     
    97101  } 
    98102 
     103  /** 
     104   * Saves object instance into "before_save" property. It can be called later (in notification 
     105   * logic provider for instance) with getBeforeSave(). Useful for before / after comparisons. 
     106   *  
     107   * @param    BaseObject    $object 
     108   */ 
     109  public function setBeforeSave(BaseObject $object) 
     110  { 
     111    $object->before_save = $object; 
     112  } 
     113 
     114  /** 
     115   * Returns object instance as it was when the preSave() hook was called. 
     116   *  
     117   * @return    BaseObject    $object 
     118   */ 
     119  public function getBeforeSave() 
     120  { 
     121    return $this->before_save; 
     122  } 
     123 
    99124}