Gas ORM |
[eluser]toopay[/eluser]
Its a mistake. Already spotted, fixed and merged into recent codebase three months ago
[eluser]darkylmnx[/eluser]
Hi, i tried to do an auto-create models from database, it does the "SHOW TABLES FROM `database` " but it doesn't generate the models i set the migration lib config to TRUE and the auto_create_models to TRUE, but no models generated... any idea ? ---- I found the problem. Now new problem, it show me Code: Message: mkdir() [function.mkdir]: No such file or directory there are lot of relations in my table if that helps to understand.
[eluser]Thibaut L.[/eluser]
Hi, I wanted to know how I can use Gas ORM with two databases ? In my database.php I've set up my "default" DB connection, and a "secondary". But how in my ORM model I can set which connection I use ? Thanks in advance
[eluser]toopay[/eluser]
@Thibaut L. Your model won't care and they are not aware about the connection you used at a time. You need to tell \Gas\Core class to change from one connection into another. Gas model always use static connection from the core class. Code: Gas\Core::connect('default'); As described here
[eluser]Thibaut L.[/eluser]
Thanks it's working ! Another question, I try to use validation in my model like the documentation, but I am able to save my user in the database without setting username whereas I've set 'required'. Code: <?php Controller : Code: $user = new Model\Members\User(); No errors and my User is saved in my DB..I don't understand.. I use HMVC module for CI..
[eluser]davidsoussan[/eluser]
How do I add multiple children to a new parent? Currently I am only getting the last child saved. Code: public function create_default_settings() { This happens when I add them individually as well. Do I have to add them one by one and call save() each time?
[eluser]seegithub[/eluser]
mas toopay saya tanya dong masalah eager loading, masih bingung soalnya dokumentasi nya gas masih sedikit banget. saya punya table account fields: - id - username - group_id table group fields: - id - group_name settingan model account ke model group kan -> has_one, trus model group ke model account -> has_many nah saya coba melakukan query dengan code: Code: //saya mendapatkan semua records dari table account ditable account kan ada group_id tuh mas, saya mau covert jadi nama group nya, saya gak mau join table karna akan menambah query lagi, trus kl me-looping foreach pake eager loading versi gas ORM ini bagaimana ya mas? mohon bantuannya. saya coba gini gak bisa: Code: foreach ($u as $d) { terima kasih banyak mas toopay
[eluser]davidsoussan[/eluser]
[quote author="Thibaut L." date="1373471722"]Thanks it's working ! Another question, I try to use validation in my model like the documentation, but I am able to save my user in the database without setting username whereas I've set 'required'. Code: <?php Controller : Code: $user = new Model\Members\User(); No errors and my User is saved in my DB..I don't understand.. I use HMVC module for CI..[/quote] It took me a while to figure this one out because it is on a different page: you have to padd TRUE into the save method to trigger validation. Code: $user = new Model\Members\User(); Now all I have to do is to figure out how to stop it throwing a validation error on fields that I define as nullable
[eluser]koichirose[/eluser]
Hi, I'm not sure if this topic is still active, but I'm having this issue: Code: if (!empty($deal->start_date)) { $deal is a Gas object, of course. What is going on here? Looks like the property is there and not empty, but somehow it doesn't work with empty(), and I'm guessing with other functions, too.
[eluser]koichirose[/eluser]
Hi, I don't understand how to fetch an object while filtering its related objects. Example: Code: $this->data['sites'] = Model\Site::with('deal')->all(); //I'd like only deals with 'is_active=1' here, how do I do that? Thanks |
Welcome Guest, Not a member yet? Register Sign In |