[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
[quote author="GregX999" date="1268189453"]So that the position field goes from 1 to X instead of 0 to X.[/quote] Ah, good catch! I think in my application I'm using 0-based sorting just so I don't have to worry about it. I love PHP, I hate PHP. I love that it has so much random stuff. :-) I hate that so much of it is random. ![]() Part of it is the frustration going from an OOP language (Java) where I can have a collection and instantly see all of the functions for an array in my IDE. In PHP, you just have to already know the name, or guess it. And, of course, while many of the array functions are array_{whatever}, but the some functions are just {whatever}. Ach! If anyone is using the NetBeans IDE for development, the PHP Manual Search plugin is very useful.
[eluser]NachoF[/eluser]
Im not sure if this is DM related but... Im having a problem connecting to database... on my localhost I cant connect to postgresql database but I can connect just fine to my mysql database.... when I try with postgre I get a blank page immediately... here are my two configs so you can see exactly what I changed. This works Code: $db['default']['hostname'] = "localhost"; Code: $active_group = "default"; I wish it could at least give me some kind of error
[eluser]OverZealous[/eluser]
@NachoF This will have nothing to do with DMZ. I use DMZ with PostgreSQL almost exclusively. Most likely you have PGSQL misconfigured for accepting IP connections. Make sure you have TCP enabled, make sure your pg_hba file is set up correctly, double-check your port, etc. Again, DMZ doesn't do anything special to connect to the databasem it's all CodeIgniter there. You'll want to ask about this on a different forum if my suggestions below don't help. Quote:I wish it could at least give me some kind of errorThat's because CodeIgniter suppresses DB connection errors for some odd reason. Edit the postgre_driver.php file and remove the @ from before pg_connect and pg_pconnect. Then you'll see connection errors. That stupid @ caused me no end of headaches when I thought my DB was timing out, and it was actually an intermittent DNS issue. Finally, if this is a production environment with more than a handful of users, I recommend looking into PGPOOL-II, which takes about 10 minutes to set up, and then don't use pconnect, because you will have issues on busy servers. DMZ 1.7.0 (which is basically done, I just need to update the docs, package it, and release it) has some tricks in place to really help cut down on the number of DB connections.
[eluser]hidechron[/eluser]
Hi codeigniter forums o/ I'm working on some relations, and i can't figure how can i do a relation within a relation. Maybe that's just wrong but it's the best way I found. Here a schema to illustrate what i'm trying to do (used cakeapp.com, nice to vizualise db) ![]() I'm simply trying to make the DMZ model of "games_users". Basically it says "Users have this game in that category". So I've done the obvious part: Code: class User extends datamapper Code: class Game extends Datamapper And I browsed the really good DMZ documentation but i can't figure at all if I can do something like this or even another way. Can I have some help here, please ?
[eluser]OverZealous[/eluser]
@hidechron I'm not sure what you want, but there's two possible answers: If you only want one copy of each game per user, but want to assign different categories based on the user: You can use Join Fields to store the category on the join itself. For example, add a category_id column to the join table, then you can include use column in your queries. It's not very elegant. If you are trying to allow a user to have several copies of the same game stored in different categories: DMZ only supports one relationship between two objects. The solution is to create an interim model that handles the more complex connections: Quote:User has many User_categories User_category is simply an object to handle the connection. Then you can use Deep Relationships to build your query, like so: Code: // list games for this user and category It can be a more complicated issue when adding and removing connections: Code: // removing examples. Adding is similar Well, that became much more extensive than I had originally planned.
[eluser]hidechron[/eluser]
Thank you, that helped a lot. At first I was simply aiming at your first solution, and although I already read the join_fields function, I still overlooked it, thinking it was like a SQL join, for absolutely no reason. But cause on the best scenario I wanted users to be able to catalog the game they played in the category they need, meaning a game could be added to different categories. (ex: Mario in -NES-, and also in -completed-) So I went for a solution more (or exactly?) like your second one. <img src="http://uppix.net/7/2/c/aba98b355728e69f0231a5ae074e1.jpg" border="0"/> The join table named "categories_games" risk to end being really massive but since it's only id's, that may do it. But for now it's late, I'll study this more closely tomorrow hoping the light is getting closer ![]()
[eluser]OverZealous[/eluser]
Version 1.7.0 has been just been released This is a major update to DMZ! Not only does it include these fantastic new features: • Automatic Localization - I just snuck that one in... • Amazingly easy Paged Queries • New methods for streaming query results • PHPDoc documentation has been added for almost every magic method, which can be used for code-hints in an IDE • A brand-new extension for finding the row of a given object or id • And a whole lot more features. But this version includes a staggering number of small performance improvements than, when added up, can reduce page processing time by as much as 50% (even on simple pages!), and reduce memory overhead by nearly as much, especially when combined the new get_iterated method! There also have been a variety of bug fixes, and tweaks throughout the code base. Make sure to check out the changelog — you won't want to skip this update! PLEASE DISCUSS VERSION 1.7 HERE Quote:Download the Latest Version Here
[eluser]Wazzu[/eluser]
[quote author="OverZealous" date="1264988794"]DMZ already uses LAST_INSERT_ID[/quote] Sorry guys, but how do I get LAST_INSERT_ID after a save() call? I can find nothing in the user guide. Thanks very much
[eluser]OverZealous[/eluser]
@Wazzu Code: $User = new User();
[eluser]GregX999[/eluser]
Oooo... I'll need to get v1.7. But, before I do, I have a question: Should this work? Code: $x = $category->product->where('product.id', $product_id)->count(); My Category model has: Code: var $has_many = array('product') But I get the error: Fatal error: Class name must be a valid object or a string in /blaa/blaa/blaa/application/libraries/datamapper.php on line 1730 Greg |
Welcome Guest, Not a member yet? Register Sign In |