Welcome Guest, Not a member yet? Register   Sign In
DMZ 1.7.1 (DataMapper OverZealous Edition)

[eluser]Skipper[/eluser]
Indeed, with the small change, this works perfectly well for me:
Code:
echo(json_encode($wc->error->all));

Thanks!

[eluser]Skipper[/eluser]
It seems that enum's are not mentioned anywhere. I googled both this thread and the documentation: Nada

This is probably something for the DMZ wishlist: Having enum validation and an array of enum-permitted-values of a field. Or maybe I am blind, and everything is already there?

[eluser]OverZealous[/eluser]
@Skipper

This is PHP, not Java ;-)

If you want to validate an input, just set up a custom validation rule. There's really not any reason for DMZ to have more specialized support than that.

[eluser]Skipper[/eluser]
[quote author="OverZealous" date="1277137027"]This is PHP, not Java ;-)[/quote]

Lol, true. Actually, I was musing over MySQL's enum as in
Code:
CREATE TABLE foobar ...
`unit` enum('box','pcs','kg','gr','ml','l','m','cm','mm','hrs','min') NOT NULL,
...
where I considered DMZ closer to validate. Your (deprecated) forms library knew about enums for drop-downs, IIRC, so I stupidly believed that DMZ would also. :red:

Anyway. Custom validation does this nicely as well, although not as DRY as I have hoped.

Cheers!

[eluser]OverZealous[/eluser]
@Skipper

Sounds like that would be a great case for a DMZ extension. Seeing as that is a MySQL-only feature (and I don't use MySQL in my own apps :-P ), it wouldn't work as part of the core library.

However, you could most likely code that as an extension, and it would be highly reusable. For example, if the method was called rule_enum, it could handle looking up the enum values, and doing the checking. (You'd probably want to cache the results of the enum lookup somehow.)

[eluser]happydude[/eluser]
Errm

Noob DMZ question: If my model is user, should the file be saved as user.php or user_model.php?

If its meant to be user.php, will it still work if I save it as user_model.php?

[eluser]happydude[/eluser]
And errmmm... another noob question (cause I'm starting to really get into databases and ORM), for DataMapper, which engine is better: MyISAM or InnoDB.

This is because DataMapper tries to emulate the foreign key capabilities of InnoDB

[eluser]jpi[/eluser]
@happydude

Regarding your naming problem, why don't you try both and see what's working ? Then, if you still don't know the answer, try to read the awesome documentation of DMZ. OverZealous put a lot of effort on it.

The MyISAM vs InnoDB problem is complicated. As a quick answer, I would say that it doesn't matter at an early stage of developpment and small DB size.

[eluser]happydude[/eluser]
As per my first question, I was still reading the documentation for the first time and kinda missed the part about naming... There's no need to be sarcastic. Its a matter of posting an answer if you have it.

For the second question, the DB is not small... and I am still modelling it, so I need to know what works best with DMZ before I start any coding at all.

Thank for your help all the same.

[eluser]OverZealous[/eluser]
@happydude
I don't think that jpi was being sarcastic. I think he was letting you know that the docs explain the naming convention. You kinda need to expect a little bit of that if you ask beginner questions before reading the documentation, though. ;-)

As far as DB type - DMZ doesn't care which type of DB you use. I'm not a big MySQL user, but if I remember correctly you don't get proper transactions unless you use InnoDB. For any application bigger than a simple website, transactions really are the difference between a web toy and a safe app for multiple users.. You should double check which table type, though.




Theme © iAndrew 2016 - Forum software by © MyBB