kohana-3

Error in kohana-3.0.6.2: Class controller_kohana does not exist

Hi I have successfully installed kohana and when i run i go the following error. what to do to solve this error. Class controller_kohana does not exist thanks in advance. ...

Kohana - Authenticating Users?

I would like to get started on a simple project using the Kohana 3 framework (looks very promising), but the docs are a bit lacking in my opinion and would like some direction to get my feet wet and get me started. So I have a simple use-case question one that most every application needs. How would you present a login form with a usern...

How to use database functions in Kohana 3 ORM select query

I'm using Postgres with Kohana 3's ORM module and would like to run a SELECT using a postgres function to convert values already in the database to lower case before doing the comparison. In SQL I would write: select * from accounts where lower(email) = '[email protected]'; In Kohana I would like to write something like this: $user = O...

Kohana 3: Using a custom controller.

Hi All, In KO2, I had a file called libraries/CUSTOM_Controller.php, in which I kept common methods that I wanted to be available to all controllers. Is there a similar way to do this in KO3? I don't see anything in the docs (such as they are) about overriding the controller. Thanks! ...

Can Kohana 3's validation errors inherit?

I've created a bunch of errors in a file under APPPATH/messages/validate.php with a bunch of common messages such as... return array( 'not_empty' => ':field must not be empty.', 'matches' => ':field must be the same as :param1', 'regex' => ':field does not match the required format', 'exact_length' => ':fi...

Kohana3: compatibility between versions

Hi there, I would like to know about the compatibility between upcoming versions of KO3. I have heard that once 3.1 comes in, it won't be easy to simply upgrade to it from kohana 3.0 (Wordpress upgrade is pretty swift from 2 to version 3) If I create my project in KO3 (currently using 3.0.6.2), what are the chances that my project will...

Kohana3 - Error Template if errors = FALSE

Hello everybody, In my Bootstrap.php I've deactivated the Profiler (or is it better to be activated?), and the Errors. Now if somebody is calling an Url, maybe: /notexist, and there is no action_notexist(), the Site is blank. My Question: How can I create a main Error Template, which should be loaded instead of the white page. E.g. If...

Kohana param() don't work

I'm using Kohana 3. Does anyone knows why param('controller') result is NULL. Routing: Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'page', 'action' => 'index', )); URL: http://localhost/application/page/index/1 Params calls: $param = Request::instance()->param('controller'...

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

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 f...

What is the correct way to get values from the query string in Kohana 3

Just curious as to what is the 'Kohana' way of getting variables from the query string? The best that I could come up with is parsing the $_GET var with the Arr class. Anybody have a better way to do this? // foo?a=1&b=2 function action_welcome() { echo('a = '.Arr::get($_GET, 'a', '0')); echo('b = '.Arr::get($_GET, 'b', '0'));...

How to delete all user roles in Kohana 3

I'm using ORM Auth module and it's difficult to figure out how to do it. I've tried this case: $user = ORM::factory('user', $id); $user->roles->delete_all(); And got error ErrorException [ Fatal Error ]: Call to undefined method Database_Query_Builder_Delete::join() However $user->roles->find_all(); gives me exactly what i want. ...

Kohanaphp v3 execute()

excecute() method always return an "informational" object after use current() method i get an array always. How can i obtain an object (with objects) to iterate like this, (no ORM): foreach($obj as $o) { echo $o->name; echo $o->email; } Instead of using current, next, etc. ...

Using PHP, Kohana 3, and the Auth module, how to structure database for additional user info beyond username, email and password.

I'm building the next Facebook!! No, kidding. I'm building a simple site to help me learn. It will allow users to log in with an email and password. There will be other information collected from the user that is pertinent to the sites functions. Using the supplied Kohana Auth module, should I store the separate data in another table...

Using custom classes in Kohana 3

Hey, I'm creating a Call of duty 4 Server Watcher in Kohana 3, and I had created the basic classes for it before: A static Socket class (for handling basic network commands) A Cod4Socket class, (which uses the previously mentioned Socket class) that provides wrapper functions for basic commands. What I want is to be able to use said ...

Help using one model to validate another's validation process in Kohana 3.

Using KO 3.07... and ORM I have a survey model, and a choices model. The survey itself holds the question, while the choices are all the given options that people have for that survey question... (As of now, 2 choices per survey.) In my survey model, I need to validate that the actual question is within a given range of characters, an...

Kohana ORM relationships question

I have tables: users {id, name} projects {id, name} roles {id, name} projects_users {id, user_id, project_id, role_id} I have models: project { has many users through projects_users } user { has many projects through projects_users } Question: How i get user roles for one project? Or maybe i have to reconstruct my tables? Code: ...

KO3 - Kohana 3 - How can I pass $_POST data from a controller/action back to the view/form that called it?

Hey everyone, I am trying to validate a form submission in Kohana 3. I have the form::open point to my action_create in my controller which successfully validates the data posted to it from the form in my view. If the data passes validation, a new item is created as intended, and the user is redirected to the item that was just creat...

How to get object result in Kohana 3 Query Builder?

Hello, I have written this method in a Model: public function get_users() { return DB::select('*')->from("users")->as_object()->execute(); } Then I have written this in a controller: $model = New Model_Test(); $users = $model->get_users(); How should I do to retrieve the values in this way? Is it possible? foreach ($users as...

How to create virtual properties in Kohana 3 ORM

I have a timestamp field in a model where the time is stored in UTC. I would like like to create a 'virtual' property that allows me to access the model using local time based on the timezone property also stored in the model. That is when I get the local_started_at property it reads the started_at property and adjusts the value based ...

Execution time in kohana 3

Hello, How to get execution time and etc. in simplest way in Kohana 3. ...