IgnitedRecord 1.0 pre-release |
[eluser]ben_co[/eluser]
You're right! It's exactly the type of structure I use. And indeed, there are problems when it comes to relations because you must set up the array of keys that are involved in the process. It was why I asked that question :-). By the way, it's a great library though ;-)
[eluser]Jeffrey04[/eluser]
Is there any way to know whether the result is being saved successfully? Does save() returns any value indicating whether the insertion/update is done successfully? when I create a new record using new_record(array(...)), do i have to include the id element even though I don't have it? eg. Code: $this->model->new_record(array('gid' => '', 'field' => 'field_value'); i am getting an error if I do something like this (without specifying the id) Code: $this->model->new_record(array('field' => 'field_value')); Code: <?php Quote:Message: Undefined index: gid
[eluser]m4rw3r[/eluser]
1. No, not for the moment (I'll implement it) 2. No, you do not need to include the id element (or any other column which is not marked as NOT NULL in the db). About the new_record() error: It is an error in the constructor of the IgnitedRecord_record object (completely forgot that the array does not always contain the id :red: ). Quick fix: Code: // at line 144 change: Does anyone have any suggestions for version 0.1? The list and revision behaviour will not be in 0.1, as I have not got enough time (and I haven't come up with a nice idea for the revision behaviour). Also, the JOINS will come later (if they can, I have some problems with their flexibility, so I don't know (will make some benchmarks and see if the flexibility loss (from the JOIN methods) is justified)).
[eluser]Jeffrey04[/eluser]
Thanks, may I know as well whether is it possible to put ignitedrecord into the libraries folder instead of models?
[eluser]m4rw3r[/eluser]
It should be working wherever you like to place it, there are one condition though: The Model class must be loaded before IgnitedRecord. So it's a bit more code if you want to put it in the libraries folder: Code: // of course, this is not the only way the usage: Code: class example extends Controller
[eluser]Jeffrey04[/eluser]
Thanks for the responsive reply :red: one more question, does the model call other related models if I run a save() method that save record into two databases?
[eluser]m4rw3r[/eluser]
No, I'm afraid not. But if you attach a newly created record (not saved) to a related one, both will be saved (they will be saved anyway, with the new data). Example: Code: $rec1 = $this->page->new_record();
[eluser]m4rw3r[/eluser]
I made a benchmark of the JOIN and "normal" way of fetching relations, and I came up with a very surprising result: Code: Has Many (1 linked in table) 1000 repetitions: The tests were made with both the server and database on the same computer, so they may differ (tell me if they differ a lot on your system, or something). I guess I could have messed up somewhere in my code, so I post it here: Code: // controller: BTW. I'll probably release 0.1 soon :-)
[eluser]m4rw3r[/eluser]
IgnitedRecord 0.1.0 is out! :-) I have now created a project space at assembla: IgnitedRecord There are not very much there yet... But it will come with time. Here are the changes: - Limited support for multiple primary keys have been implemented - save() now returns true if the INSERT/UPDATE query succeeded - Added set_belongs_to(), set_has_many(), set_has_one() and set_habtm() (Has And Belongs To Many) - factory() does not need the double underscores in the property names, double underscores are automatically added - save() now only saves the record if it has been edited - Because of the new save(), a $force option has been added - The IgnitedRecord_tree have got get_descendants() - A custom loader has been implemented. - $__habtm can be used exactly like $__has_and_belongs_to_many, they are merged in the constructor Bugfixes: - id column does not exist when creating a new record - Misspellings and typos in the manual Feel free to comment and make more suggestions! |
Welcome Guest, Not a member yet? Register Sign In |