Re: Deleting files
Re: Deleting files
- Subject: Re: Deleting files
- From: Art Isbell <email@hidden>
- Date: Thu, 16 Jan 2003 15:57:06 -1000
On Thursday, January 16, 2003, at 03:06 PM, Jonathan Fleming wrote:
I understand that, now I'm going to go one step further; what would I
need to do if in the EOModel I want to delete an object that has the
cascade option set? Eg. I have these entities,
Client <oneToMany>> Job <oneToMany>> JobPicture
if I delete a Job all the JobPicture fileNames will be deleted, how
will I then delete the directory in the file system that holds all the
images that the JobPicture's FileName attribute/property pointed to?
You're a programmer, right? Think about what you want to do and how
to do it. You obviously can't delete files if you don't have their
paths. You won't be able to get their paths after their JobPicture
objects are deleted. So create an array of their paths before these
objects are deleted. This is pretty basic stuff!
If you set the Client.jobs relationship to own its destination, then
merely removing a Job object from the Client.jobs relationship, one
statement, should result in the Job and all of its JobPictures being
deleted. But only if this succeeds should you then delete the files at
the paths in the array.
Art
http://homepage.mac.com/aisbell/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.