Hello guys,
I have this i schema:
Compedium:
actAs:
Timestampable:
Sortable:
DmVersionable:
columns:
name: { type: string(255), notnull: true }
members: { type: clob, extra: ckeditor }
is_active: { type: boolean, notnull: true, default: true }
year: { type: integer(4) }
short: { type: string(255) }
letter: { type: string(1)}
mill_id: { type: integer }
about: { type: clob, extra: ckeditor }
accepted: { type: boolean, notnull: true, default: true }
link: { type: string(255) }
rating: { type: float }
rating_votes: { type: integer }
relations:
Mill:
onDelete: SET NULL
local: mill_id
foreign: id
foreignAlias: Mill
class: Mill
Style:
class: Style
local: compedium_id
foreign: style_id
refClass: CompediumStyle
foreignAlias: Compediums
Style:
actAs:
Timestampable:
Sortable:
columns:
name: { type: string(100), notnull: true }
count: { type: integer}
is_active: { type: boolean, notnull: true, default: true }
relations:
Compedium:
class: Compedium
refClass: CompediumStyle
local: style_id
foreign: compedium_id
foreignAlias: Styles
CompediumStyle:
options:
symfony:
form: false
filter: false
actAs:
Timestampable:
columns:
style_id: { type: integer, primary: true }
compedium_id: { type: integer, primary: true }
relations:
Style:
class: Style
local: style_id
onDelete: CASCADE
Compedium:
class: Compedium
local: compedium_id
onDelete: CASCADE
I'm trying to count in Style table save numbers of styles attributed
in Compedium.
I wrote this in model:
foreach($this->_get('Style')->getData() as $data)
{
$id=$data->get('id');
$style=Doctrine::getTable('style')->find($id);
$style->setCount($style->getCount()+1);
$style->save();
}
The problem is, that running during update.
What I wont to do, it's that adding '+1' to count during select some
styles while creating or updating recotd and subtraction '-1' during
unselect some style.
Please help ;)
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
To unsubscribe from this group, send email to
symfony-users+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.