TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Destroying related objects doubt (http://www.talkphp.com/advanced-php-programming/4838-destroying-related-objects-doubt.html)

sohdubom 08-10-2009 06:14 PM

Destroying related objects doubt
 
::Destroying related objects doubt

One thing that is confusing me is regarding the lifecycle of the associated objects and the related data in the database. Suppose we have an example of object composition and in this case if I destroy de parent object then the children objects will be destroyed too.

Well, the confusion I'm doing is related to the semantics of the word 'destroy'. In my understanding when I say 'destroy' an object, it means I will unset it, but I will not 'delete' the related data in the database.

ex.: let's say we have objects House and Rooms, the relationship between them is composition, so House is responsible for creating new Rooms. If I destroy the instance of House, all instances of Rooms will be destroyed as well, but it doesn't mean I have to 'delete' them from the database, right? ... sounds like a silly question, but ...

thanks in advance, sohdubom

Salathe 08-10-2009 08:03 PM

Quote:

Originally Posted by sohdubom (Post 27679)
when I say 'destroy' an object, it means I will unset it, but I will not 'delete' the related data in the database. … If I destroy the instance of House … it doesn't mean I have to 'delete' them from the database, right?

Right. ^^


All times are GMT. The time now is 02:26 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0