Releases for sf 1.4
| Version |
License |
API |
Released |
|
0.4.0beta
|
MIT license |
0.4.0beta
|
05/04/2008 |
|
0.3.0beta
|
MIT license |
0.3.0beta
|
21/03/2008 |
|
0.2.3alpha
|
MIT license |
0.2.3alpha
|
08/02/2008 |
|
0.2.2alpha
|
MIT license |
0.2.2alpha
|
06/02/2008 |
|
0.2.1alpha
|
MIT license |
0.2.1alpha
|
16/03/2007 |
Releases for sf 1.3
| Version |
License |
API |
Released |
|
0.4.0beta
|
MIT license |
0.4.0beta
|
05/04/2008 |
|
0.3.0beta
|
MIT license |
0.3.0beta
|
21/03/2008 |
|
0.2.3alpha
|
MIT license |
0.2.3alpha
|
08/02/2008 |
|
0.2.2alpha
|
MIT license |
0.2.2alpha
|
06/02/2008 |
|
0.2.1alpha
|
MIT license |
0.2.1alpha
|
16/03/2007 |
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.4.0beta
|
MIT license |
0.4.0beta
|
05/04/2008 |
|
0.3.0beta
|
MIT license |
0.3.0beta
|
21/03/2008 |
|
0.2.3alpha
|
MIT license |
0.2.3alpha
|
08/02/2008 |
|
0.2.2alpha
|
MIT license |
0.2.2alpha
|
06/02/2008 |
|
0.2.1alpha
|
MIT license |
0.2.1alpha
|
16/03/2007 |
Releases for sf 1.1
| Version |
License |
API |
Released |
|
0.4.0beta
|
MIT license |
0.4.0beta
|
05/04/2008 |
|
0.3.0beta
|
MIT license |
0.3.0beta
|
21/03/2008 |
|
0.2.3alpha
|
MIT license |
0.2.3alpha
|
08/02/2008 |
|
0.2.2alpha
|
MIT license |
0.2.2alpha
|
06/02/2008 |
|
0.2.1alpha
|
MIT license |
0.2.1alpha
|
16/03/2007 |
Releases for sf 1.0
| Version |
License |
API |
Released |
|
0.4.0beta
|
MIT license |
0.4.0beta
|
05/04/2008 |
|
0.3.0beta
|
MIT license |
0.3.0beta
|
21/03/2008 |
|
0.2.3alpha
|
MIT license |
0.2.3alpha
|
08/02/2008 |
|
0.2.2alpha
|
MIT license |
0.2.2alpha
|
06/02/2008 |
|
0.2.1alpha
|
MIT license |
0.2.1alpha
|
16/03/2007 |
|
0.2.0alpha
|
MIT license |
0.2.0alpha
|
17/02/2007 |
|
0.1.0alpha
|
MIT license |
0.1.0alpha
|
17/02/2007 |
Changelog for release 0.1.0 - 17/02/2007
Not available
Other releases
Release 0.4.0 - 05/04/2008
Not available
Release 0.3.0 - 21/03/2008
Not available
Release 0.2.3 - 08/02/2008
Not available
Release 0.2.2 - 06/02/2008
Not available
Release 0.2.1 - 16/03/2007
Not available
Release 0.2.0 - 17/02/2007
Not available
Release 0.1.0 - 17/02/2007
Not available
sfPropelVersionableBehaviorPlugin plugin
The sfPropelVersionableBehaviorPlugin is a symfony plugin that provides versioning capabilities to any Propel object.
Features
- Fully unit tested
- Revert objects to previous versions easily
Installation
Install the plugin
symfony plugin-install http://plugins.symfony-project.com/sfPropelVersionableBehaviorPlugin
Enable Propel behavior support in propel.ini:
propel.builder.AddBehaviors = true
Add necessary fields to your model :
<column name="uuid" type="CHAR" size="36" required="true" />
<column name="version" type="INTEGER" size="11" required="true" />
Add foreign key between resource and version history. Edit plugin's schema.xml and enter valid values for foreignTable and foreign attributes
<foreign-key foreignTable="Article" name="has_versions" onDelete="cascade">
<reference local="resource_uuid" foreign="uuid"/>
</foreign-key>
Rebuild your database and model (the plugin uses to tables to store object version history)
symfony propel-build-all
Enable the behavior for one of your Propel model:
// lib/model/Article.php
class Article
{
}
$columns_map = array('uuid' => ArticlePeer::UUID
'version' => ArticlePeer::VERSION);
sfPropelBehavior::add('Article', array('versionable' => array('columns' => $columns_map)));
Column map values signification :
- uuid : Model column holding resource's universally unique identifier (behavior takes care of generating these)
- version : Model column holding resource's current version number
Usage
Reverting to a previous version
$article = new Article();
$article->setTitle('First version of article');
$article->save(); // $article->getVersion() == 1
$article->setTitle('Second version of article');
$article->save(); //$article->getVersion() == 2
$article->toVersion(1); // $article->getTitle() == 'First version of article'
$article->save(); // $article->getVersion() == 3
Retrieving a resource version history
foreach ($article->getAllVersions() as $version)
{
$history_article = $version->getResourceInstance();
echo sprintf("Version %d title : %s\n",
$history_article->getVersion(),
$history_article->getTitle());
}
/*
* Outputs :
*
* Version 1 title : First version of article
* Version 2 title : Second version of article
* Version 3 title : First version of article
*/
Public API
Enabling the behaviors adds / modifies the following method to the Propel objects :
void save() : Adds a new version to resource's version history
void delete() : Deletes resource's version history
void toVersion(integer $version_number) : Populates resource properties with values from the requested version
array getAllVersions() : Returns each resource version in an array
!ResourceVersion class API :
BaseObject getResourceInstance() : returns resource instance populated with attributes from the version
Changelog
2007-02-17 | 0.1.0
Initial public release.