Daniia/Daniia.php
final public function from($table="",$aliasFrom="") {
      $this->connection();

      $sql = "";
      $closure = false;
      // si es un closure lo ejecutamos
      if ($table instanceof \Closure) {
         // el resultado resuelto es almacenado en la variable $_ENV["daniia_from"]
         // para luego terminar de agruparlo
         $table(new \Daniia\Daniia());
         $sql = $_ENV["daniia_daniia"]->get_sql();
         $_ENV["daniia_daniia"] = null;
         $sql.= " AS ".($aliasFrom ? $aliasFrom : " _alias_ ");
         $closure = true;
      }
      else {
         if (func_num_args()>1){
            $table = func_get_args();
         }
         elseif(is_string($table)) {
            $table = [$table];
         }
         
         $schema = '';
         if ($this->driver=='pgsql' && $this->schema) {
            $schema = $this->schema ? $this->schema.'.' : '';
         }
         
         $tmp_table = [];
         foreach($table as $val) {
            if (preg_match('/\./', $val)) {
               $tmp_table[] = $val;
            }
            else {
               $tmp_table[] = $schema.$val;
            }
         }
         
         $table = implode(",", $tmp_table);
      }
      
      if ($this->extended && is_string($table) && !$closure) {
         $table = $schema.$this->table.",".$table;
      }
      
      
      if (!$this->bool_group) {
         if ( !$this->table && gettype( $table )==='string') {
            $this->table = $table;
         }
         $this->from = str_replace("_table_", ($closure ? $sql : ($table ?: $this->table)), $this->from);
      }

      $this->find_first_data = $this->find_save_data = $this->find_delete_data = FALSE;

      $this->get_instance();
      return $this;
   }
final public function from($table="",$aliasFrom="") {
      $this->connection();

      $sql = "";
      $closure = false;
      // si es un closure lo ejecutamos
      if ($table instanceof \Closure) {
         // el resultado resuelto es almacenado en la variable $_ENV["daniia_from"]
         // para luego terminar de agruparlo
         $table(new \Daniia\Daniia());
         $sql = $_ENV["daniia_daniia"]->get_sql();
         $_ENV["daniia_daniia"] = null;
         $sql.= " AS ".($aliasFrom ? $aliasFrom : " _alias_ ");
         $closure = true;
      }
      else {
         if (func_num_args()>1){
            $table = func_get_args();
         }
         elseif(is_string($table)) {
            $table = [$table];
         }
         
         $schema = '';
         if ($this->driver=='pgsql' && $this->schema) {
            $schema = $this->schema ? $this->schema.'.' : '';
         }
         
         $tmp_table = [];
         foreach($table as $val) {
            if (preg_match('/\./', $val)) {
               $tmp_table[] = $val;
            }
            else {
               $tmp_table[] = $schema.$val;
            }
         }
         
         $table = implode(",", $tmp_table);
      }
      
      if ($this->extended && is_string($table) && !$closure) {
         $table = $schema.$this->table.",".$table;
      }
      
      
      if (!$this->bool_group) {
         if ( !$this->table && gettype( $table )==='string') {
            $this->table = $table;
         }
         $this->from = str_replace("_table_", ($closure ? $sql : ($table ?: $this->table)), $this->from);
      }

      $this->find_first_data = $this->find_save_data = $this->find_delete_data = FALSE;

      $this->get_instance();
      return $this;
   }
final public function from ( $ table = "" , $ aliasFrom = "" ) { $ this -> connection ( ) ; $ sql = "" ; $ closure = false ; // si es un closure lo ejecutamos if ( $ table instanceof \ Closure ) { // el resultado resuelto es almacenado en la variable $_ENV["daniia_from"] // para luego terminar de agruparlo $ table ( new \ Daniia \ Daniia ( ) ) ; $ sql = $ _ENV [ "daniia_daniia" ] -> get_sql ( ) ; $ _ENV [ "daniia_daniia" ] = null ; $ sql .= " AS " . ( $ aliasFrom ? $ aliasFrom : " _alias_ " ) ; $ closure = true ; } else { if ( func_num_args ( ) > 1 ) { $ table = func_get_args ( ) ; } elseif ( is_string ( $ table ) ) { $ table = [ $ table ] ; } $ schema = '' ; if ( $ this -> driver == 'pgsql' && $ this -> schema ) { $ schema = $ this -> schema ? $ this -> schema . '.' : '' ; } $ tmp_table = [ ] ; foreach ( $ table as $ val ) { if ( preg_match ( '/\./' , $ val ) ) { $ tmp_table [ ] = $ val ; } else { $ tmp_table [ ] = $ schema . $ val ; } } $ table = implode ( "," , $ tmp_table ) ; } if ( $ this -> extended && is_string ( $ table ) && ! $ closure ) { $ table = $ schema . $ this -> table . "," . $ table ; } if ( ! $ this -> bool_group ) { if ( ! $ this -> table && gettype ( $ table ) === 'string' ) { $ this -> table = $ table ; } $ this -> from = str_replace ( "_table_" , ( $ closure ? $ sql : ( $ table ? : $ this -> table ) ) , $ this -> from ) ; } $ this -> find_first_data = $ this -> find_save_data = $ this -> find_delete_data = FALSE ; $ this -> get_instance ( ) ; return $ this ; }
Establece el nombre de la tabla a consultar
@author Carlos Garcia
@param $table String|Closure
@param $alias String
@return Object
Establece el nombre de la tabla a consultar