DMZ 1.7.1 (DataMapper OverZealous Edition) |
[eluser]Mareshal[/eluser]
A better approach at this moment. I already had my own config file: my_config.php A new line there: $config['dmz_models'] = "datamapper/"; and $file = $path . $CI->config->item('dmz_models') . $class . EXT; // ![]() You should make a setting for this in datamapper config file. Is a suggestion. I don't have time to digg in the code to add this to DMZ's config file.
[eluser]OverZealous[/eluser]
I respectfully disagree. There is already a perfectly good models directory included with CodeIgniter. I have yet to get a good argument for why you would want your models in a different location. DMZ also already searches the models directory recursively, so you can put your DMZ models in a subfolder of application/models, if you wish, no modification necessary.
[eluser]Mareshal[/eluser]
I respectfully apologize then. I didn't know that DMZ searches in subfolders. Thank you. I just wanted to keep my DMZmodels separated from the rest of the CImodels.
[eluser]OverZealous[/eluser]
I should have written: Quote:I respectfully disagree :-P ;-)
[eluser]Vinzent Zeppelin[/eluser]
Greetings, I am following the included example (somewhat) for a simple login procedure, but I'm running into a problem; namely, the login page itself only takes the username and password as parameters, but when a $this->validate()->get() call is run, it returns a MySQL syntax error. The query shown is along these lines: Quote:SELECT * FROM (`users`) WHERE `name` = 'Vinzent Zeppelin' AND `password` = '67174866a...etc' AND `other_field1` = AND `other_field2` = The relationship between `user` and `other_field1` and `other_field2` is a bit unusual in that both fields are foreign keys pointing to a single column in another table; in other words, it's a "has two" relationship. The "other_field1" and "other_field2" are flagged as "required" in the validation rules (they are required when saving a user), and they also are foreign key attributes listed in the $has_one array of the user model (following the model in "Advanced Relationships" of the user guide). The problem is, it seems that DMZ automatically "validates" these relationships and includes them in the WHERE clause of the query even if they're empty, generating a broken query. Removing other_field1 and other_field2 from the $has_one array seemed to resolve the error; removing their "required" flags in the $validation array did not. Is there a workaround of some sort, or have I overlooked something?
[eluser]Mareshal[/eluser]
I have this structure Users: user_id, user_name, user_email, user_site Article: article_id, article_title, article_link, user_id(FK.user_id -> Users) Can I produce this query with DMZ? Code: SELECT a.*, u.user_name, u.user_email, u.user_site
[eluser]Lord_Jago[/eluser]
[quote author="Mareshal" date="1272826158"]I have this structure Users: user_id, user_name, user_email, user_site Article: article_id, article_title, article_link, user_id(FK.user_id -> Users) Can I produce this query with DMZ? Code: SELECT a.*, u.user_name, u.user_email, u.user_site It's possible with the include_related function. Something like : Code: $article = new Article();
[eluser]Lord_Jago[/eluser]
Hi, I have a table USER which is self related (a many to many relationship). So I have the following structure : USER : id, username... SELFUSER : id, userA_id, userB_id I'm looking for a way to do one of these 2 queries : Code: SELECT u.* Or, Code: SELECT u.* Impossible for me to find an easy way to do it. The only solution I've found is to use subqueries, which is quite complicated and dirty for such a simple query. Thanks, Julien
[eluser]Wazzu[/eluser]
Advanced Relationship Hi all. I'm not able to understand how advanced relationships work. I've read user guide and made tests, but I can't understand how field names are used. This is my sample case: - table users(id, name) - table quotes(id, client_id, worker_id) - user model and quote model One user (worker_id) can create a new quote for other user (client_id). 'worker_id' and 'client_id' are in fact ids from users table. How should I make relationships? This is what I've done: Code: class Quote extends DataMapper { Code: class User extends DataMapper { Is that right? And from my controller, how should I populate this? I want to get something like this: Code: <?php Please, help me understanding this relationships. Thanks all
[eluser]NachoF[/eluser]
I just ran into a little trouble I need to use the sql query syntax like so. Code: $o=new Object(); I get Database error Quote:ERROR: column "id=2" does not existAm I missing something obvious? |
Welcome Guest, Not a member yet? Register Sign In |