PHP Classes

App PHP Model Class: Map object variables to database table records

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 103 All time: 9,767 This week: 39Up
Version License PHP version Categories
app-model 1.0.1The PHP License5PHP 5, Databases, Design Patterns
Description 

Author

This package provides a class to map object variables to database table records.

A base class performs several operations of models to store and retrieve model variables in a database table.

Applications can create sub-classes to configure specific model objects.

Currently, it can:

- Connect to a given database using a PDO object passed to the class

- Load a model object with a given identifier from the class constructor function

- Create or update model objects by assigning model class variables

- Provide automatic model class variable getter and setter functions

- Find model objects that match a given criteria

- Define relations with other model classes in the model sub-class

- Find related model objects that match a given criteria

- Etc.

Picture of SzpaQ
  Performance   Level  
Name: SzpaQ <contact>
Classes: 5 packages by
Country: Poland Poland
Age: ???
All time rank: 300570 in Poland Poland
Week rank: 206 Up3 in Poland Poland Up

Example

<?php

/**
 *
 * LICENCE
 * ALL RIGHTS RESERVED.
 * YOU ARE NOT ALLOWED TO COPY/EDIT/SHARE/WHATEVER.
 * IN CASE OF ANY PROBLEM CONTACT AUTHOR.
 * @author ?ukasz Szpak (szpaaaaq@gmail.com)
 * @Copyright 2018 SzpaQ
 * @license ALL RIGHTS RESERVED
 *
 * * */

include 'loader.php';
$pdo = new PDO('mysql:dbname=dev_bot;host=localhost;charset=utf8', 'master', '12dsfgNJKGH&34');
App\Model::_setDB($pdo);
App\Model::setPrefix('app_');
$user = new Users(27);

echo
$user->username;
var_dump($user->getContacts(array('order' => 'contact_id DESC')));



/** Create new User */
/* $user = new Users;
    $user->email = "szpaaaaq@gmail.com";
    $user->password = md5('salt_string2357111317192329374357:szpaaaaq@gmail.com');
    $user->username = 'SzpaQ';
    $user->role_id = 1;
    $user->save();
*/
/** find One user */
// Users::findFirst(array('user_id = :uid', 'bind'=>array('uid' => 1)));
   






Details

Model

Model class Allows you to use model's classes and work with it on database instead of sending query every time

Usage

http://docs.dev-bot.pl/model.html


  Files folder image Files (7)  
File Role Description
Files folder imageclasses (1 directory)
Files folder imageexample (3 files, 1 directory)
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (7)  /  classes  
File Role Description
Files folder imageApp (1 file)

  Files folder image Files (7)  /  classes  /  App  
File Role Description
  Plain text file Model.php Class Class source

  Files folder image Files (7)  /  example  
File Role Description
Files folder imageModels (2 files)
  Accessible without login Plain text file db.sql Data Auxiliary data
  Accessible without login Plain text file loader.php Aux. Example script
  Accessible without login Plain text file test.php Example Example script

  Files folder image Files (7)  /  example  /  Models  
File Role Description
  Plain text file Contacts.php Class Class source
  Plain text file Users.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:103
This week:0
All time:9,767
This week:39Up