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

[eluser]OverZealous[/eluser]
No problem. Don't stop asking. I'll let you know if I'm too busy :-P

(For future reference, since this is a forum, there isn't really a need to quote the messages I write. It just means more to scroll through ;-) )
#52

[eluser]Freshinc.Olly[/eluser]
ok, just to clarify...

My table (used for messages):

MESSAGE_ID
FROM_USER_ID
TO_USER_ID
SUBJECT
MESSAGE
DATESENT

Two foreign keys, both to the same field in the same table, i take it this is possible to do with your version of the datamapper. So when the user is in sent items i can go $user->message->from and if i were in inbox i would do $user->message->to or however you do it, but something along those lines.

The principle applies to a number of other tables within my databse, so i would really appreciate your 2 pence on this one.

Regards
Olly
#53

[eluser]OverZealous[/eluser]
@Freshinc.Olly

Code:
// in class User
$has_many = array(
    'sent_message' => array(
        'class' => 'message'
        'other_field' => 'from_user'
    ),
    'received_message' => array(
        'class' => 'message'
        'other_field' => 'to_user'
    )
);

// in class message
$has_one = array(
    'from_user' => array(
        'class' => 'user'
        'other_field' => 'sent_message'
    ),
    // this could instead be in the has_many, if you prefer
    'to_user' => array(
        'class' => 'user'
        'other_field' => 'received_message'
    )
);

// usage
$user->save_received_message($message);
$message->save_from_user($user);
// etc., there are plenty of examples of this
#54

[eluser]bEz[/eluser]
@phil,

If CI wasn't the greatest thing since slice bread, DMZ would hold that distinction.
I hope that the readers of this thread take to heart the level of general support you have put in to this library (as well as the DM thread).
I'm sure the personal goals we have for this library, and support we have received on DMZ, will allow it to mature.

Thanks for the recent support, although indirectly, it helps! Wink
#55

[eluser]MeanStudios[/eluser]
I second what bEz has said. Thank you *very much* Phil Smile. I really appreciate all your help!
#56

[eluser]NachoF[/eluser]
... I dont know who Phil is but Im guessing that is OverZealous(confirmed, just read it on his sig.)... if so then yes, I agree, this thing is awesome... thanks to overzealous and stensi for creating datamapper and dmz... I have said it before, I wish it would get added to the core of CI so that people can create their libraries/plugins (like a scaffolding plugin!!!!) based on it.....also, why do people use ignited record?? its just nowhere near as cool as dmz
#57

[eluser]NachoF[/eluser]
What are the chances of an app I developed locally with a new xampp install working on a web host that has php 4.4 and mysql 3.23??... I used datamapper dmz....I still have a copy of my app just using active record class before I migrated to datamapper.
#58

[eluser]OverZealous[/eluser]
Simple answer: DataMapper will not run on PHP4. At all. It cannot be corrected, because it requires PHP5-only features for most of the magic.
#59

[eluser]macigniter[/eluser]
I am confused about how to query 1:N or self-referencing relationships where there's an ***_id field for the other table.

For example: I have a "calendar" table which has a 1:N relationship to an "office" table as well as a reference to the "user" table as "editor" and "worker".

When querying the "calendar" table on a related office or editor, do I write that like this:

Code:
$c = new Calendar();
$c->where_related_office('id', $office_id);
$c->get();

$c2 = new Calendar();
$c2->get_by_related_editor('id', $editor_id);

OR do I have to do it like this:

Code:
$c = new Calendar();
$c->where('office_id', $office_id);
$c->get();

$c2 = new Calendar();
$c2->where('editor_id', $editor_id);
$c2->get();

It'd be great if you could let me know which way is correct...
#60

[eluser]NachoF[/eluser]
[quote author="OverZealous.com" date="1241785163"]Simple answer: DataMapper will not run on PHP4. At all. It cannot be corrected, because it requires PHP5-only features for most of the magic.[/quote]
>Sad ... I just hope that my version with just active record works on the server... otherwise Im in trouble lol.




Theme © iAndrew 2016 - Forum software by © MyBB