![]() |
DataMapper 1.6.0 - 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: DataMapper 1.6.0 (/showthread.php?tid=11358) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]PoetaWD[/eluser] Another question... :S Like, I have the Document object and related to it Document Type and Profiles(Clients) objects, I want to build a HTML table that will have: Id | Client Name | Document Type -------------------------------------------- 1 | Jonh | File 2 | Marie | Folder In my controller: Code: $obj = new Documento(); In the view file: Code: foreach ($objetos as $lista) I am kind of lost now... dont even know where to look,,, ![]() Thanks in advance DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]OverZealous[/eluser] OK, for starters, does Document have one or many Users? One or many Document Types? I would guess you only have one. If you only have one, you don't need the ->all. You just do this (for example): Code: $type = $obj->typesdocuments->get(); As for your question, the original DataMapper doesn't provide a way to join these results. You will have to pass in all Documents to your view, then loop through each document, get() the user and type, and process them: Code: <? foreach($documents as $doc): If you were to try DMZ, you could actually include columns from $has_one related items and reduce your number of queries substantially. It would look like this in the controller: Code: $documents->include_related('profile', array('name')); // include just the name column And this is your view: Code: <? foreach($documents as $doc): ?> I don't have everything labeled the same, so I apologize if that trips you up. Also, a suggestion: 1) Make sure you name your variables correctly. It's confusing (for me at least) to have a variable called $objetos, because there is no meaning to your variable. If you had called it $documents (or whatever is correct in your language) – and passed it in as 'documents' – it would be easier for you to read and any developers down the road. DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]PoetaWD[/eluser] Thanks MAN ! Now I understand why the DMZ is better ! I will update right now ! I will also try to do as you said and post the results here ! Thank you very much for the quick help ! Update: As quick as it was... IT WORKED !!! Much better !!!! Thank you !!! I guess that I will have to post questions in the DMZ topic ! Thank you man ! This is great ! DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]tdktank59[/eluser] @OverZealous If Im not mistaken his variables are in spanish. So they do have meaning lol... (I know it was trippen me up too.) DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]OverZealous[/eluser] Yes, well, objetos = objects, I assume, so it doesn't really reflect the meaning of 'documentos' or 'perfiles'. That was the point of my suggestion, not a language issue. DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]PoetaWD[/eluser] Those are portuguese words... ![]() I am from Brazil... Where u guys from ? Btw I keep going with the development of the application... so far so good... thanks for the help you are giving me. DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]OverZealous[/eluser] I'm from Michigan, USA. But I work overnight usually, so I'm up with the Aussies and Kiwis. :-) DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]PoetaWD[/eluser] [quote author="OverZealous.com" date="1246006885"]I'm from Michigan, USA. But I work overnight usually, so I'm up with the Aussies and Kiwis. :-)[/quote] Hey man ! I work at night too... not a fix job.. I work as a webdesigner in my free time. I am still a student, I spent 2 years of my life in medical school... but got tired... Now I am going to civil engineering.. but most of my time I spend in the computer... I got tired of PAYING other people to do my programing work.. so I am learning... It is pretty easy to learn the language... the hard is to get the tricks... I am realizing that experience is 99% of programing... Well thanks for helping me... I am trying to think something that I might have that would interest you since I dont have any money to donate... ![]() I have a premium rapidshare account that I might be able to share with you ? I also have a premium account at dreamtemplate.com . You can ask me any template and I will send it in your email. Hehe... I know that is not much and that you didnt ask.. but I like you and would like to give you something in exchange for your help. ![]() DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]OverZealous[/eluser] You could send me a souvenir from Brazil! My wife actually has some friends in Brazil, but she always gets cool stuff, not me ;-) Of course, that's probably too expensive, anyway! What part of Brazil are you from? Otherwise, I host my own server (I have a business plan for my home, which is nice), and I do a lot of my own graphic design :cheese: DataMapper 1.6.0 - El Forum - 06-25-2009 [eluser]PoetaWD[/eluser] [quote author="OverZealous.com" date="1246010554"]You could send me a souvenir from Brazil! My wife actually has some friends in Brazil, but she always gets cool stuff, not me ;-) Of course, that's probably too expensive, anyway! What part of Brazil are you from? Otherwise, I host my own server (I have a business plan for my home, which is nice), and I do a lot of my own graphic design :cheese:[/quote] I sure can ! I do too most of my work... but something I need some "inpiration" a place to start... so I go there, in the template website,, Hehe ... I am from Belo Horizonte... not near the beach... more in the center of brazil. I lived one year in US as a exchange student, in Virginia... It was pretty cool... I love US... I plan (DREAM) going back one day... maybe after I finish college... Just tell me what u want and i´ll try to send you... hehe :-) I am done for today.. 3am here... See ya |