problem about kohana-3-Collection of common programming errors


  • Karem
    php kohana kohana-3
    I have done this simple catch:try {echo Request::factory()->execute()->send_headers()->body(); }catch(Exception $e) {echo ‘You tried to reach: ?’; }in the bottom of my bootstrap.php and removed echo Request::factory()->execute()->send_headers()->body();From the root index.php. This works fine, and the output “You tried to reach ?” appears when there’s a request of something unhandled.I wish to mention the URI in this output message. My further plans are to check in the DB for URI that m

  • Anthony
    php kohana-3
    How do I require_once in my controller, a third party class that I put in kohana\vendor\twitter-api-php? I tried this answer which was similar but I kept getting errors (see below). My project’s file structure is as follows:kohana – application – modules – system – vendorI keep getting these errorsWarning: Uncaught exception ‘ErrorException’ with message ‘require_once(C:\wamp\www\kohana): failed to open stream: Permission denied’ in C:\wamp\www\kohana\application\classes\Controller\Twitter.php:8

  • daniels
    php kohana-3
    How can this be done? I’m trying to do this for about half an hour and it’s getting pretty annoying. You would this this should be an basic and easy thing to setup for a framework like this. I hope maybe there’s an easy way i missed, because i’m starting to thing i should not chose this framework at all if such basic tings are so hard to setup.This is in my bootstrap.php file that should do the trick.if ( ! defined(‘SUPPRESS_REQUEST’)) {/*** Execute the main request. A source of the URI can be p

  • alex
    php exception-handling kohana kohana-3
    I’ve got a web application that is used by a company for logging their employees’ work.A lot of people are often logged in at once.The application runs on a shared host.I sometimes receive…Warning: mysql_connect() [function.mysql-connect]: Too many connectionsWhich then lets further errors cascade… like errors with mysql_select_db(), mysql_error(), mysql_errnon() and finally the uncaught Database_Eexception.When I run my main request, I wrap it in a try and capture any exception and display

  • Aaron A
    kohana-3 kohana-orm kohana-3.2
    I have a model named permission. Permission has many roles permission has many users permission has many denied usersBelow is from the permissions model:protected $_has_many = array(‘user’ => array(‘through’ => ‘user_permission’),’permissiondeny’ => array(‘model’ => ‘user’, ‘through’ => ‘user_permissiondeny’,’foreign_key’ => ‘permissiondeny_id’),’role’ => array(‘through’ => ‘role_permission’), );The user and role relationships work as expected. I can select the deny perm

  • matino
    php unit-testing kohana kohana-3 spl-autoload-register
    I have a kohana website that works okay, and I started unit testing (retrospectively, I know it is not the best practice)The first error I get and I cannot get rid of is quite puzzling: Fatal error: Uncaught exception ‘LogicException’ with message ‘Passedarray does not specify an existing static method (class ‘Kohana’ notfound)’ in /Users/dananicula/Sites/mnib1/application/bootstrap.php:44in bootstrap, line 44 is: spl_autoload_register(array(‘Kohana’, ‘auto_load’));and class Kohana actualy exist

  • teresko
    php kohana kohana-3
    At the moment I think about login script. Idea – when you submit login and password, they checks into model and if login and password is correct, script shows a message about completed login process. But if I put in view echo $message; and I am at login page, kohana shows error – Undefined variable $message. But when I am at page, where the variable defined, all working. How to realize this idea.EDIT!class Controller_About extends Controller_Template {public function action_index() {session_star

  • hakre
    php validation exception kohana-3 php-errors
    I am trying to add the error messages to my validation object.It says that errors is not a method of Validation_Exception. That I know… The thing is that I though the $e variable would be the instance of the Validation Class in the model. My question is how can attach the error messages?Error:ErrorException [ Fatal Error ]: Call to undefined method Validation_Exception::errors()Controller:208 // redirect to the user account 209 $this->request->redirect(‘user/profi

  • random
    php kohana-3 kohana-orm
    I’m trying to connect to my database in Kohana 3 but it’s not connecting. This is the query I’m trying to run from one of my modules:$results = DB::select()->from(‘users’)->where(‘verified’, ‘=’, 0)->execute();Here’s the dump of the error: ErrorException [ Notice ]: Undefined property: Config_File::$default MODPATH\database\classes\kohana\database.php [67] if($config === NULL) {// Load the configuration for this database// echo “<pre>”;//die(print_r(unserialize(Kohana::config(‘dat

  • hakre
    php form-validation try-catch kohana-3
    Here is the code:try {$result = Model_User::update_user($_POST);// message: save successMessage::add(‘success’, __(‘Values saved.’));// redirect and exit$this->request->redirect(‘user/profile’);return;} catch (Exception $e) {// Get errors for display in view// Note how the first param is the path to the message file (e.g. /messages/register.php)Message::add(‘error’, __(‘Error: Values could not be saved.’));$errors = $e->errors(‘register’);$errors = array_merge($errors, (isset($errors[‘_

  • r4.
    kohana smarty kohana-3 smarty3
    I’m learning Kohana 3.2.0 together with KSmarty for Kohana 3. I’d like to write an anchor on the page like this:<a href=”http://www.mysite.cz/page/list”>Page list</a>I can build the url in the controller and pass it to Smarty as a variable but. Is there a way to build the anchor or URL in Smarty template (including “http://www.mysite.cz” part)?If it is not possible to build the anchor. Is it at least possible to build full URL?The Reason: I have a main template which includes another

  • AdamB

  • user342111223
    object orm kohana kohana-3
    I have an object in a controller’s method:$post = ORM::factory(‘post’, array(‘slug’ => $slug); that is sent to the view:$this->template->content = View::factory(‘view’)->bind(‘post’, $post);I’ve created 1-n relation between post and comments. So good so far.The main issue is: how should I pass post comments to the view? Currently I’m getting them in the view ($post->comments->find_all()) but I don’t feel it’s the best method (and not matching MVC standards in my humble opinion

  • alex
    php email kohana kohana-3 swiftmailer
    My current code is this$swift = email::connect();$swift->setSubject(‘hello’)->setFrom(array(‘[email protected]’ => ‘Alex’))->setTo(array(‘[email protected]’ => ‘Alex’))->setBody(‘hello’) ->attach(Swift_Attachment::fromPath(DOCROOT . ‘assets/attachments/instructions.pdf’));$swift->send();The email::connect() returns an instance of SwiftMailer.As per these docs, it would seem that it should work.However, I get an errorFatal error: Call to undefined method Swift_Mailer:

  • user557108
    kohana kohana-3
    rowanparkerhttps://github.com/rowanparker/kohana-3-paypalI really need this module but I can not use it because it gives me this error:Call to undefined method PayPal_ExpressCheckout::SetExpressCheckout()NOTE: I did everything as in the example on GitHub.shadowhandhttps://github.com/shadowhand/paypalI get the same error with this module.Can someone help me on this? PLEASE!Thank you!

  • Jakub Hampl
    kohana-3 hmvc
    I followed the example http://www.dealtaker.com/blog/2010/02/25/kohana-php-3-0-ko3-tutorial-part-5/I get the following error:ErrorException [ Notice ]: Undefined property:Response::$response. APPPATH\views\pages\hmvc.php [ 2 ].I don’t know how to fix it. Can you offer any suggestions?

  • Bob0101
    kohana kohana-3 kohana-orm kohana-auth
    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.

  • Haradzieniec
    session action kohana session-variables kohana-3
    I have Session::$default=’database’; $session=Session::instance(); and $session->id() displays session’s value now. The value is stored in the sessions table as well. Everything seems to work fine.My question is: how to check if session exists in another action. The $_SESSION array is undefined.

  • alex
    php cron kohana kohana-3
    I’ve set up a CRON to call a URL in Kohana 3.php /home/user/public_html/index.php my/route/in/bootstrap.phpIt seems to access the URL fine. However, I have received this error (send back in an email that my host sends per CRON)Undefined index: HTTP_HOST SYSPATH/classes/kohana/url.php [ 40 ]Source of url.phpWhich is in a Kohana system file. Is this because the CRON job is not sending HTTP headers?How would I fix this and get it to work (hopefully without hacking the core files).Or am I doing the

  • ChaoticLoki
    kohana kohana-3
    This is the first time I have received this error, I have used a local server and my own personal hosting provider, this error only pops up on our production server.error:Fatal error: Undefined class constant ‘Log::EMERGENCY’ in {Kohana Directory}\system\classes\Kohana\Kohana\Exception.php on line 140Does anyone have any experience with this?

  • Kemo
    php orm kohana kohana-3
    I’ve now a Problem with the newest Version of KohanaPHP (kohanaphp.com).After I’ve registered me and logged in into my test page, some minutes later, there is now the error:ErrorException [ Notice ]: Undefined index: idMODPATH/orm/classes/kohana/orm.php [ 1316 ] 1311 * 1312 * @return mixed primary key 1313 */ 1314 public function pk() 1315 { 1316 return $this->_object[$this->_primary_key]; 1317 } 1318 1319 /** 1320 * Returns whether or not primary key is empty 1321 *I’ve

  • hakre
    php orm kohana-3 php-errors
    I’m trying to add an ORM object to another one (one to many relationship) in Kohana:$item = $cart->cartitems->where(‘productid’, ‘=’, $product->id);//if($item == null)//This apparently doesn’t work in Kohana, it returns an object, even if not loaded, using the following:if (!$item->loaded()) {$item = new Model_Cartitem();$item->productid = $product->id;$item->quantity = 1; //TODO: Change to incrementation$item->totalprice = $product->price; //TODO: Change to incrementa

  • user1715545
    kohana-3
    I’m using Kohana 3.3.0 and i have a controller which is supposed to save blog articles to a database then redirect to the homepage, my code is as follows:-class Controller_Article extends Controller {const INDEX_PAGE = ‘index.php/article’;public function action_post() {$article_id = $this->request->param(‘id’); $article = new Model_Article($article_id); $article->values($_POST); // populate $article object from $_POST array $article->save(); // saves article to database$this->requ

  • Adam Wagner
    php orm kohana kohana-3
    I posted this on official forum but with no result.I am getting Undefined index enrollment error when trying to save data.My pivot model:class Model_Enrollment extends ORM {protected $_belongs_to = array(‘page’ => array(), ‘menugroup’ => array());}Model_Pageprotected $_has_many = array(‘templates’ => array(), ‘menugroups’ => array(‘through’ => ‘enrollment’));Model_Menugroupprotected $_has_many = array(‘menuitems’ => array(), ‘pages’ => array(‘through’ => ‘enrollment’));

  • Sadaf Siddiqui
    mysql kohana kohana-3 kohana-orm
    i m bit confuse how to convert my query :> SELECT COUNT(`id`) AS `total_logs`, `userlog`.* FROM `user_log` AS > `userlog` WHERE `user_id` = ’31’ AND date(`date_created`) = > ‘2012-04-30’to Kohana 3.1 ORM? currently i m using :> $isLoged = ORM::factory(‘Userlog’)->select(array(‘COUNT(“id”)’, > ‘total_logs’)) > ->where(‘user_id’, ‘=’, $user->id) > ->and_where(‘Date(date_created)’, ‘=’, date(‘Y-m-d’)) > ->find_a

  • Kenneth
    kohana kohana-3
    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 = $

  • Amit
    php kohana imap kohana-3 php-fpm
    The following error gets logged in php-fpm log at random times.[25-Jan-2013 12:07:57 GMT] PHP Fatal error: Uncaught exception ‘ErrorException’ with message ‘Unknown: Retrying PLAIN authentication after [UNAVAILABLE] LOGIN failure. Server error–please try again after some time. Err (errflg=1)’ in Unknown:0 Stack trace: #0 [internal function]: Kohana_Core::error_handler(8, ‘Unknown: Retryi…’, ‘Unknown’, 0, Array) #1 {main} thrown in Unknown on line 0The php-fpm process/thread handling this par

Originally posted 2013-11-26 01:41:28.