comfortablementeadormecido | 12 Jul 2006 20:12
Picon

Dependency

I keep playing around with metastorage and another thing came to my
attention.

There is no way to set a dependency between objects. For instance,
imagine you have the entities State and City, when you delete a state
every city for that state shoud be deleted in order to mantain
consistency with the data in the City table (many of them would retain
an id to a deleted State). This is obviously easy to do by setting a
delete method for the cities and state and another method for the
state which would get its collection, call the delete method in each
city and then call delete for the current state or a similar algorithm.
But i think it could be considered for a future release that when you
set the collection relation you could set such things so you don't end
up with two functions to delete a state (the standard and the custom one).

What do you think?

------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Manuel Lemos | 12 Jul 2006 20:55
Picon
Favicon

Re: Dependency

Hello,

on 07/12/2006 03:12 PM comfortablementeadormecido said the following:
> I keep playing around with metastorage and another thing came to my
> attention.
> 
> There is no way to set a dependency between objects. For instance,
> imagine you have the entities State and City, when you delete a state
> every city for that state shoud be deleted in order to mantain
> consistency with the data in the City table (many of them would retain
> an id to a deleted State). This is obviously easy to do by setting a
> delete method for the cities and state and another method for the
> state which would get its collection, call the delete method in each
> city and then call delete for the current state or a similar algorithm.
> But i think it could be considered for a future release that when you
> set the collection relation you could set such things so you don't end
> up with two functions to delete a state (the standard and the custom one).
> 
> What do you think?

This is already done. When an object is deleted, it is removed from any
collections that it used to belong. If there are any objects with
reference variables pointing to the object being deleted, those
reference variables are set to NULL.

--

-- 

Regards,
Manuel Lemos

(Continue reading)

comfortablementeadormecido | 17 Jul 2006 19:18
Picon

Re: Dependency

Hi,

Yes the references are nullified indeed, but I ment a cascading
removal of elements that are dependant of the existance of a certain
object.
Using the same example as before: If each State has a Collection of
Cities, when a State is removed, and if the existance of a City
depends on the existance of the corresponding State, then every City
for that state should be removed as well.
Currently the references to the state are set to NULL (by means of
this query = "'UPDATE city SET state=NULL WHERE
state='.strval($this->id)") but then every city that has its State
attribute set to NULL should be removed one by one. Besides, the
persistance of objects with references to other objects set to null is
invalid as a default behaviour. By means of deleting a State you would
be settig every city for that State in an invalid 'situation' (the
word 'state' would have been confusing :p ).

Perhaps I'm getting this all wrong, please correct me if I am. As I
said before I really put a lot of faith in this project as I think it
would be a great help in my job but I still cant convince myself that
the application is fully capable of satisfying my needs. I hope that
by means of questions liike this I am helping clarify and possibly
correct the functionality of the project and not just annoying you.

Thanks for your time and dedication,

Matías

--- In metal-dev <at> yahoogroups.com, Manuel Lemos <mlemos <at> ...> wrote:
(Continue reading)

Manuel Lemos | 9 Aug 2006 00:12
Picon
Favicon

Re: Re: Dependency

Hello,

Sorry for the delay.

on 07/17/2006 02:18 PM comfortablementeadormecido said the following:
> Yes the references are nullified indeed, but I ment a cascading
> removal of elements that are dependant of the existance of a certain
> object.
> Using the same example as before: If each State has a Collection of
> Cities, when a State is removed, and if the existance of a City
> depends on the existance of the corresponding State, then every City
> for that state should be removed as well.
> Currently the references to the state are set to NULL (by means of
> this query = "'UPDATE city SET state=NULL WHERE
> state='.strval($this->id)") but then every city that has its State
> attribute set to NULL should be removed one by one. Besides, the
> persistance of objects with references to other objects set to null is
> invalid as a default behaviour. By means of deleting a State you would
> be settig every city for that State in an invalid 'situation' (the
> word 'state' would have been confusing :p ).
> 
> Perhaps I'm getting this all wrong, please correct me if I am. As I
> said before I really put a lot of faith in this project as I think it
> would be a great help in my job but I still cant convince myself that
> the application is fully capable of satisfying my needs. I hope that
> by means of questions liike this I am helping clarify and possibly
> correct the functionality of the project and not just annoying you.

If you want to remove cities that belong to a state, you can delete the
city objects one by one and they automatically will be removed from the
(Continue reading)

comfortablementeadormecido | 9 Aug 2006 15:01
Picon

Re: Dependency

Thank you for your attention Manuel.

Regards,
Matías

--- In metal-dev <at> yahoogroups.com, Manuel Lemos <mlemos <at> ...> wrote:
>
> Hello,
> 
> Sorry for the delay.
> 
> on 07/17/2006 02:18 PM comfortablementeadormecido said the following:
> > Yes the references are nullified indeed, but I ment a cascading
> > removal of elements that are dependant of the existance of a certain
> > object.
> > Using the same example as before: If each State has a Collection of
> > Cities, when a State is removed, and if the existance of a City
> > depends on the existance of the corresponding State, then every City
> > for that state should be removed as well.
> > Currently the references to the state are set to NULL (by means of
> > this query = "'UPDATE city SET state=NULL WHERE
> > state='.strval($this->id)") but then every city that has its State
> > attribute set to NULL should be removed one by one. Besides, the
> > persistance of objects with references to other objects set to null is
> > invalid as a default behaviour. By means of deleting a State you would
> > be settig every city for that State in an invalid 'situation' (the
> > word 'state' would have been confusing :p ).
> > 
> > Perhaps I'm getting this all wrong, please correct me if I am. As I
> > said before I really put a lot of faith in this project as I think it
(Continue reading)


Gmane