Hi, first sorry for my english, below I will write the original text
in spanish.

I am developing an application based on askeet and i have a problem
with a feature that is not implemented in askeet, the deletion of
users. This is not implemented.

The problem appears when an user is deleted, in my application doesn't
exist the anonymous user and it must to delete all contributions from
an user: his questions, his answers, ... and his reports (question
reports and answer resports), and when is deleted the reports it must
to be updated the field "reports" in tables Answer and Question.

How can i do this?

I have configured in the database the field user_id as foreign key and
with the property OnDelete: Cascade, so when an user is deleted all
rows from all tables where exists that user_id are deleted. Well, but
when are deleted the reports that this user made it would must have a
trigger that updates the reports field from tables Answer and
Question.

I have tried redefine the doDelete() method from ReportQuestionPeer
and here update the reports counter but I don't know how to get the
ReportQuestion object to get the Question Id, that is necessary to
update the Question reports counter.

Here the link to the askeet database diagram
http://www.symfony-project.com/images/askeet/mcd4.gif

Thanks


Spanish original text:

Buenas, estoy desarrollando una aplicación a partir de askeet y tengo
un problema con una cosa que al parecer no se ha implementado en
askeet. En askeet se supone que los administradores pueden borrar
usuarios pero no está implementado realmente.

El problema surge cuando se borra a un usuario, en mi aplicación no
existe el usuario anónimo y debe borrarse todo rastro del usuario: sus
preguntas, sus respuestas, ... y sus reportes (tanto de preguntas como
de respuestas), y cuando se borran los reportes se debe actualizar el
contador de reportes tanto de las preguntas como de las respuestas
reportadas.

¿Cómo se hace?

Yo tengo declarado en la base de datos el user_id como clave foranea y
con la propiedad OnDelete: Cascade, es decir que cuando se borra el
usuario se debe borrar todas las filas de las tablas donde aparezca
ese usuario, hasta aquí perfecto, pero al borrar los reportes que ha
hecho este usuario se debería disparar una especie de trigger que
actualiza el número de reportes de la pregunta o la respuesta.

Lo que he intentado es redefinir el método doDelete() de la clase
ReportQuestionPeer para ahí actualizar el contador de reportes pero no
sé cómo tener acceso al objeto ReportQuestion para obtener el Id de la
Question, necesario para actualizar el contador Reports de dicha
Question.

Os dejor con un enlace al esquema de la base de datos de askeet

http://www.symfony-project.com/images/askeet/mcd4.gif

Sé que es una pregunta compleja pero agradeceré cualquier ayuda.

En cualquier caso, muchas gracias.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to