Search Results

Search found 1488 results on 60 pages for 'kohana orm'.

Page 2/60 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Kohana newbie - sample CRUD application

    - by titel
    I'm completely new to this framework and I'm trying to find some sample CRUD application to get started with Kohana 3. There is a tutorial and information in the unofficial Kohana 3 Wiki (http://kerkness.ca/wiki/doku.php), but event there, there are some aspects that are not covered (the model, validation, etc).

    Read the article

  • Kohana ORM syntax question

    - by anthony
    I'm using the "join_table" function with Kohana's ORM to build a query. The following works: $category = ORM::factory('category')->join_table('product'); But this doesn't: $category = ORM::factory('category'); $category->join_table('product'); The documentation uses the second as an example, but it returns 0 while the first example returns "categories_products" which is correct. Any ideas?

    Read the article

  • Kohana v3, automatically escape illegal characters?

    - by Dom
    Quick question, does Kohana (version 3) automatically escape data that is passed into ORM::factory..... (and everywhere else that has to do with the database)? For example: $thread = ORM::factory('thread', $this->request->param('id')); Would the data passed in the second argument be auto-escaped before it goes in the SQL query or do I have to manually do it? Probably a stupid question and it's better to be safe than sorry, but yeah... I usually do manually escape the data, but I want to know if Kohana does this for me? Thanks

    Read the article

  • Kohana v3, escape illegal characters?

    - by Dom
    Quick question, does Kohana (version 3) automatically escape data that is passed into ORM::factory..... (and everywhere else that has to do with the database)? For example: $thread = ORM::factory('thread', $this->request->param('id')); Would the data passed in the second argument be auto-escaped before it goes in the SQL query or do I have to manually do it? Probably a stupid question and it's better to be safe than sorry, but yeah... I usually do manually escape the data, but I want to know if Kohana does this for me? Thanks

    Read the article

  • Kohana 2.3.4 ORM pivot table query

    - by anthony
    I'm trying to query a pivot table with Kohana's ORM and I'm wondering if there is a built in function I'm missing. Currently I only have 2 models setup for the tables "categories" and "products". There is a pivot table "categories_products", but I don't need a model for it when inserting data with this: $product = ORM::factory('product'); $product->add(ORM::factory('category', $addCat)); However, I can't figure out how to query it without creating a model for it. The "join_table" function only returns the name of the pivot table (which I thought selected the table at first). If you can save data to the pivot table without a model, it seems to me that you should be able to retrieve data in a similar way. Any ideas?

    Read the article

  • Problem with DOMPDF and Kohana 3

    - by alex
    I have used DOMPDF many times before successfully, however outside of the Kohana Framework. I created a module for DOMPDF and called it simply pdf. Here is it's code. class Pdf { private $domPdfInstance; public function __construct($html) { if ( ! class_exists('DOMPDF', FALSE)) { // Load DOMPDF require Kohana::find_file('vendor', 'dompdf/dompdf_config.inc'); } $this->domPdfInstance = new DOMPDF; $this->domPdfInstance->load_html($html); } public function render() { $this->domPdfInstance->render(); return $this; } public function stream($filename) { if (pathinfo($filename, PATHINFO_EXTENSION) !== 'pdf') { $filename .= '.pdf'; } $this->domPdfInstance->stream($filename); return $this; } } For some reason, any PDF I generate using this results in it being corrupt (not opening under Mac OS X's Preview app at least). I have even tried this basic HTML <html> <head> <title>PDF</title> </head> <body> please work </body> </html> Is this a known problem? I have not touched anything in dompdf_config.inc.php except uncomment out the error reporting levels so they now read error_reporting(E_STRICT | E_ALL); PHP is not reporting any errors. Here is a screenshot of the error from Preview (though I think it's probably unhelpful) Some thing I have thought may be a problem Auto loading conflicts Base path conflicts

    Read the article

  • Upgrade guide for Kohana 3.0.9 (from 3.0.8)

    - by Darryl Hein
    Is there an upgrade guide for Kohana 3.0.9 from 3.0.8. I'm looking for something like what jQuery provides when they release a new version. It allows for a quick scan of the changes to notice if there's anything I could use or would change how I've done things. The resolved issues are part of this, but I'm looking for something more high level. The issues require reading everything in each issue and it's often hard to understand what's actually changed.

    Read the article

  • Kohana V3 return query result as object

    - by Asif
    Hi, In Kohana V3 is it possible to return result set as an array() or any method exists? For example: $user = DB::select('*')->from("users")->where('username', '=', $username); If method is there,then it is possible to get password like echo $user->password; Is it possible without ORM? Please suggest.

    Read the article

  • Kohana3 ORM save problem

    - by Bob0101
    Hi, Can anyone help me with Kohana ORM. I can take out name and value. I can give them new values and I try to save them back to base, but in phpmyadmin i can see still old values for these option attributes. What is wrong with this code (it works and echos right value but i can't see it in db): $option = ORM::factory('draft') ->where('user_id', '=', $user_id) ->find() ->draft_options ->where('name', '=', $_POST['name']) ->find(); $option->name = $_POST['name']; $option->value = $_POST['value']; $option->save(); if ($option->saved()) echo Kohana::debug($option->value);

    Read the article

  • Kohana 3 - Query builder gives 0 rows

    - by pigfox
    The following query returns one row as expected when run from phpmyadmin. SELECT units . * , locations . * FROM units, locations WHERE units.id = '1' AND units.location_id = locations.id LIMIT 0 , 30 But when I try to do it in Kohana 3: $unit = DB::select('units.*', 'locations.*') ->from('units', 'locations') ->where('units.id', '=', $id)->and_where('units.location_id', '=', 'locations.id') ->execute()->as_array(); var_dump($unit); It prints array(0) { } What am I doing wrong?

    Read the article

  • How would I change this Query builder from Kohana 2.4 to Kohana 3?

    - by Thorpe Obazee
    I have had this website built for a few months and I am just getting on Kohana 3. I'd just like to convert this K2.4 query builder to K3 query builder. return DB::select(array('posts.id', 'posts.created', 'posts.uri', 'posts.price', 'posts.description', 'posts.title', 'image_count' => db::expr('COUNT(images.id)'))) ->from('posts') ->join('images')->on('images.post_id', '=', 'posts.id') ->group_by(array('posts.id')) ->order_by('posts.id', 'DESC') ->limit($limit) ->offset($offset) ->execute();

    Read the article

  • Kohana 3, problem with m2m data adding

    - by Marek
    Hello 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_Page protected $_has_many = array('templates' => array(), 'menugroups' => array('through' => 'enrollment')); Model_Menugroup protected $_has_many = array('menuitems' => array(), 'pages' => array('through' => 'enrollment')); //Overriden save() method in Model_Menugroup: public function save() { if (empty($this->created)) { $this->created = time(); } parent::save(); $this->reload(); if (! $this->is_global) { if (! empty($this->groupOwnerPagesId) { $page = ORM::factory('page'); foreach($this->groupOwnerPagesId as $id) { $this->add('enrollment', $page->find($id)); } } } } I did: I corrected table names in pivot model by changing them to singular I even now using the same name for pivot table / model = enrollment. The same as in tutorial. Just in case So the pivot table has name 'enrollment' and has 2 columns: page_id , menugroup_id I tried to add pk in pivot table, but it changed nothing I tried to add/remove db relation between pages/menugroups and pivot table (InnoDB) but with no luck I tried save all data in controller, but with the same bad result:( I am still getting the same error: Undefined index: enrollment in ORM line: $columns = array($this-_has_many[$alias]['foreign_key'], $this-_has_many[$alias]['far_key']); Could somebody tell me, what can be else wrong? I have no other ideas:( Kind regards

    Read the article

  • Example of persisting an inheritance relationship using ORM

    - by Schemer
    I have some experience with OOP and RDBs, but very little exposure to web programming. I am trying to understand what non-trivial types of problems are solved by ORM. Of course, I am familiar with the need for data persistence, but I have never encountered a need for persisting relationships between objects, a situation which is indicated in many online articles about ORM. I am not asking about the process of persisting a POJO to a database and restoring it later. Nor am I asking about why ORM frameworks are useful -- or a pain in the butt -- for doing so. I am particularly interested in how the need arises to persist and restore relationships between objects. In various documentation, I have seen many examples of persisting POJOs to a database, but the examples have all been for only very simple objects that are essentially nothing more than records anyway: a constructor, some private fields, and getter/setter methods. The motivation for persisting such an "object-record" seems obvious and trivial. This example: Hibernate ORM Tutorial offers such an example, but goes on to discuss mismatch issues of granularity, inheritance, identity, associations, and navigation that are not motivated by the example. If someone could offer a toy example of an instance where, say, the need arises to persist an inheritance relationship, I would be grateful. This might be blindingly obvious for anyone who has already encountered this situation but I have not and a great deal of searching and reading have not turned up any examples.

    Read the article

  • Kohana 3: Auth module

    - by Thomas
    Hi, i'm trying to learn the Kohana's Auth module but login method always return false. Controller: <?php defined('SYSPATH') OR die('No Direct Script Access'); class Controller_Auth extends Controller { public function action_index() { if($_POST) { $this->login(); } $this->template = View::factory('login'); echo $this->template; } private function login() { $user = ORM::factory('user'); $data = array('username' => 'wilson', 'password' => '123'); if(!$user->login($data)) { echo 'FAILED!'; } } private function logout() { } } ?> Model: <?php defined('SYSPATH') or die('No direct script access.'); class Model_User extends Model_Auth_User { } ?>

    Read the article

  • Kohana 3 and CRON always accessing index.php (not following the URI argument)

    - by alex
    OK, I hope this is my last question about CRON jobs and Kohana 3. Note: others are not duplicates, just other problems. Here is my CRON job (setup in cPanel) php /home/user/public_html/index.php --uri=properties/update As per this answer. I have set it up so it emails me the output. It is running every 5 mins. Unfortunately, it always emails me the source of the home page of my site (index.php or /). I can access that URL fine in my browser, i.e. http://www.example.com/properties/update and it works and does it's job correctly. I can tell the Cron is never hitting the script because I have a file logger in place. Would this have anything to do with .htaccess? Has this happened to anyone before, and how did they fix it? Many thanks.

    Read the article

  • Is ORM an Anti-Pattern?

    - by derphil
    I had a very stimulating and interessting discussion with a colleague about ORM and it's Pros and Cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience. But I don't want to list my own arguments at this time. So I ask you, what do you think about ORM? What are the Pros and the Cons? P.S. I've posted this "question" yesterday on Stackoverflow, but some of the user think, that this should better posted here.

    Read the article

  • ResourceSerializable: an alternate to ORM and ActiveRecord

    - by Levi Morrison
    A few opinionated reasons I don't like the traditional ORM and ActiveRecord patterns: They work only with a database. Sometimes I'm dealing with objects from an API and other objects from a database. All the implementations I have seen don't allow for that. Feel free to clue me in if I'm wrong on this. They are brittle. Changes in the database will likely break your implemenation. Some implementations can help reduce this, but a few of the ones I've seen don't. Their very design is influenced by the database. If I want to switch to using an API, I'll have to redesign the object to get it to work (likely). It seems to violate the single-responsibility pattern. They know what they are and how they act, but they also know how they are created, destroyed and saved? Seems a bit much. What about an approach that is somewhat more familiar in PHP: implementing an interface? In php 5.4, we'll have the JsonSerializable interface that defines the data to be json_encoded, so users will become accustomed to this type of thing. What if there was a ResourceSerializable interface? This is still an ORM by name, but certainly not by tradition. interface ResourceSerializable { /** * Returns the id that identifies the resource. */ function resourceId(); /** * Returns the 'type' of the resource. */ function resourceType(); /** * Returns the data to be serialized. */ function resourceSerialize(); } Things might be poorly named, I'll take suggestions. Notes: ResourceId will work for API's and databases. As long as your primary key in the database is the same as the resource ID in the API, there is no conflict. All of the API's I've worked with have a unique ID for the resource, so I don't see any issues there. ResourceType is the group or type associated with the resource. You can use this to map the resource to an API call or a database table. If the ResourceType was person, it could map to /api/1/person/{resourceId} and the table persons (or people, if it's smart enough). resourceSerialize() returns the data to be stored. Keys would identify API parameters and database table columns. This also seems easier to test than ActiveRecord / Orm implemenations. I haven't done much automated testing on traditional ActiveRecord/ORM implemenations, so this is merely a guess. But it seems that I being able to create objects independently of the library helps me. I don't have to use load() to get an existing resource, I can simply create one and set all the right properties. This is not so easy in the ActiveRecord / Orm implemenations I've dealt with. Downsides: You need another object to serialize it. This also means you have more code in general as you have to use more objects. You have to map resource types to API calls and database tables. This is even more work, but some ORMs and ActiveRecord implementations require you to map objects to table names anyway. Are there other downsides that you see? Does this seem feasible to you? How would you improve it? Note: I almost asked this on StackOverflow because it might be too vague for their standards, but I'm still not really familiar with programmers.stackexchange.com, so please help me improve my question if it doesn't shape up to standards here.

    Read the article

  • Trying to make models in Kohana, relations problem.

    - by Asaf
    I have a table of Hits, Articles and Categories Now, a Hit belongs_to an Article/Category (depends on where it was done). so I have a column on Hits table with the name 'parenttype' That tells me 'Article' or 'Category'. I wrote in the Hit model (extends ORM) protected $_belongs_to= array( 'page' => array('model'=> $this->parenttype) ); Now it complains about $this-parenttype not being expected?

    Read the article

  • Kohanav3 ORM: calling where->find_all twice

    - by David Lawson
    When I do something like the following: $site = ORM::factory('site')->where('name', '=', 'Test Site')->find(); $users = $site->users; $deletedusers = $users->where('deleted', '=', '1')->find_all(); $nondeletedusers = $users->where('deleted', '=', '0')->find_all(); The contents of $deletedusers is correct, but the $nondeletedusers contains every non-deleted user, not just the ones in the loaded $site. What am I doing wrong?

    Read the article

  • Need help with Swift mailer with Kohana wrapper

    - by alex
    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 error Fatal error: Call to undefined method Swift_Mailer::setSubject() in /home/user/public_html/application/classes/controller/properties.php on line 45 I've seen that email::connect() does exactly what the example code in the docs does. That is include the correct file return an instance of the library What am I doing wrong? Thanks

    Read the article

  • How to install custom modules in Kohana 3 framework

    - by BPS
    I'm learning framework KohanaPhp 3 and I have a problem with adding a module called kolanos-Kohana-captcha. What I've done so far is: I copied the directory kolanos-kohana-captcha into modules directory Copied kolanos-kohana-captcha/config/captcha.php to file application/config/captcha.php Edited the file and added Bootstrap.php Kohana::modules(array (... 'captcha' = MODPATH."kolanos-kohana-captcha ', )); But it does not work: (Whenever I want to use class Captcha kohana shows the error "class not found." I'm doing something wrong? Is this a problem with the module? There are some other modules to handle the captcha in Kohana 3+?

    Read the article

  • Kohana 3 - Get URLs

    - by booze2go
    Hi Guys, could you help me with following questions. How do i get the: absolute/relative current url http://www.example.com/subdir/controller/action /subdir/controller/action absolute/relative application url http://www.example.com/subdir/ /subdir/ I could of course use native php to get it but i think i should rather use ko3 functions. Any idea how that works? Thanks in advance!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >