maltyxx/origami

This package is abandoned and no longer maintained. No replacement package was suggested.

Origami ORM for CodeIgniter 3

Installs: 6 852

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 5

Forks: 7

Open Issues: 3

Type:codeigniter-third-party

v1.0.3 2017-10-19 13:14 UTC

README

Object Relational Mapping for Codeigniter 3

Requirements

  • PHP 5.3.x (Composer requirement)
  • CodeIgniter 3.0.x

Installation

Step 1 Installation by Composer

Run composer

composer require maltyxx/origami

Step 2 Create files

Create controller file in /application/controllers/Origami_generator.php.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require(APPPATH.'/third_party/origami/controllers/Origami_generator.php');

Step 3 Configuration

Duplicate configuration file ./application/third_party/origami/config/origami.php in ./application/config/origami.php.

Step 4 Examples

Model file is located in /application/models/User_model.php.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class User_model extends CI_Model
{
    function __construct()
    {
        parent::__construct();

       $this->load->add_package_path(APPPATH.'third_party/origami');
       $this->load->library('origami');
       $this->load->remove_package_path(APPPATH.'third_party/origami');
    }
    
    public function create()
    {
        $user = new \Entity\test\user();
        $user->firstname = 'John';
        $user->lastname = 'Do';
        $user->dateinsert = new DateTime();
        $user->dateupdate = new DateTime();
        $user->save();
    }
}