PHP Classes

Connection Factory: Connect to database and run queries using Doctrine

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: 132 All time: 9,329 This week: 57Up
Version License PHP version Categories
connectionfactory 1Free For Educatio...5PHP 5, Databases, Design Patterns
Description 

Author

This class can connect to database and run queries using Doctrine.

It can create a Doctrine entity manager using configuration values.

The class can also perform common object queries on models like find one, find all, find by criteria, create queries, save objects, etc..

Picture of Axel Alexnder
  Performance   Level  

 

Example

<?php
 
/*
 * Project: AX MVC
 * File : /models/Classificado.php
 * Purpose : model for the error controller.
 * Author : Axel Alexander Martins Benites
 */

require_once 'bootstrap.php';
require_once
'ConnectionFactory.php';
require_once
'entities/Notificacao.php';


#1 - conectar ao mysql
#2 - criar a tabela Notifica??o
 

// repositorio
$retorno = ConnectionFactory::getInstance()->RepositoryfindBy('Notificacao',
        array(
'usuario' => $id , 'id' => 2),
        array(
'id'=>'DESC'), null, null );

print_r ( $retorno ) ;


// query
function getAll($id){
       
$strSql = "SELECT n from Notificacao n WHERE n.id = :id ";
       
$setParam = array("id" => $id);
        return
ConnectionFactory::getInstance()->criarQuery(
       
$strSql , $setParam , 2);
}

$retorno = getAll(1);

print_r ( $retorno ) ;


Details

ConnectionFactory : 1. conexao com mysql 2. Implementa??o de crud Thanks to Maria Eduarda Carvalho Benites e Camila Batalha Carvalho este e o meu primeiro projeto de varios http://axeldeveloper.esy.es/#/home

  Files folder image Files (5)  
File Role Description
Files folder imageentities (1 file)
Accessible without login Plain text file bootstrap.php Aux. inicial
Plain text file ConectionFactory.php Class Class
Accessible without login Plain text file README Doc. README
Accessible without login Plain text file teste.php Example Teste

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  
 0%
Total:132
This week:0
All time:9,329
This week:57Up