kohana-orm

Self referencing relation with followers|friends users

我的梦境 提交于 2019-12-01 14:00:41
To make relationship between users was created a table that looks like. sql CREATE TABLE `friends`( `from` INT NOT NULL, `to` INT NOT NULL, UNIQUE INDEX(`from`, `to`) ); As you may know - field from and to is a keys of user_id from users table. I'm using Kohana 3.09 with its default module Auth. Question is... *How to make ORM functionality around relations of users with (default) Model_User class?* Is there any needle to create additional class or perhaps i had some mistakes with relations one_to_many trouth and many_to_many trouth cause it did not work. Please help. My best regards. You

multi insert in kohana orm3

Deadly 提交于 2019-11-29 12:02:52
In my application i have a loop that executes about 1000 times, inside it i'm creating object and saving it. This is the part of application where i populate my database with data. In common this looks like this: foreach(...){ ... try{ $object = new Model_Whatever; $object->whatever=$whatever; $object->save();} catch(Exception $e){ ...} } } This produces 1000 of INSERT queries. Is it possible to, in some way, made kohana produce multi inserts. Split this into 10 inserts with 100 data sets in each. Is it possible and if yes that what is the way doing so? Whilst the Kohana ORM doesn't support

multi insert in kohana orm3

喜夏-厌秋 提交于 2019-11-28 06:15:45
问题 In my application i have a loop that executes about 1000 times, inside it i'm creating object and saving it. This is the part of application where i populate my database with data. In common this looks like this: foreach(...){ ... try{ $object = new Model_Whatever; $object->whatever=$whatever; $object->save();} catch(Exception $e){ ...} } } This produces 1000 of INSERT queries. Is it possible to, in some way, made kohana produce multi inserts. Split this into 10 inserts with 100 data sets in