sfDoctrineActAsActivablePlugin
0.1.1beta
for sf 1.4 and Doctrine
MIT
The sfDoctrineActAsActivablePlugin is a symfony plugin that allows use of the doctrine behavior actAsActivable.
This behavior provides methods on your model for setting "is active"/"is not active" state to doctrine records.
This plugin allow cascade activate/desactivate between doctrine relations
Developers
| Name |
Status |
Email |
Ali hichem |
lead |
moc.liam <<ta>> mehcih.ila
|
License
Copyright (c) 2011 Ali hichem
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases for sf 1.4
| Version |
License |
API |
Released |
|
0.1.1beta
|
MIT license |
0.1.1beta
|
28/05/2011 |
Changelog for release 0.1.1 - 28/05/2011
Other releases
Release 0.1.1 - 28/05/2011
sfDoctrineActAsActivablePlugin
The sfDoctrineActAsActivablePlugin is a symfony plugin that allows use of the doctrine behavior actAsActivable.
This behavior provides methods on your model for setting "is active"/"is not active" state to doctrine records.
This plugin allow cascade activate/desactivate between doctrine relation
Installation
Install the plugin
$ symfony plugin:install sfDoctrineActAsActivablePlugin
Activate the plugin in your project configuration file (in config/ProjectConfiguration.class.php)
and enable the Doctrine callbaks.
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
//...
$this->enablePlugins('sfDoctrineActAsActivablePlugin');
}
public function configureDoctrine(Doctrine_Manager $manager)
{
// Enable callbacks so that Activable behavior can be used
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
}
}
Apply the behavior to your model in your schema file config/doctrine/schema.yml, ie:
# simple
[yml]
model:
actAs: [Activable]
# advenced
[yml]
model:
actAs:
Activable:
name: is_active
alias: ~
options:
default: true
indexName: activable
cascade:
down: true
(optional): If you prefer apply a general config for all your activable model, leave activable
declaration in your schema with "~" and set the default config in your app.yml
# config/doctrine/schema.yml
Mymodel:
actAs:
Activable: ~
# app/myapp/config/app.yml
all:
activable:
name: is_active
alias: null
type: boolean
length: 1
options:
default: true
indexName: activable
cascade:
down: false
up: false
Rebuild your models and database
$ symfony doctrine:build-all-reload
alternatively you could build the models, the sql, then run the sql manually
Clear your cache
$ symfony cc
when working with activale behavior , you will probably want to show all your
records (active and non-active) to be able to enable the "non-active"
items. To do that without adding a condition in your DQL, you can force the behavior
with:
// put this line before building your Doctrine Query
sfConfig::set('activable_dql_select', FALSE);
(comming soon)
Available schema options:
[yml]
model:
actAs:
Activable:
cascade:
up: true
Available Record Methods