sena/nogal.se 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sena/nogal.se

Composer 安装命令:

composer require sena/nogal.se

包简介

Nogal (Student Edition) - This is an ORM implementation in PHP7 based on DAO to be used in the learning environments of the National Learning Service - SENA in Colombia.

README 文档

README

It is a tiny implementation of the PHP7 ORM programming model based on DAO (Data Access Object) for use in the learning environments of the National Learning Service - SENA in Colombia.

Installation

For you to be able to use Nogal SE in your project, you must have the Composer tool installed.

composer require sena/nogal.se

Estructura del modelo

Nogal (Edición Estudiante) propone la siguiente estructura.

+--------------------
| model/
|-- base/
|---- UserBase.php
|-- User.php
+--------------------

Para poder explicar lo anterior debemos partir de que usaremos la siguiente estructura SQL para la tabla User.

CREATE TABLE DbUser (
    Id int,
    Nick varchar(20),
    Password varchar(32),
    Actived boolean DEFAULT true,
    Created_at timestamp DEFAULT NOW()
);

Archivo User.php

El siguiente código sería entonces el contenido del archivo User.php

<?php

namespace MyApp\model;

use MyApp\model\base\UserBase;

class User extends UserBase
{
  
}

En estos archivos se ubicaría la lógica del negocio que tenga que ver con la tabla User, por ejemplo: necesito consultar el id de un usuario.

 <?php
 
 namespace MyApp\model;
 
 use MyApp\model\base\UserBase;
 
 class User extends UserBase
 {
   public function SearchIdByUser()
   {
     $sql  = 'SELECT Id FROM DbUser WHERE Nick = :nick';
     $this->SetDbParam(':nick', $this->getNick(), \PDO::PARAM_STR);
     $data = $this->Query($sql);
     if (count($data) > 0) {
       return $data;
     }
     else {
       return false;
     }
   }
 }

Archivo UserBase.php

Este archivo contiene la estructura base de la tabla User y podemos expresarla de la siguiente forma:



                                    

统计信息

  • 总下载量: 83
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固