Related records are insert everytime
I have a table where articles and other tables are related to a table of images. Saving an image start calculating and saving the related thumbnails which is done in the model of the image (preSave). Saving an article start saving the images which starts the thumbnails process again. And I don't know why ...
When I save an article I only want to save the relation. Saving thumbnails is a hard process often causing a timeout and using too much resources.
How do I do that?
Here is a part of my schema reduced to the important aspects:
Image: columns: # ... relations: Flats: class: Flat refClass: FlatImage foreignAlias: Images Articles: class: Article refClass: ArticleImage foreignAlias: Articles Thumbnail: columns: # ... relations: SourceImage: class: Image local: image_id onDelete: CASCADE foreignAlias: Thumbnails
When you need other parts of code, please comment.
See the "cascade_saves" here for your databases.yml file. That should work.
all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:host=localhost;dbname=mydatabase username: ### password: ### encoding: utf8 attributes: cascade_saves: false