[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) |
[eluser]Alface[/eluser]
maybe we could implement group save method, don't u think?
[eluser]OverZealous[/eluser]
You can add anything you want as an extension. But you *really* need to manually save each item. If you don't, you won't know when an error occurs. And then you won't be able to report it back. Whenever you save, your code should always look like this: Code: if($object->save()) { This allows you to listen to validation errors. If you simply saved a bunch of items in an array, it would be much more difficult to figure out what went wrong. I will not be adding any methods to save a group of objects to the DMZ core.
[eluser]Alface[/eluser]
It make sense. I Extentend the datamapper classe an add this function: Code: function from_array_all($data, $fields = '', $save = FALSE){ and used it on the Controller like this: Code: if($_POST){ but it just save the first key of $this->input->post('videos') array.. and still not rollbacking any ideia? 8-/
[eluser]12vunion[/eluser]
[quote author="OverZealous" date="1256683184"]@12vunion The only drawback to your code is you can never edit the item, or the IP address will be overwritten. If that's what you want, then fine. BDH specifically wanted it to only insert the IP address on inserts, but not change it on updates, I believe. The required is not really necessary, either way.[/quote] Ah, I didn't read that part. I actually only use that code on things I don't edit; like when someone sends a contact message or support request, etc. But that's a simple change if anyone cares. Code: function _get_ip($field, $parameter) { Back to the htmlform extension: OverZealous are you planning on revamping it any time soon? I have a major project coming up that will be taking up much of my free time, but if I can slip it in there I would be willing to take that off your plate. I think it's one of the most useful bits of code I use these days, but I find myself having to add things to it here and there (mostly, but not entirely, for the the purpose of fitting a design). I think it's almost as much of a time saver as DMZ itself. I love it, but it's getting time for a rewrite. Also, I've rewritten the templates to be div based rather than tables. ![]()
[eluser]OverZealous[/eluser]
[quote author="12vunion" date="1256719317"] Back to the htmlform extension: OverZealous are you planning on revamping it any time soon? I have a major project coming up that will be taking up much of my free time, but if I can slip it in there I would be willing to take that off your plate. I think it's one of the most useful bits of code I use these days, but I find myself having to add things to it here and there (mostly, but not entirely, for the the purpose of fitting a design). I think it's almost as much of a time saver as DMZ itself. I love it, but it's getting time for a rewrite. Also, I've rewritten the templates to be div based rather than tables. ![]() I certainly wouldn't mind updates to or an upgraded htmlform extension. I do not have any plans to work on it in the near future. The only reason I used tables in the original extension is that I didn't have to supply a CSS file with it (or explain it, for that matter) and could still get nicely aligned labels and fields. The only thing I ask is that it is well documented and somewhat consistent in the style of the overall DMZ set of tools. I also would accept creating an alternate HTMLForm (e.g.: htmlform2) if it diverges much from the original. If I get more time (and energy) I will create a place to share DMZ extensions. Probably not before the new year, however.
[eluser]12vunion[/eluser]
Not sure how fast I'll be able to get to it, but certainly before the end of the year. Hit me up if you had any changes in mind. The majority of my changes involve individually targeting and overwriting row and input attributes. And buttons. I have normal, css ready templates that are actually styled fine out of the box if you're using blueprint css. Some of the others are indeed tied into css/js more deeply (similar to <a href="http://aaronweyenberg.com/90/pretty-checkboxes-with-jquery">pretty checkboxes</a> method). It would make more sense to strip those out into their own collections.
[eluser]OverZealous[/eluser]
@alface You are not checking the result of the save(). As I said before, if you don't check that, you won't know if it validated. Please check the examples included with DMZ for how to save an object.
[eluser]12vunion[/eluser]
[quote author="Alface" date="1256720054"]did u read me? o.o[/quote] Yes. Without testing it, I think that your problem begins with: Code: $va->from_array($_POST); This gets you a singular object. It doesn't make an array of objects. So if you're sending an array of data in the post, you're only really grabbing the first one and making an object. You should probably be specifying the fields here if you're also passing 'videos'. Secondly, you need to tell it what kind of objects you're trying to make: Code: $va = new VA(); //whatever model you're trying to use here for $va Code: //if this even works
[eluser]ennis[/eluser]
Hey guys ![]() was looking at http://www.overzealous.com/dmz/pages/adv...tions.html and Storing Additional Information on the Join Table I have a table called client_relatedclient that is the self relationship of client so on the client class I have Code: var $has_many = array( How would i do this with out adding a custom method to my Clients class? Thanks. |
Welcome Guest, Not a member yet? Register Sign In |