Hi Pascal I hope you don't mind the CC to midgard-us this might interest some other people as well *g*
On 24.01.02 Pascal Van Hecke \(Thuis\) wrote: > did you follow the discussion at > http://marc.theaimsgroup.com/?t=101178806200002&r=1&w=2 ? Just catching up... > I'm just quoting my last message on 23 of january: > > //Torben's CArticle > $test_variable = new Carticle(1636); > > $test_variable->title = "hoho"; > > if ($test_variable->update()) > {echo " update ok <br>";} > else > {echo " update not ok for ".mgd_errstr()."<br>";} > > //the normal stuff > $test_variable = mgd_get_article(1636); > > $test_variable->title = "haha"; > > if ($test_variable->update()) > {echo " update ok <br>";} > else > {echo " update not ok for ".mgd_errstr()."<br>";} > > This gave (on a page with the proper authentication): > > update not ok for MGD_ERR_INVALID_OBJECT > update ok > > So does this mean that you cannot simply use the > inherited object functions such as update() (and the > rest)? > And that you have to override them with your own > implementations, using a dummy article you copy first > your data to and then perform the update() on? To be honest, current testing of these classes doesn't cover the use of update ...The whole project is currently frozen. (see below). The basic problem is, that PHP doesn't really support OOP. You can use inheritance to compose ore extend available objects, but you don't have anything like i.e. C++ or JAVA Object Handling including Polymorphism or Dynamic Method Invocation ("virtual" methods). This is the main Drawback of PHPs missing Typehandling. Assume CArticle's Constructor would do this: $this = mgd_get_article(...); The result would be that $this get's a MidgardArticle assigned. In the very same moment the type of $this changes from Carticle to MidgardArticle which is very bad. So the new calls come in. As you tell it from personal experience I assume that you have to overwrite all functions, including update. I didn't discover this, because my Project inherits from CArticle again and there update gets overwritten becaus it has to save some Parameters. The missing Type safte makes this whole thing very messy. :-( If you need it, I can mail you an example of a CArticle derived class that actually works, just drop me a mail. > Did you pursue on the effort you started at > http://www.nathan-syntronics.de/midgard/oop/extending.html or do you think > this way of working is not very fruitful after all? I will pursue this effort, at least until the Skriptor has stabilized. Even after that, those classes might be useful if you can't update your Server to Midgard 1.6 (or whatever). My only problem is time. Since my studies will end this February I'm rather rotating around to get all things done. After that I will be more Active in the Midgard Scene again. This is for all of you who have questions to me abount anything I wrote: I currently don't really read the Midgard Lists. Drop me a private Mail if you require some Information or it is almost guranteed that I won't read your Mail... Live long and prosper! Torben Nehmer -- ICQ-ID : 14148813 --- E-Mail : [EMAIL PROTECTED] WWW : http://www.nathan-syntronics.de --- http://www.nehmer.net --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
