Coder Social home page Coder Social logo

arity's Introduction

Arity PHP ORM

Description

Project : Arity - Arity PHP ORM

Features

  • No XML required.
  • Support nth level of relationships.
  • Table defination exist within the mapping class.
  • Can Supports sql independent providers.
  • Supported Databases:Postgresql

Installation procedure:

Setup the database connection in config/config.inc.php Leave PGSQL_SCHEMA as public, if you havent created you own schema.

HOW TO USE:

Step1: Create model class.

Create file: sample.php

class Sample {
	 
	public static $meta;

	public $id;
	
	public $name;
	
	public $score;

	public function  __construct()  {

		self::$meta->id= new Type('id',ARITY_SERIAL,11,ARITY_EMPTY,ARITY_REQUIRED,ARITY_PRIMARY);
		 
		self::$meta->name= new Type('name',ARITY_VARCHAR,50);
		
		self::$meta->score= Type::create('score',ARITY_INT,11);
	}

}

Step 2: Access the Arity Context methods. Create test.php for accessing the Arity Context methods for data persistence.

Create file:test.php

require 'loader.php';

require 'sample.php';//If the the class is in sample file

echo "/* Create PHP Object*/<br/>";

$testObj=new Sample();

echo "Initialize Simple PHP Object"."<br/>";

$testObj->name="sam";

echo "/* Add Object to Arity peristent manager*/<br/>";

$dbObj=Arity::addObject($testObj);

echo "Create Persistent Object Table<br/>";

$dbObj->createTable();

echo "Save Simple Object or Persist Object"."<br/>";

$dbObj->save();

echo "Fetch Persisted PHP Object from DB"."<br/>";

$rs=$dbObj->fetch()->object();

var_dump($rs);

echo "Clean Simple Object Entries"."<br/>";;

$dbObj->truncateTable();

$rs=$dbObj->fetch()->object();

var_dump($rs);

echo "Drop Persistent Object Table"."<br/>";;

$dbObj->removeTable();

arity's People

Contributors

munfasil avatar yousha avatar syed-shahrukh-hussain avatar

Watchers

Discrete Works avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.