Last active
January 5, 2017 17:44
-
-
Save pokisin/25556c8b90be4538cbb54c0eba8b1670 to your computer and use it in GitHub Desktop.
Usar query personalizado en el modelo - Phalcon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\DI\FactoryDefault; | |
class Empresa extends \Phalcon\Mvc\Model | |
{ | |
public static function getall(){ | |
$query = "SELECT * from empresa"; | |
$db = self::getConnection(); | |
return $db->fetchAll($query, Phalcon\Db::FETCH_ASSOC); | |
} | |
public static function getConnection(){ | |
$di = FactoryDefault::getDefault(); | |
return $di->get('db'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment