kohana

Getting products with desired attributes

蓝咒 提交于 2019-12-12 05:48:15
问题 I have a category with products and a set of attributes. Those attributes are "Shape" and "Diameter". When I open a category without applying filters I get products with following query: "SELECT * FROM `products` WHERE `category_id` IN ('6', '7', '29', '8', '9', '36')" Then I click on attribute "Diameter"(id = 2) with value "8mm"(id = 4) I generate the following query: "SELECT * FROM `products` JOIN `products_attributes_values` ON (`products_attributes_values`.`product_id` = `products`.`id`)

Kohana 3.2 - i want to get distinct dates

夙愿已清 提交于 2019-12-12 05:03:54
问题 so i have a table with the following: id transaction_timestamp (TIMESTAMP CURRENT_TIMESTAMP) i would like to get distinct dates from the transaction timestamp using Kohana ORM i have a Model named Model_Transactions if i do this Model_Transactions::factory('transactions')->find_all(); i get all data. how would i get only the distinct dates since i would use it as an archive. i dont want the user to click on an archive and returns a blank table. for example: user clicks "April 01, 2012" since

Kohana The requested URL /home was not found on this server

可紊 提交于 2019-12-12 04:58:17
问题 I am getting this error from a red hat apache environment which is running php with a Kohana application. This application was migrated from a wamp installation where it was functioning. Currently if I hit the following URL I get a 404 error http://server/home But if I hit this the page renders http://server/index.php/home I assume this has to do with my .htaccess files, but I have been unable to resolve the issue. Below is the .htaccess file found in apache/htdocs where my application

Using this in an array is causing unexpected T_Variable

天大地大妈咪最大 提交于 2019-12-12 04:34:38
问题 I'm using Kohana 3.3 and trying to write a custom validation rule to ensure that users username and e-mail address are unique. I'm following the instructions from an SO question here, and the Kohana documentation here, but whenever I try to add in array(array($this, 'unique_email')) I get syntax error, unexpected '$this' (T_VARIABLE), expecting ')' . If I put array(array('Model_User', 'unique_email')) I don't get any errors, but why would using $this cause an error? For completeness I've

Connection to MSSQL from PHP Framework Kohana

对着背影说爱祢 提交于 2019-12-12 04:32:40
问题 I'm trying to connect a php application (using framework Kohana) with Microsoft SQL Server and It fails!!! Technical Context: Microsoft Windows Server 2012 R2 Standard. Framework Kohana v2.3.4. XAMPP Server v1.7.1: Apache v2.2.11. PHP 5.2.9. Microsoft SQL Server 2012 (Express Edition). Microsoft .NET Framework v4.0.20219.42000. Problem Summary: Apparently, the mssql driver is OK! I checked if the folder "...\xampp\php\ext\" has "php_mssql.dll" and if there are a reference with it in php.ini

Kohana 3.3 Model not loading on linux, but will on Windows

霸气de小男生 提交于 2019-12-12 03:49:27
问题 So I am struggling migrating to a linux server. I get the error ErrorException [ Fatal Error ]: Class 'Model_Game' not found My file structure is application/classes/Model/game.php And the model definition is class Model_Game extends ORM { protected $_table_name = 'game'; protected $_primary_key = 'game_id'; ... } This works in my windows environment, but not in my linux environment. From my understanding this is correct 回答1: You need to follow PSR-0 naming: http://kohanaframework.org/3.3

git submodule init ignore failed

扶醉桌前 提交于 2019-12-12 03:19:29
问题 I just pulled https://github.com/kolanos/kohana-universe and now I'm trying to update all the modules running: git submodule update --init --recursive Some of the repos are wrong or not existent anymore, and the command breaks in the middle. Is there an option for the command to ignore the failed updates? 回答1: The only way i know is to remove broken submodule. This is how you can remove submodules - How do I remove a submodule? 来源: https://stackoverflow.com/questions/9886905/git-submodule

Kohana ORM: Validate the $_belongs_to relationship exists

前提是你 提交于 2019-12-12 03:18:02
问题 I'm trying to get some validation setup for one of my ORM models. I have 2 tables: parent and children. In the children table, there is a column called 'parent' whose value is the primary ID of a row in the parent table. What I'm trying to do, is create a validation rule that checks the parent ID specified actually exists in the parent table. Is there an easy way to do this? 回答1: Well I did come up with one solution. I created a static method in my Model class that accepts an ID as a

Kohana many-to-many relationship “has many - through”

落花浮王杯 提交于 2019-12-12 01:43:41
问题 I'm using kohana v3.3, and i would like to know if there is a possibility to get/save another data in the pivot table or not ? let's take the Auth example : So we have 3 tables (roles, users, roles_users) and i added another column "date" on the pivot table Tables : CREATE TABLE IF NOT EXISTS roles ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, name varchar(32) NOT NULL, description varchar(255) NOT NULL, PRIMARY KEY ( id ), UNIQUE KEY uniq_name ( name ) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Adding Dummy Column in Kohana ORM

喜欢而已 提交于 2019-12-12 01:26:18
问题 I want to add dummy column in kohana ORM . I have a field of type longtext . I want to have a new field which contains it's strlen. 回答1: Use $_ignored_columns property: protected $_ignored_columns = array('text_length'); public function __get($column) { if ($column == 'text_length' && (! isset($this->_object['text_length']) || isset($this->_changed['text']))) { // recalc dummy field if not set, or on long text value changing return $this->_object['text_length'] = strlen($this->_object['text']