Right. The reviews will not get deleted automatically. You need to do that manually. Call getReviewArray() and loop through the array deleting each review, and then delete the product.
I generally have a delete() method in my abstract decorator, so I'd simply override that method in my product decorator to do what I just descibed. Then, whenever you call product.delete() it will delete all of the reviews as well. Cheers, Bob On Mon, Aug 10, 2009 at 8:29 PM, Dan Vega<[email protected]> wrote: > > Ohh sorry about that. When I delete a product I would like all reviews > to be deleted as well. The product gets deleted but none of the > reviews are deleted. > > On Aug 10, 5:44 pm, Mark Mandel <[email protected]> wrote: >> cascadeDelete will delete *everything* it can find down the object graph - >> BE WARNED. >> >> Would you like to actually explain what the actual 'problem' is please ;o) >> >> Mark >> >> >> >> >> >> On Tue, Aug 11, 2009 at 6:58 AM, Dan Vega <[email protected]> wrote: >> >> > I have an ecommerce application (demo) that has products. Each of >> > those products can have reviews attached to them. Below is my transfer >> > configuration for products. The review table holds a foreign key for >> > the product that the review is for. If i call geReviewArray for a >> > product it works great but I am having an issue with deleting >> > children. >> >> > If I call cascadeDelete on a product object that has reviews shouldn't >> > it also delete those reviews from the database? I am just trying to >> > figure out if I am misunderstanding what this method should do or If I >> > am doing something wrong. >> >> > <object name="product" table="products" >> > decorator="unitedcommerce.model.Product"> >> > <id name="id" type="numeric"/> >> > <property name="name" type="string"/> >> > <property name="author" type="string"/> >> > <property name="url" type="string"/> >> > <property name="price" type="numeric"/> >> > <property name="onSale" type="boolean"/> >> > <property name="screenshot" type="string"/> >> > <property name="thumbnail" type="string"/> >> > <property name="isFeatured" type="string"/> >> >> > <manytomany name="Category" table="ProductCategories"> >> > <link to="product" column="productId"/> >> > <link to="category" column="categoryId"/> >> > <collection type="array"> >> > <order property="name" order="asc"/> >> > </collection> >> > </manytomany> >> >> > <onetomany name="review"> >> > <link to="review" column="productId"/> >> > <collection type="array"> >> > <order property="dateReviewed" order="desc"/> >> > </collection> >> > </onetomany> >> >> > </object> >> >> -- >> E: [email protected] >> T:http://www.twitter.com/neurotic >> W:www.compoundtheory.com > > > -- Bob Silverberg www.silverwareconsulting.com --~--~---------~--~----~------------~-------~--~----~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-dev" 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/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---
