![]() |
[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) (/showthread.php?tid=23751) |
[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]benoa[/eluser] EDITED: Found the answer in the docs! [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]OverZealous[/eluser] [quote author="BrianDHall" date="1256152128"]It isn't a big deal, but is there a simple way to do this - like a load_all_related() function or somesuch so I don't have to load up each one individually?[/quote] There isn't a built-in function for this. It would be super-easy to handle this through an extension. The basic idea would be something like this: Code: function load_all_related($object, $has_many = TRUE, $has_one = TRUE) { Package that up in an extension class, and you can use it anywhere. @benoa, Benedikt I'm sorry that you feel that a 100% free library should provide better support. I don't write DMZ to make money, and I don't have a lot of free time. The questions you were asking are fairly basic questions that are easily answered. I recently added searching to help find answers, as well. Another reason I am a little short with Benedikt specifically is that your first communication with me was through my business email address. Not only is there a forum for asking questions, but I have an email address in the manual specifically for DMZ-related questions. Contacting me through my business email shows me that you have not read the manual, much less looked for answers to your question. You say "How can I create a model?" I say there is a Getting Started page, a page labeled Models, and an entire example application in the manual. If you look through the (very long) previous thread, you will see I provide a lot of support. I answer a lot of questions, and I fix bugs as they are found. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]OverZealous[/eluser] [quote author="peterparker2k" date="1256157057"] 1. creating more complex queries with count: [/quote] DMZ does not explicit include support for that kind of query (as of now). However, you can modify your query using normal AR methods. It's not very clean, but it will allow you to get the job done. ;-) Code: $g = new Group(); This is a useful enough (and simple enough) feature I might add a include_related_count() feature in the future. Quote:2. Delete relation, avoid setting id to NULLNot sure what you are asking. If you delete an object, all relationships are deleted at the same time. If you delete a relationship, it does not delete the object itself. You can only delete an object by calling delete() with no arguments, or delete_all() if you have a set of objects to query. Deleting a relationship that uses an ITFK simply sets the ITFK column to NULL. Not sure how it could work otherwise. Quote:3. Unnecessary SELECT statements:First, performance of these queries is almost not worth the effort. If they bother you, see here. Please do not enable the production cache while developing. Read the big red warning. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]benoa[/eluser] Phil I'm very thankful for what you do ![]() [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]OverZealous[/eluser] @benoa Validation is only called when (1) saving, or (2)explicitly calling it. The docs and example application contain a complete, functional login mechanism. It's nice and secure, and includes salting the password hash. I recommend looking into that. You don't need to use the authorization side (that's mostly rubbish), but the authentication portion is pretty sound. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]benoa[/eluser] Thank you! ![]() I'll be using a fork of your login code plus my own auth library to handle the session. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]BrianDHall[/eluser] Awesome extension idea OZ, surprised it is so straightforward. I think I'll try it out ![]() Separate question: Say, can DMZ handle Advanced Relationships alongside simple relationships without one interfering with the other? Right now I have a Listing that can have multiple Images (with each image having only one listing), and that all works just fine. But what I would like to have is one image for each listing defined as the default image. The catch is I've already coded the rest of the program, so I don't want to go and re-write every access of images to deal with the fact that advanced relationships are accessed by key instead of model name. I figured I'd just handle it manually, but is there some way to get this sort of functionality quick and easy? Example of what I want: Code: $listing = new Listing(); Here primary_image is actually the same as one of the entries in Image. It'd be cool if I could define an advanced relationship in a way that allows me to leave my previous code the same, I just can't quite figure if this is trivial or would take more effort than it's worth. The upside for me would be that DMZ would handle the fact that if I define a new primary_image it would automatically over-write the relationship to the old image, and of course if I delete an image DMZ would handle that clean-up as well. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]OverZealous[/eluser] @BrianDHall Yes, you can mix relationships, even as you mentioned. Of course, you'll need a dedicated column to track the default image, and you'll also need to save that image twice (once with all images, and once as the default). It's just two different relationships to the same image, as far as DMZ is concerned. Note that if the primary image is deleted or un-related, then there will be no primary image defined. If you go with this (which is simple enough), I would add a "primary_image_id" ITFK column to your listings table (or you'll need to add a column of the same name to your join table). Alternatively, you can add a isprimary column to your join table (if you have one), and use Join Fields, which are perfect for this sort of thing. ----- On an unrelated note, I tried to implement an include_related_count method, and it just isn't feasible within DMZ. The reason is that the group by clause needs to have every single non-aggregated column listed, or the query fails (in my tests). This became too complicated for a limited-use feature. Sorry! [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]Benedikt[/eluser] [quote author="OverZealous" date="1256175413"]Another reason I am a little short with Benedikt specifically is that your first communication with me was through my business email address. Not only is there a forum for asking questions, but I have an email address in the manual specifically for DMZ-related questions. Contacting me through my business email shows me that you have not read the manual, much less looked for answers to your question.[/quote] Sorry if you feel not treated correctly, but on the first page of your manual says that you would like to receive a postcard. Clicking this link leads to your "Contact me" page so I used the address I found there. I didnt expect you have a link somewhere to another mailaddress. Sorry for taking the obvious. Quote:You say "How can I create a model?" I say there is a Getting Started page, a page labeled Models, and an entire example application in the manual.This was not my question. I said the basic questions are answered by your copied version of DM which you extended quite a lot. As I said, for you everything seems clear and somehow written in the docs. But sometimes there are a few things which need to be explained in other words or with real examples. This way others (like me) can understand DMZ as well and handle the support for you. Mainly free software lives by its supporters. But how to support a software if you cant get behind the manual? I still dont see all my questions (not yet asked, and maybe never will) answered in the manual, at least not very obvious for a beginner like me. And as I already said, I dont mind to pay for support if it brings me a step further. Sorry if you got me wrong, but a short outline and a request to use another address / the forum in the future would hv helped me further. [Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) - El Forum - 10-21-2009 [eluser]OverZealous[/eluser] [quote author="Benedikt" date="1256182187"]Sorry if you feel not treated correctly, but on the first page of your manual says that you would like to receive a postcard. Clicking this link leads to your "Contact me" page so I used the address I found there.[/quote] Fair enough. I have updated my contact page. I only linked to it so the downloaded copies of the manual would not have a hard-coded physical address. Obviously, there is some communication issues between us due to natively speaking different languages. Again, I'm sorry that you are unhappy with the level of support provided by DMZ, but it really isn't going to change significantly. Yes, DMZ is based heavily on stensi's DataMapper. But stensi stopped updating DataMapper almost a year ago. I have been the sole developer on this project since early this year, and chose to extend it because I needed a lot of features that just weren't there. I also chose to provide these enhancements back to the community. I then significantly rewrote the docs, developed all new example applications, and have supported it since then. If you need paid support, I am not able to provide it at this time. I am trying to kick start my own company, and finishing a complex application. My time will not get less restricted in the near future. |