Gas ORM |
[eluser]toopay[/eluser]
@brunobarros, In version 2.0, there will be more flexible way to do that. In version 1.X, i'm affraid, it was the only solution. Not too pretty for sure, to have those, but at least it works as expected
[eluser]quasiperfect[/eluser]
i tried to use gas but i get a error maybe someone can help the error is Fatal error: Class 'User' not found i use latest gas,codeigniter from git and @wiredesignz hmvc extension i even tried to load user model but no luck i get Fatal error: Call to undefined method Gas::load_model() in my gas config i have Code: $config['models_path'] = array(APPPATH.'models', APPPATH.'modules'); i have models/user_gas.php Code: class User extends Gas and i call gas like this Code: $data = array(
[eluser]toopay[/eluser]
I cant replicate those behaviour. What version you are using? In very earlier version, it just accept string at `models_path` configuration.
[eluser]khavayero[/eluser]
Hello Toopay, I have a easy questions, When I use static method for save a record, the method errors is empty, why? Example: Code: $sales = new Sales(); <b>But.....with static method</b> Code: if (Gas::factory('sales')->fill($arrSale, TRUE)->save(TRUE)){ Thanks a lot!!
[eluser]quasiperfect[/eluser]
@Toopay i solved my previous problem by redownloading gas now i have a diferent question let's take as example a dating site where a user has a profile page and people can post comments on that page and comments to comments each comment is created by a user for another user and belongs to some user, or some comment my tables are Code: CREATE TABLE `users` ( if you don't understand tell me and i will try to make a better example how can i define the models for this situation ? how can i get all the comments for a user ? if i delete a comment that has children will the children be deleted ? best regards, ionut
[eluser]toopay[/eluser]
@khavayero, There are at least two same reports, regarding those issue. But at this momment, i really dont have a time to do throughout test, related with that issue (and auto-time stamp issue in some place), due i am in a serious attemp to make most of PDO driver(s) fully working on CI, since latest version of Gas will rely (or at least i will recomend anyone to do so) on PDO. So, for now, you could use that factory method to hydrate a Gas instance instead instantiate it. @quasiperfect, At least, i could see a potential issue, with those schema. I probably will ended to this schema, for those task : Code: # Note that each of gas model, could have more than one relationship type as long as different relationship type not pointing into same referal table.
[eluser]quasiperfect[/eluser]
@toopay thanks for responding not sure if i get your schema i will need 3 models ? or i need to define multiple relationships in user and comment ?
[eluser]Jazmo[/eluser]
What is the status of 2.0? I'm about to start to use Gas to my projects, should i start with 1.4 or go directly for 2.0?
[eluser]quasiperfect[/eluser]
i think i got the hang of it i have some problems with saving how i can save related objects i have users with a table comments with another the relationship is has_and_belongs_to with a join table that should contain the id's of user and related comment we get the user by $new_user = Gas::factory('user')->find(1); how can i add a new comment to the user ? comment addtionaly to the relation with the user is related to self how can i save a new comment to the same user but as a reply to the previos comment ? thanks in advance for any help
[eluser]toopay[/eluser]
@quasiperfect, So in your case, you need to save an entry within 'comment_user' to related a newly created comment to some user, yes? You could perform additional task within a model in save state, either at before_save or after_save hooks. You will either have to write a raw SQL to insert that related entry or use CI query builder analog method. eg : Code: function _after_save() This post asking the same thing, and i answer why gas doesnt need those. @Jazmo, My application(s) still using version 1.X. Its stable, despite there is small issue on object instantiation which easily resolved by using factory method. Iam not going drop support for this version, and those issue will be fixed in near time. But there will be no additional feature develop on it, in the future. While this version fits with most of typical CI project, if by any reason, your project become grow and you think you need all PHP5 benefits to help you in your gas model(s), you could upgrade later. I will make sure upgrading process from this older version to new version, as easy as possible. Version 2 is almost complete, but still not recommended to anyone to use it on any actual project in this time. It tend for one who think they deserve to use PHP5 benefits all over the place. It use namespace, spl autoloader, and many magic method(s), which would need PHP 5.3 as requirement. And iam also in an attemp to make the latest CI fully support for PDO, since this new version will rely on PDO as the main DBAL (however, will still alow native driver(s) as secondary option). You could track the status of this version on the Gas ORM repo. |
Welcome Guest, Not a member yet? Register Sign In |