DataMapper ORM v1.8.2 |
[eluser]WanWizard[/eluser]
As documented, you can use all supported query clauses in advanced queries, so that works fine. See http://datamapper.wanwizard.eu/pages/get...ry.Clauses
[eluser]CI-Newb[/eluser]
Hello, I'm using the following login function Code: function login() { I have different type's of account status like "expired", "suspended" etc. What would be the most efficent way to show a different error message for each?
[eluser]Maglok[/eluser]
@CI-Newb: You could try to select a different lang line for each? Code: $this->error_message('login', $this->lang->line('error_' . $u->status));
[eluser]CI-Newb[/eluser]
I don't think that would work because it's only getting a user if their status is active .. otherwise the user object is blank I believe
[eluser]Maglok[/eluser]
Wouldnt you need a User/Account object to see what the status of it is? If not you can always do it if it is an empty object on the default value. Lets say $user = 'inactive' by default, then you can use that? And for all others you need to get the account first?
[eluser]CI-Newb[/eluser]
edit: Although the suggested solution did work I've reworked the code here is my new login logic should anyone find it useful at some point in time. Inactive = can't log in, Suspended = can't log in, expired = can log in sets flash data asking to renew Code: function login() {
[eluser]Maglok[/eluser]
Great And on the flipside, it is quite quite early.
[eluser]Maglok[/eluser]
Alrighty self relationships 101. I go from this page on this: http://datamapper.wanwizard.eu/pages/adv...tions.html I have a very 'simple' self relationship. Never done those before in Datamapper and thus, issues. It is simple. I have a class ACCategory and it should have a has_many with more categories who are children of it, kinda like directories. Then it should also know its parent. Code: class ACCategory extends DataMapper { That is where I am at the moment. The database is like this: Code: TABLE: ccj_ac_category_parentcategory = id|category_id|parentcategory_id I am kind of stuck with the tablenaming conventions so that is a given. I get the usual 'category is not a valid parent relationship for ACCategory' error. EDIT: Now that I think about it, the parent_category should probably be only one, you can only have one parent in this case.
[eluser]WanWizard[/eluser]
'other_field' has to point to the relation from the other side, so in your first definition that should be 'categories', not 'category'. |
Welcome Guest, Not a member yet? Register Sign In |