Welcome Guest, Not a member yet? Register   Sign In
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition)

[eluser]bEz[/eluser]
@phil
Quote:Yeah, although untested, you can see I have yet to shorten my coding with the updated constructor method.
As for the use of ->where_related(), I see where I need to adapt to the manual a bit more myself.

@Jinkusu
Quote:Glad you got it resolved, I'm just helping out where I can. I'm not a guru with DMz ( yet Wink ), but I too have need for complicated data retrieval.
The methods that are short-handed by DMz is amazing, now if only the extensions included "ajax" methods, then I'd be like a baby with a bottle!

-bEz

[eluser]OverZealous[/eluser]
@bEz

One thing I'm trying to avoid is including any sort of JavaScript with DMZ. AJAX methods, by definition, require JavaScript. But there are dozens of decent-to-good JS libraries out there.

For example, I use Dojo Toolkit, because it includes a phenomenal widget library and base for creating your own widgets. However, I have used Prototype and jQuery in the past. Many others use YUI, or Google's library. All are decent, but they also all require significantly different approaches for writing your JS code, even as basic as how you structure your objects and manipulate the DOM.

I do, however, include an extension for converting objects into JSON. You can also use the Array extension combined with json_encode for the same thing. That's part of the AJAX equation. Well, part of the AJAJ equation, at any rate!

[eluser]bEz[/eluser]
Oh, I have already realized that my only bridge to JQuery is the use of JSON encoding/decoding methods. :cheese:
I was just looking at ways in which to enhance the htmlform extension.

I have peaked at a few of the blog libraries which use AJAX in the control panel coding.

[eluser]KSiimson[/eluser]
Can I join a table which has a primary index that is not "id" and is not numerical? I would like to use a database table that is being used by other applications, so changing the primary index would break those apps.

My guess is that "other_field" can be used for that. But I am not sure how would the join table look then?

Edit: Sorry, I think I found the appropriate documentation for that here.

[eluser]Jinkusu[/eluser]
Hail guys,

is their anyway to restrict a query to the records already loaded in an object?

Code:
$enrollments->where_related_student($student)->get();
$enrollments->where_related($courses)->get();

The problem is that instead of the second query being limited to the results of the first it queries the entire DB and only return the results of the second.

[eluser]OverZealous[/eluser]
[quote author="KSiimson" date="1254361515"]Can I join a table which has a primary index that is not "id" and is not numerical? I would like to use a database table that is being used by other applications, so changing the primary index would break those apps.[/quote]

No, you cannot do this. Every DataMapper item must have a unique, auto-generated numerical ID.

The closest you can get to what you had before is to add an extra, DMZ primary key, and use your non-numerical ID as a different UNIQUEly indexed column.

The document you linked to is about managing complex relationships, but you still must use numerical indexes.

[eluser]OverZealous[/eluser]
[quote author="Jinkusu" date="1254368635"]is their anyway to restrict a query to the records already loaded in an object?[/quote]

You'll need to create an array of all IDs already loaded, and use where_in_related.

[eluser]Jeffrey Lasut[/eluser]
@OVerZealous
Properly the 10.000th time you’re declared godlike, but still I’m going to do it again: It’s an awesome library.

I’ve been searching the form but couldn’t find a answer tot fowling question:
Is there a way to extend a model class, I don’t mean Model to MY_Model but a Model that inherits the functions of another one.

Example:

Code:
class Node extends DataMapper {
    var $table = ‘node’;

    function get_node() {
        //do some db stuff
    }
}

class Page extends Node {
    function get_page($id) {
        $page = $this->get_node($id);
        // do some stuff with var page
        return $page;
    }
}

class page extends controller {
    function index($id) {
        $page = new Page();
        $page-> get_page($id);
    }
}

Thanks in advanced.

Jeffrey

[eluser]Jinkusu[/eluser]
@Jeffrey Lasut
Quote:Is there a way to extend a model class, I don’t mean Model to MY_Model but a Model that inherits the functions of another one.

Could this be what your looking for, its not DMZ, its Datamapper, the first generation somewhat.

[eluser]Jeffrey Lasut[/eluser]
@Jinkusu
Thanks for the reply, the link you send looks promising.
Going to the gym right now, when I return I'll take a look at it.




Theme © iAndrew 2016 - Forum software by © MyBB