TimeTrex/classes/modules/plugins/UserFactory.plugin.example

29 lines
833 B
Plaintext

<?php
/*$License$*/
/*
* Example plugin.
*/
//Extend the "ListFactory" if you want your plugin to affect it AND the base Factory class.
//Extend just the "Factory" if you just want it to affect just it, and not account for objects read/modified through iterators.
class UserFactoryPlugin extends UserListFactory {
function setLastName( $value ) {
//Modify last name, so it always has "-Smith" on the end.
$value .= '-Smith';
return parent::setLastName( $value );
}
function postSave() {
parent::postSave(); //Make sure you always call the parents function to maintain proper code operation.
//User record was saved. We can do all sorts of things here like trigger real-time data exporting.
Debug::Arr( $this->getObjectAsArray(), 'Plugin postSave(): ', __FILE__, __LINE__, __METHOD__,10);
return TRUE;
}
}