kohana-3

Kohana URLs including index on redirects and pagination

断了今生、忘了曾经 提交于 2019-12-07 05:38:51
问题 I am having an issue with the KO3 core inserting index.php into my URL's when I use redirect Request::instance()->redirect('something'); or $paginationStuffHere->render(). The result of either of these is http://www.something.com/ index.php /something This is not an issue when I use full URL's for the redirects instead of relatives such as Request::instance()->redirect('http://www.something.com/something'); but there is not really a way to do this with the pagination functions... that I have

In Kohana 3, how do you figure out errors made during a query?

我们两清 提交于 2019-12-06 20:33:25
I'm using Kohana 3. I'm writing an update query, and it is working for everything except this one section. If I do a var_dump() on the results of $db->execute() I get either a 1 or 0 to say it failed or not. It is failing in this example (returning 0). How can I figure out what error is happening? It justs seems to be silenty failing at the time being. I tried doing echo mysql_error() but it didn't work, as I expected, as Kohana 3's db library uses PDO I'm pretty sure. How can I figure out the error that has occurred? Try executing this after calling $db->execute() : echo Database::instance()-

How to apply the “matches” validation rule in Kohana 3.1?

谁都会走 提交于 2019-12-06 05:38:17
I need to know how to apply the "matches" validation rule in Kohana 3.1. I've tried the following rule in my model with no success: 'password_confirm' => array( array('matches', array(':validation', ':field', 'password')), ) But it always fails. I put a var_dump($array) in the first line of the Valid::matches() method. I paste it below: /** * Checks if a field matches the value of another field. * * @param array array of values * @param string field name * @param string field name to match * @return boolean */ public static function matches($array, $field, $match) { var_dump($array);exit;

Kohana v3.1.0 ORM _ignored_columns — now that it's gone, what should I do instead?

瘦欲@ 提交于 2019-12-05 15:52:23
It seems that in v3.1.0 of Kohana's ORM that the _ignored_columns property has been removed. What the is the recommended technique to dealing with fields that aren't in the databases? The case I have right now is password_confirm where password is a field, but we require the user to enter their password twice. You can pass an extra validation object to save, create and update. So your example would look like: /** * Password validation for plain passwords. * * @param array $values * @return Validation */ public static function get_password_validation($values) { return Validation::factory(

Kohana 3.2: Custom error message for a custom validation rule?

无人久伴 提交于 2019-12-05 09:20:33
问题 I am using a custom method for a validation rule in my model (using Kohana 3.2). I am following the format listed on the documentation. // Calls A_Class::a_method($value); array(array('A_Class', 'a_method')), But I can't seem to figure out how to add a custom error message if the rule fails. Any help? 回答1: For this example we will assume a modal "user" and validating the field "username" /application/classes/model/user.php class Model_User extends ORM { public function rules() { return array(

GIT post-receive hook not checking out submodules

好久不见. 提交于 2019-12-05 02:55:49
问题 I have been working on a Kohana 3 project that I installed using the downloaded zip file awhile ago. I have a git repository on my remote server "project.git" which checks out the latest commits to the working directory "public_html" where I test the application My post-receive hook file GIT_WORK_TREE=/var/www/public_html; git checkout -f; which was working for a couple of months until I decided to remove some kohana folders and use git submodule instead, so I can do updates via git. Now the

Is it possible to re-use a Kohana ORM query for the row count?

六眼飞鱼酱① 提交于 2019-12-05 00:32:03
问题 So I have my query as so... $records = ORM::factory('category'); Add a WHERE clause as so... $records = $records->where('categoryid', 'LIKE', 'aa'); Grab a count for pagination as so... $count = $records->count_all(); And my where clause gets cleared away as so... SELECT `categories`.* FROM `categories` LIMIT 20 OFFSET 0 With this line commented out //$count = $records->count_all(); My SQL looks just fine... SELECT `categories`.* FROM `categories` WHERE `categoryid` LIKE 'aa' LIMIT 20 OFFSET

Need assistance with Kohana 3 and catch all route turning into a 404 error

拜拜、爱过 提交于 2019-12-04 20:47:51
Based on this documentation , I've implemented a catch all route which routes to an error page. Here is the last route in my bootstrap.php Route::set('default', '<path>', array('path' => '.+')) ->defaults(array( 'controller' => 'errors', 'action' => '404', )); However I keep getting this exception thrown when I try and go to a non existent page Kohana_Exception [ 0 ]: Required route parameter not passed: path If I make the <path> segment optional (i.e. wrap it in parenthesis) then it just seems to load the home route, which is... Route::set('home', '') ->defaults(array( 'controller' => 'home',

Kohana 3 pagination

霸气de小男生 提交于 2019-12-04 12:11:53
问题 I'm really lost on how pagination works in kohana 3. Is there a good example of pagination in Kohana 3 anywhere? 回答1: // Get the total count of articles $count = $this ->_profil ->articles ->count_all(); // Create the pagination object $pagi = Pagination::factory(array( 'items_per_page' => 4, 'total_items' => $count, )); // Find actual articles $articles = $this->_profil ->articles ->join_categories() ->order_by('id','DESC') ->limit($pagi->items_per_page) ->offset($pagi->offset) ->find_all();

GIT post-receive hook not checking out submodules

白昼怎懂夜的黑 提交于 2019-12-03 17:32:38
I have been working on a Kohana 3 project that I installed using the downloaded zip file awhile ago. I have a git repository on my remote server "project.git" which checks out the latest commits to the working directory "public_html" where I test the application My post-receive hook file GIT_WORK_TREE=/var/www/public_html; git checkout -f; which was working for a couple of months until I decided to remove some kohana folders and use git submodule instead, so I can do updates via git. Now the problem is that the submodules are not in the working directory. I tried going in there to add the