kohana

Kohana 3.0.x ORM: Read additional columns in pivot tables

醉酒当歌 提交于 2019-11-29 03:21:15
问题 I'm using Kohana v3 and ORM, I have two models, Model_A and Model_B related by "has_many" through a pivot table, which has an additional column. I can save data in that column in the pivot table using the third parameter of the add() function, but I can't figure out how to read that column using ORM. Any ideas? Thanks in advance. 回答1: You need to create a Model that is based on that pivot table if you want to access that additional column, let say we name it Model_A_B . class Model_A_B

zend-framework versus Kohana versus Symfony [closed]

天大地大妈咪最大 提交于 2019-11-28 21:40:38
Which one of this frameworks would you recommend to someone who knows the basics of PHP? What are the advantages and disadvantages? I wouldn't suggest any frameworks to someone who knows just the basics. Instead, I'd suggest to get a firm grip on OOP and the most common Design Patterns first, because that is what you will find in these frameworks. It also doesn't hurt to know your way around the various available PHP libs and extensions. I think frameworks are a double edged sword for beginners. You may be able to do more in less time in many cases but in other cases (not a few) you will make

Favourite Kohana Tips & Features? [closed]

泄露秘密 提交于 2019-11-28 13:11:04
问题 Inspired from the other community wikis, I'm interested in hearing about the lesser known Kohana tips, tricks and features. Please, include only one tip per answer. Add Kohana versions if necessary. This is a community wiki . 回答1: Generating Form::select() options from database result Kohana 3.1 and 3.0 $options = ORM::factory('model') ->order_by('title','ASC') ->find_all() ->as_array('id','title'); $select = Form::select('name', $options); It should be noted this is not restricted to the ORM

Kohana 3 ORM: How to perform query with 2 many to many relationships

最后都变了- 提交于 2019-11-28 13:01:53
I have a products model with 2 many to many relationships defined. protected $_has_many = array ( 'foodcats' => array('model' => 'foodcat', 'through' => 'products_foodcats'), 'foodgroups' => array('model' => 'foodgroup', 'through' => 'products_foodgroups') ) I need a query where I find products with a given foodcat id and a given foodgroup name. I know I can do the following to get all products with a given foodcat id $foodcat = ORM::factory('foodcat',$foodCatId); $products = $foodcat->products->find_all(); But how do I query for products in that foodcat that also are in the foodgroup 'Entrees

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

zend-framework versus Kohana versus Symfony [closed]

拥有回忆 提交于 2019-11-27 14:03:43
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Which one of this frameworks would you recommend to someone who knows the basics of PHP? What are the advantages and disadvantages? 回答1: I wouldn't suggest any frameworks to someone who knows just the basics. Instead, I'd suggest to get a firm grip on OOP and the most common

What is the HMVC pattern?

拈花ヽ惹草 提交于 2019-11-27 10:03:26
Reading Kohana's documentation, I found out that the main difference in 3.0 version is that it follows the HMVC pattern instead of MVC as version 2.x does. The page about this in Kohana's docs and the one on wikipedia didn't really give me a clear idea. So question: what is the HMVC pattern and how does it differ from MVC? shadowhand Sam de Freyssinet (one of the Kohana developers) wrote a rather in-depth article about HMVC , what it is, and how it can be used. Link is dead: New Link - https://web.archive.org/web/20160214073806/http://techportal.inviqa.com/2010/02/22/scaling-web-applications

Kohana 3 ORM: How to perform query with 2 many to many relationships

最后都变了- 提交于 2019-11-27 07:28:12
问题 I have a products model with 2 many to many relationships defined. protected $_has_many = array ( 'foodcats' => array('model' => 'foodcat', 'through' => 'products_foodcats'), 'foodgroups' => array('model' => 'foodgroup', 'through' => 'products_foodgroups') ) I need a query where I find products with a given foodcat id and a given foodgroup name. I know I can do the following to get all products with a given foodcat id $foodcat = ORM::factory('foodcat',$foodCatId); $products = $foodcat-

Optimizing Kohana-based Websites for Speed and Scalability

时光毁灭记忆、已成空白 提交于 2019-11-27 05:43:52
A site I built with Kohana was slammed with an enormous amount of traffic yesterday, causing me to take a step back and evaluate some of the design. I'm curious what are some standard techniques for optimizing Kohana-based applications? I'm interested in benchmarking as well. Do I need to setup Benchmark::start() and Benchmark::stop() for each controller-method in order to see execution times for all pages, or am I able to apply benchmarking globally and quickly? I will be using the Cache-library more in time to come, but I am open to more suggestions as I'm sure there's a lot I can do that I

What is the HMVC pattern?

馋奶兔 提交于 2019-11-26 17:53:53
问题 Reading Kohana's documentation, I found out that the main difference in 3.0 version is that it follows the HMVC pattern instead of MVC as version 2.x does. The page about this in Kohana's docs and the one on wikipedia didn't really give me a clear idea. So question: what is the HMVC pattern and how does it differ from MVC? 回答1: Sam de Freyssinet (one of the Kohana developers) wrote a rather in-depth article about HMVC, what it is, and how it can be used. Link is dead: New Link - https://web