Change private functions to protected.

This commit is contained in:
kj 2021-01-12 21:29:23 -04:00
parent 69c982b3e9
commit 8d418c8eb9
1 changed files with 8 additions and 8 deletions

View File

@ -43,7 +43,7 @@ class ModelMySQL {
*
* @return mysqli
*/
private static function db() {
protected static function db() {
if (is_null(static::$db))
static::$db = Database::getConnection();
@ -62,7 +62,7 @@ class ModelMySQL {
* @return mysqli_result
* Contiene el resultado de la llamada SQL.
*/
private static function query($query) {
protected static function query($query) {
$db = static::db();
$result = $db->query($query);
@ -104,7 +104,7 @@ class ModelMySQL {
* @return string
* Contiene la sentencia SQL.
*/
private static function buildQuery() {
protected static function buildQuery() {
$sql = 'SELECT '.join(', ', static::$querySelect['select']);
if (static::$querySelect['from'] != '') {
@ -160,7 +160,7 @@ class ModelMySQL {
* @return ModelMySQL
* Retorna un objeto de la clase actual.
*/
public static function getInstance($elem = []) {
protected static function getInstance($elem = []) {
$class = get_called_class();
$instance = new $class;
@ -175,7 +175,7 @@ class ModelMySQL {
* @return array
* Contiene los atributos indexados del objeto actual.
*/
private function getVars() {
protected function getVars() {
$reflection = new \ReflectionClass($this);
$properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC);
$result = [];
@ -211,7 +211,7 @@ class ModelMySQL {
*
* @return string
*/
private static function table() {
protected static function table() {
if (isset(static::$table))
return static::$table;
return static::className().static::$tableSufix;
@ -220,7 +220,7 @@ class ModelMySQL {
/*
* Actualiza los valores en la BD con los valores del objeto actual
*/
private function update() {
protected function update() {
$atts = $this->getVars();
foreach ($atts as $key => $value) {
@ -247,7 +247,7 @@ class ModelMySQL {
* Inserta una nueva fila en la base de datos a partir del
* objeto actual.
*/
private function add() {
protected function add() {
$db = static::db();
$atts = $this->getVars();