File: phptricksORM/Model.php

Recommend this page to a friend!
  Classes of mohammad anzawi  >  PHP PDO database class  >  phptricksORM/Model.php  >  Download  
File: phptricksORM/Model.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP PDO database class
Access databases using PDO
Author: By
Last change:
Date: 7 months ago
Size: 1,595 bytes
 

Contents

Class file image Download
<?php
/**
 * *
 * * please don't remove this comment block
 * *
 * * @author phptricks Team - Mohammad Anzawi
 * * @author_uri https://phptricks.org
 * * @uri https://github.com/anzawi/php-database-class
 * * @version 5.0.0
 * * @licence MIT -> https://opensource.org/licenses/MIT
 * * @package PHPtricks\Orm
 *
 */

namespace PHPtricks\Orm;

use
PHPtricks\Orm\DML\Delete;
use
PHPtricks\Orm\DML\Insert;
use
PHPtricks\Orm\DML\Paginate;
use
PHPtricks\Orm\DML\Query;
use
PHPtricks\Orm\DML\Update;
use
PHPtricks\Orm\DML\Vars;
use
PHPtricks\Orm\Operations\Operations;
use
PHPtricks\Orm\Relation\RelationProvider;

/**
 * Class Model
 * @since version 5.0.0
 * @package PHPtricks\Orm
 */
class Model extends Database
{

    use
Vars;
    use
Query;
    use
Insert;
    use
Paginate;
    use
Update;
    use
Delete;
    use
Operations;
    use
RelationProvider;

   
/**
     * Model constructor.
     */
   
public function __construct()
    {
       
/** @var PDO $db */
       
$db = parent::connect();
       
$this->_pdo = $db->_pdo;
    }

   
/**
     * change id columns name
     *
     * @param string $idName
     */
   
public function idName($idName = "id")
    {
       
$this->_idColumn = $idName;

        return
$this;
    }

    public function
id()
    {
        return
$this->_idColumn;
    }

    public function
results()
    {
       
$returnedResults = $this->_results;
       
$returnedResults['re'] = $this;

        return
$returnedResults;
    }

   
/*** New */
   
protected function getQueryAdditions()
    {
        return
$this->_query;
    }

}


For more information send a message to info at phpclasses dot org.