Kohana Кто нибудь использовал kohana-orm-leap ?

confguru

ExAdmin
Команда форума
Кто нибудь использовал kohana-orm-leap - нужно чтоб использовать составные primary key

LEAP for Kohana PHP Framework
https://github.com/spadefoot/kohana-orm-leap
LEAP is an database management library for the Kohana PHP Framework and is designed to work with DB2, Drizzle, Firebird, MariaDB, MS SQL, MySQL, Oracle, PostgreSQL, and SQLite. LEAP acts a common interface between the different database dialects and connections. It provides a powerful query builder and ORM. LEAP's ORM is based on the active record design pattern, which utilizes PHP objects to model database tables.
PHP:
Comparison
 	LEAP	K3 ORM	Jelly	Sprig
Documentation	YES	YES	YES	LIMITED
Consistent API	YES	MOSTLY	MOSTLY	YES
Easily Extensible	YES	MOSTLY	MOSTLY	MOSTLY
Supports Multiple SQL Dialects	YES	KIND OF	KIND OF	KIND OF
Database Connection Pool	YES	NO	NO	NO
Query Caching	YES	YES	YES	YES
Query Builder	YES	YES	YES	YES
Strongly Typed	YES	NO	MOSTLY	MOSTLY
Non-Integer Primary Keys	YES	NO	NO	YES
Composite Keys	YES	NO	NO	PARTIALLY
Field Aliases	YES	NO	YES	NO
Field Adaptors	YES	NO	NO	NO
Field Relations	YES	YES	YES	YES
Read-Only Models	YES	NO	NO	NO
Auto-Generates HTML Form Labels/Controls	YES	NO	NO	YES
Auth Classes	YES	YES	YES	YES
Modified Preorder Tree Traversal (MPTT)	YES	YES	YES	YES
 

confguru

ExAdmin
Команда форума
Ну уже нашел пару багов, но автор в течении часа пофиксил. Мне он нужен для составных ключей - ну и вообще там много приятного, чего не хватало в обычной ORM.
Jelly мне не особо понравилась.
 

флоппик

promotor fidei
Команда форума
Партнер клуба
PHP:
public static function columns() {
		static $columns = NULL;
		if ($columns === NULL) {
			$model = get_called_class();
			$record = new $model();
			$columns = array_keys($record->fields);
		}
		return $columns;
	}
Нет, спасибо. :)

PHP:
/**
	 * This function returns the primary key for the database table.
	 *
	 * @access public
	 * @static
	 * @return array                                the primary key
	 */
	public static function primary_key() {
		return array('ID');
	}
Составные первичные ключи, говорите?
 

confguru

ExAdmin
Команда форума
1) Лечится кешированием или прописыванием в модель.
2) Да - прописываешь в модели какие поля у тебя в ключе.

PHP:
public static function columns() {
		static $columns = NULL;
		if ($columns === NULL) {
			$model = get_called_class();
			$record = new $model();
			$columns = array_keys($record->fields);
		}
		return $columns;
	}
Нет, спасибо. :)

PHP:
/**
	 * This function returns the primary key for the database table.
	 *
	 * @access public
	 * @static
	 * @return array                                the primary key
	 */
	public static function primary_key() {
		return array('ID');
	}
Составные первичные ключи, говорите?
 
Сверху