Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM v2.0 - Input requested
#11

[eluser]InsiteFX[/eluser]
Code:
`status` enum('active','inactive',deleted') not null default 'active',

// if you do not specify a string value like 'active' etc;
// MySQL will default to an integer index
// where 0 = error 1 = 'active' 2 = 'inactive' and 3 = 'deleted'

Even CI Active Record doe's not handle enum's

Not sure if there you can add something for this or not just a thought...
#12

[eluser]WanWizard[/eluser]
I know what enum is, I was just wondering what the use-case was.

From a SQL point of view, it's a value like all others, so what do you want to do that you currently can't? Perhaps some code example, or pseudo code if that's not possible?

Currently it's not clear to me what functionality you want me to implement.

(DM used CI's DB classes, so I might end up having to send CI a pull request instead of modifying DM).
#13

[eluser]Maglok[/eluser]
For the record: I use Datamapper at work (big university) and at home all the time. It is really making things much easier. Keep up the good work!

As for suggestions... thing is I studied computer science in dutch, thus some of the terms are just a bit iffy for me.

I wonder if I can do the following in datamapper:

Code:
class Person extends Datamapper {
  // Stuff
}

class Managers extends Person {
// Get both person and manager specific stuff
}
#14

[eluser]WanWizard[/eluser]
No, you can't.

DataMapper follows (very confusingly) the Active Record design pattern (which in turn should not be confused by what CI calls active record!). This pattern maps one table row to one object.

[quote author="Maglok" date="1328543730"]I studied computer science in dutch[/quote]
So did I, but probably in a different era... Wink
#15

[eluser]Maglok[/eluser]
Then I'll just stick with a user has_many managers and a manager has_one user. Smile

Dutchies!

Class of hmmm 2006? Hogere Informatica Enschede. It was all about OO with us, all so very modern. Wink

Keep up the good work!
#16

[eluser]WanWizard[/eluser]
2006? No, not really.

Class of 1989, HIO Eindhoven, and I programmed 68000 single board computers. Which at that time was very modern too... Wink
#17

[eluser]Maglok[/eluser]
This is why you do these sort of things. Maybe I'll try my hand in 17 years or so Wink
#18

[eluser]WanWizard[/eluser]
Don't wait until you're old, do it now. You're going to regret it later if you don't...
#19

[eluser]Frank Wong[/eluser]
@WanWizard, I noticed that when loading relationships, it queries everything in the child table and then it filters via code. Can you confirm this or am I messing up the relationship setup? Thanks.
Code:
$account = new Account($id);
$sql = $account->book->get_sql();
echo $sql;

Result
Code:
SELECT * FROM (`books`);

I thought the orm would do something like
Code:
SELECT * FROM (`books`) WHERE account_id = [id];
#20

[eluser]WanWizard[/eluser]
It shouldn't.

If you get this usually there is something wrong with the relationship, or $id does not exist and $account does not contain something to JOIN with...




Theme © iAndrew 2016 - Forum software by © MyBB