[symfony-users] How to force the Doctrine behaviour Timestampable values in a main table when embedded data are updated

2010-01-25 Thread Olivier LOYNET
Hi,

I've two tables :
 - Profile table
 - Organism table with an embedded relation (1,1)
The Profile table have Timestampable behaviour like this schema :

Profile:
  tableName: profile
  actAs:
Timestampable:   ~
  columns:
id:
  type:  integer(4)
  primary:   true
  autoincrement: true
name:
  type:  string(255)
  notnull:   true 

Organism:
  tableName: organism
  columns:
id:
  type:  integer(4)
  primary:   true
  autoincrement: true
profile_id:
  type:  integer(4)
  notnull:   true 
name:
  type:  string(255)
  notnull:   true 
  relations:
Profile:
  local: profile_id
  foreign:   id
  foreignType:   one


My problem is :

If I only update some information in Organism table, the updated_at column
is not modified. It's normal because the behavior don't detect any modified
value in Profile table.

How to mention to the Profile table that some data have change and to
update the column updated_at with the current value.

What is the best method ? Is by extending the doctrine events ? To put some
code in doSave or else ? Another ?


Regards,
Olivier

-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



Re: [symfony-users] How to force the Doctrine behaviour Timestampable values in a main table when embedded data are updated

2010-01-25 Thread FlyLM [ML]
2010/1/25 Olivier LOYNET olivierloy...@gmail.com:
 Hi,

 I've two tables :
  - Profile table
  - Organism table with an embedded relation (1,1)
 The Profile table have Timestampable behaviour like this schema :

 Profile:
  tableName: profile
  actAs:
    Timestampable:   ~
  columns:
    id:
      type:          integer(4)
      primary:       true
      autoincrement: true
    name:
      type:          string(255)
      notnull:       true

 Organism:
  tableName: organism
  columns:
    id:
      type:          integer(4)
      primary:       true
      autoincrement: true
    profile_id:
      type:          integer(4)
      notnull:       true
    name:
      type:          string(255)
      notnull:       true
  relations:
    Profile:
      local:         profile_id
      foreign:       id
      foreignType:   one


 My problem is :

 If I only update some information in Organism table, the updated_at column
 is not modified. It's normal because the behavior don't detect any modified
 value in Profile table.

 How to mention to the Profile table that some data have change and to
 update the column updated_at with the current value.

 What is the best method ? Is by extending the doctrine events ? To put some
 code in doSave or else ? Another ?


Hi,

Perhaps it's not the best method, but you can use the method
postUpdate of the Doctrine model class of Organism to update the
Profile.

Fabien



 Regards,
 Olivier

 --
 You received this message because you are subscribed to the Google Groups 
 symfony users group.
 To post to this group, send email to symfony-us...@googlegroups.com.
 To unsubscribe from this group, send email to 
 symfony-users+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/symfony-users?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



Re: [symfony-users] How to force the Doctrine behaviour Timestampable values in a main table when embedded data are updated

2010-01-25 Thread FlyLM [ML]
 Hi,

 Perhaps it's not the best method, but you can use the method
 postUpdate of the Doctrine model class of Organism to update the
 Profile.

Just the opposite in ur case, use the postUpdate method of the
Profile model class to update Organism.

-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



RE: [symfony-users] How to force the Doctrine behaviour Timestampable values in a main table when embedded data are updated

2010-01-25 Thread Olivier LOYNET
I'm not very experimented with events usages.
I'll try it soon the postUpdate event.

Thanks for your fast reply.

Olivier




 -Message d'origine-
 De : symfony-users@googlegroups.com [mailto:symfony-
 us...@googlegroups.com] De la part de FlyLM [ML]
 Envoyé : lundi 25 janvier 2010 15:03
 À : symfony-users@googlegroups.com
 Objet : Re: [symfony-users] How to force the Doctrine behaviour
 Timestampable values in a main table when embedded data are updated
 
  Hi,
 
  Perhaps it's not the best method, but you can use the method
  postUpdate of the Doctrine model class of Organism to update the
  Profile.
 
 Just the opposite in ur case, use the postUpdate method of the
 Profile model class to update Organism.
 
 --
 You received this message because you are subscribed to the Google Groups
 symfony users group.
 To post to this group, send email to symfony-us...@googlegroups.com.
 To unsubscribe from this group, send email to symfony-
 users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.