IgnitedRecord 1.0 pre-release - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: IgnitedRecord 1.0 pre-release (/showthread.php?tid=7996) |
IgnitedRecord 1.0 pre-release - El Forum - 04-19-2009 [eluser]m4rw3r[/eluser] At your first quesion: IR doesn't support multi-fk-relations natively, but by adding a WHERE (as you said) you can fix it: Code: $this->select('COUNT(comments.id) AS `comment_count`', false); // don't forget the false (Cascades should preferably be configured in the database, but IR has the cascade_on_delete option for all has* relations (just set the key cascade_on_delete to true on one of the relation properties)). IgnitedRecord 1.0 pre-release - El Forum - 04-20-2009 [eluser]Jonas G[/eluser] Thanks for the reply. I must have misunderstood then - I though delete_all() would eg. delete my blog entry and all the related comments. But now I understand. Cascades I have never heard of, but I will read up on that. Thanks again. IgnitedRecord 1.0 pre-release - El Forum - 04-21-2009 [eluser]JasonS[/eluser] Hey, this may have been answered before but I have a question about generating forms. I have 3 form fields. Username, Email and Password. I want, by default for the password field to be blank. (Currently it fills with the sha1 key ) Then, if the password field is empty I do not want the field to be updated. This is where I am little confused. Where do I start on this? This is what I have. Code: public function edit($id) Code: class User extends IgnitedRecord Basically. I have 3 questions. How do I make the password field a password field? How do I make the password field blank? How do I check to see if the password field has been filled and update it? (I don't want to accidently update the password and wipe it.) Thanks IgnitedRecord 1.0 pre-release - El Forum - 04-21-2009 [eluser]m4rw3r[/eluser] For password field: Code: 'password' = array( Code: $user = $this->user->find($id) or whatever IgnitedRecord 1.0 pre-release - El Forum - 04-21-2009 [eluser]JasonS[/eluser] Thank you very much for your input and the speedy response. Its a great bit of kit and I really enjoy working with it. Just getting to grip with the finities . Could you tell me what the '__data' part does please? Thanks. IgnitedRecord 1.0 pre-release - El Forum - 04-21-2009 [eluser]m4rw3r[/eluser] The __data array contains a copy of the data stored in the object, and it is used to determine what has been changed. (No need to update if it hasn't been changed) IgnitedRecord 1.0 pre-release - El Forum - 04-22-2009 [eluser]Jonas G[/eluser] Hi again I'm having trouble with the find_all() function. I want to end up with this query: Code: SELECT DISTINCT `event_id` FROM `goals`; If I run: Code: $data['events'] = $this->goal->distinct()->select('event_id')->find_all(); I get: Code: SELECT DISTINCT `event_id`, `goals`.* I can't seem to find a way to not get the goals.* included unless i use get() instead of find_all(), but that limits the results to 1. What's the correct way of going about this problem? IgnitedRecord 1.0 pre-release - El Forum - 04-24-2009 [eluser]m4rw3r[/eluser] Well, find_all() adds `table`.* to the select, to be certain that it receives the correct data. In your case I would create the query with either ActiveRecord or IgnitedQuery: Code: // add this to your model or something: IgnitedRecord 1.0 pre-release - El Forum - 04-26-2009 [eluser]r2b2_kvr[/eluser] hello, i was just confused as to which version I'll use. 0.2 seems to be ok for me at the moment. Does 1.0 have the validation, form generation and the "through" relationship? Thanks! IgnitedRecord 1.0 pre-release - El Forum - 04-26-2009 [eluser]r2b2_kvr[/eluser] [quote author="m4rw3r" date="1240622817"]Well, find_all() adds `table`.* to the select, to be certain that it receives the correct data. In your case I would create the query with either ActiveRecord or IgnitedQuery: Code: // add this to your model or something: My solution to this is I edited IR and defined an attribute, (will post the code later) which when set before calling find_all() will only select specified field Code: $this->model_name->fetch_all_columns = false; I believe this is before the select method is invoke in IR's find_* methods. |