kohana-3

Kohana 3 : Prevent a controller action which renders a sub-vew from rendering if not called from approved controller

Let's say I have the domain www.example.com It has a default controller called 'account'. This controller is based on a template, and creates a view using it's data, and the result of a couple of other controller's renderings. Let's call the other controllers, 'game', and 'stats'. These 'sub-controllers' call View::factory with their...

How to stop execution of a Request in Kohana?

Let's say I have a controller template with a before function like so... public function before() { parent::before(); if ($this->request === Request::instance()) { // its a main request, throw an exception or redirect Request::instance()->redirect('/'); } else { // ok } }...

"WHERE column IS NOT NULL" with Kohana v3 Query Builder

Is it possible with Kohana v3 Query Builder (Kohana v3 being possibly the most poorly documented #$@$%...) to use the IS NOT NULL operator? The where($column, $op, $value) method requires all three parameters and even if I specify ->where('col', 'IS NOT NULL', '') it builds and invalid query eg. SELECT * FROM table WHERE col IS NOT ...

Is this acceptable to be placed in a view?

Kohana (and probably other frameworks) allow you get a route and echo its URL, creating routes that are easy to maintain. <a href="<?php echo url::base() . Route::get('contact'); ?>">Contact</a> Is this OK to have in the view, or should I assign it to a variable, and then pass the view the variable? Thanks ...

dynamic footer kohana v3

Hi, I've been able to render the footer view (e.g: View::factory('pages/footer'), but I would like this view for example to be managed by a controller class within the main controller. Imagine: main template controller (common to all pages) dynamic header controller class dynamic menu controller class dynamic foooter controller...

Can I save new related objects via reference without copying id's manually in Kohana 3's ORM?

I have 2 objects. Player and Match. Player is a child of Match. I want to know if I can create both of these at the same time without inserting id's manually. i.e. $match = ORM::factory('match'); $player1 = ORM::factory('player'); $player2 = ORM::factory('player'); $player1->match = $match; $player2->match = $match; $match->save(); ...

Kohana v3 routes - multiple optional parameters

I'm setting up a search system which has urls eg. all parameters are optional and there are 15 possible params in total http://example.com/search/key1-value/key2-value/key3-value/key13-value/key15-value Is there a better way to set up the route than this? Route::set('search', 'search(/<param1>(/<param2>(/<param3>(/<param4>(/<param5>(...

How do I set columns/members in Kohana ORM v3

class Model_User extends ORM { // columns: UserID, Name // public $Name ; // this didn't work } Currently I create an object: $user = new Model_User() ; and access columns like: $user->Name = 'My Name'; I'd like to have my IDE show me all the columns in the data model to avoid misspellings and to now right away what fields I ca...

Kohana 3: Auth::factory() gives error

Hello, When I try to make a new instance of the Auth-module object (Auth::factory()), Kohana gives me the following error: Cannot instantiate abstract class Auth Can someone help? ...

How to define alpha or alphanumeric rules for a ORM model using Kohana 3?

I'm doing this in my model.... protected $_rules = array( 'id' => array( 'not_empty' => NULL, 'numeric' => array(TRUE) ) .... Am I doing it right for the numeric qualifier? Thanks. ...

How check image properties(size)?

How can I validate image properties(heigth, width) in Kohana 3 before resize? Or how can I use image resizing only if my image do not less size what I need? What I want to do: during avatar uploading I must resize image if it bigger that i want. Or take action to prohibit uploading bigger avatar. Now I have this rules: public function...

Is there a way to override Model properties without defining them all again with Kohana?

I have the following, for example: class Model_User extends ORM { protected $_rules = array( 'username' => array( 'not_empty' => NULL, 'min_length' => array(6), 'max_length' => array(250), 'regex' => array('/^[-\pL\pN_@.]++$/uD'), ), 'password' => array( ...

Using PHP and Kohana 3, can one recursively find and output any model's relationships?

Let's say we have a User Model that has many Posts. The Posts Model has many Categories The Posts Model also has many Comments. How do we find dynamically, the relationships that the User Model has? The idea is to make an admin backend to a site, where I can have one function, that when passed a model, can retrieve all data related t...

Kohana: How to load all many-to-many relationships in one query

I have a database relationship that looks something like this: booking -> person <-> option -> : one-to-many <-> : many-to-many I now need to list all the persons in a booking, with all their options. Using ORM in kohana I can load all persons like this: $persons = ORM::factory('booking', $id)->persons->find_all(); I could then l...

Kohana ORM: Get results based on value of a foreign table

Hello. I have two tables: taxonomies -id -name taxonomy_type -taxonomy_id -type_id I've configured two models: class Model_Taxonomy{ protected $_has_many = array('types'=>array()); } class Model_Taxonomy_Type{ protected $_belongs_to = array('taxonomy' => array()); } *Please note that taxonomy_type is not a pivot table.* A ta...

Is there a way to set and get values from a multidimensional array through Kohana's built in session handler?

In PHP I often do the following: $_SESSION['var']['foo'] = array('bar1' => 1, 'bar2' => 2); // ... $_SESSION['var']['foo']['bar2'] = 3; // ... echo $_SESSION['var']['foo']['bar2']; // 3 I'm wondering what the recommended way of storing multidimensional arrays in a session with Kohana. I know I can do the following, but I don't know h...

Kohana v3 application execution time

Hi I am using the Kohana v3 profiler and I notice the application execution time at the bottom. I don't really know what this is. Is this how long it takes kohana to run through controller and php code or is it the total time it took my webpage to load? ...

Kohana 3 Share admin between multiple projects

Hi All, Is it possible to share admin area (having admin controllers,modules and views) among multiple projects. I want to design admin module having common functionality like admin user-role management, modules management etc. that will be shared with multiple projects. There can be possibility one of project may hold custom admin func...

Kohana 3 How to render module inside application

Hi All, How to integrate module inside application? I have modules having two controllers and two respective views inside module. Now I want to integrate this module inside my application, so that views and actions can be handled by this module only. ...

.htaccess for multiple application in Kohana V3

Hi I have setup multiple application in Kohana v3, it works normally without enabling .htaccess (to remove index.php or admin.php) my setup + system/ + modules/ + applications/ + public/ + bootstrap.php + ... + admin/ + bootstrap.php + ... + index.php (for 'public' application) + admin.php (for 'admin' application)...