avalon / database
Avalon数据库组件
dev-master / 2.0.x-dev
2018-03-25 06:03 UTC
Requires
- avalon/validation: ^2.0
- doctrine/dbal: ^2.5
Requires (Dev)
- nirix/phail-safe: 0.2.*
This package is not auto-updated.
Last update: 2024-09-14 18:47:37 UTC
README
Avalon数据库包利用了Doctrine的数据库抽象层,它实际上是围绕它的一个小包装,提供了一个简单的“模型”系统。
这不是一个ORM。
模型
模型是数据库行的表示,您可以使用模型选择、更新和删除行。
将行选择到模型中
当使用模型获取数据时,它将自动为您放入模型中。
class Article extends Avalon\Database\Model {} $articles = Article::where('is_published = :is_published') ->andWhere('user_id = :user_id') ->setParameter('is_published', 1) ->setParameter('user_id', 5) // Normally with Doctrine and PDO you would call `->execute()`, // you could do that here, but it would return the statement. // // If you simply call `fetchAll()` you will get an array of `Article` models. ->fetchAll(); foreach ($articles as $article) { echo $article->title; }