Php orm framework

I have a small school management project. There are several thousand records per table (invoices, persons, classes ...) to manage. Classic web application with HTML / AJAX UI and MySQL / PHP.

To save time and have better code, I want to use ORM for MySQL, which will handle most of the database transaction for me.

What is the best ORM to use in this case?

thank.

+3
source share
5 answers

Doctrine is an extremely powerful ORM library.

+5
source

, orm, orm. , ORM , . , , CakePHP, CodeIgniter Symphony. AFAIK , .

0

, , , Propel

0

CodeIgniter DataMapper.

CodeIgniter - PHP, , PHP.

DataMapper - ORM, Ruby On Rails.

0

ORH Kohana , . Doctrine Propel , , (, ). ( ), ORM , ( " " ).

Kohana 3 ORM:

// Model definition file - /classes/model/animal.php

class Model_Animal extends ORM
{
    /* Find all animals that bark */
    public function barking_animals()
    {
        return $this->where('sound', '=', 'barker')->find_all();
    }

    /* Find all animals that quack */
    public function quacking_animals
    {
        return $this->where('sound', '=', 'quack')->find_all();
    }
}

// In some controller file somewhere...

$loudAnimals = ORM::factory('animal')->barking_animals();

// don't rent an apartment if you're neighbors have any of these animals...
foreach ($loudAnimals as $animal)
{
    echo $animal->name;
}

// add a new animal to db
$newAnimal = orm::factory('animal');
$newAnimal->name = 'Obese Cat';
$newAnimal->weight = '30lbs';
$newAnimal->sound = 'fat quack';
$newAnimal->save();

, ... http://kohanaframework.org/guide/tutorials.orm

0

Source: https://habr.com/ru/post/1778405/


All Articles