title: How can I pass a variable from one class to other without use a function in php?
body: <p>I have <code>daoHistorial.php</code>:</p>
  
  <pre><code> &lt;?php
  
  require "transferDao/daoTransferHistorial.php";
  
  require "bdconnection.php";
  
  
      class daoHistorial{
  
              public function sqlSelect($tarea){
  
                      $aObjects=array();
  
  
                      $dbconn = new DBconnection();
                      $db = $dbconn-&gt;bdConnection();
                      $stmt = $db-&gt;prepare("SELECT t1.tar_id, t1.rea_seccion, t1.rea_porcentaje, t1.rea_descripcion, t1.hrs_tarea, t1.tar_fechtermino 
                                            FROM act_registtarea t1
                                            inner join act_tarea t2
                                            ON t1.tar_id = t2.tar_id 
                                            where t2.tar_nombre = '$tarea'");
                      $stmt-&gt;execute();
                      $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);
                      $result = $stmt-&gt;fetchAll();
  
                      foreach ($result as $row) {
                              $aTransfer = new daoTransferHistorial();
                              $aTransfer-&gt;setPorcentaje($row['rea_porcentaje']);
                              $aTransfer-&gt;setDescripcion($row['rea_descripcion']);
                              $aTransfer-&gt;setFechaTermino($row['tar_fechtermino']);
                              $aTransfer-&gt;setSeccion($row['rea_seccion']);
                              $aTransfer-&gt;setHora($row['hrs_tarea']);
  
                              $aObjects[]=$aTransfer;
                      }
  
                      print_r($aObjects);
                      return $aObjects;
              }   
      }
  ?&gt;
  </code></pre>
  
  <p>And I have <code>controllerHistorial.php</code>:</p>
  
  <pre><code>&lt;?php
  
  require "dao/daoHistorial.php";  
  
  class HistorialTareas {
  
      public function getHistorial() {
  
          $aTransfer = new daoHistorial();
  
          foreach($aTransfer-&gt;sqlSelect() as $sKey=&gt;$oValue){    
              $list[] = array('porcentaje' =&gt; $oValue-&gt;getPorcentaje(),
                              'descripcion' =&gt; $oValue-&gt;getDescripcion(),
                              'fecha_termino' =&gt; $oValue-&gt;getFechaTermino(),
                              'seccion' =&gt;$oValue-&gt;getSeccion(),
                              'hora' =&gt;$oValue-&gt;getHora()
                              );
          }
          print_r($list);
          return $list;
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>here : <code>foreach($aTransfer-&gt;sqlSelect() as $sKey=&gt;$oValue){</code> I have a problem for Missing argument with </p>
  
  <blockquote>
    <p>sqlSelect()</p>
  </blockquote>
  
  <p>I need use <code>sqlSelect($tarea)</code> from `daoHistorial.php. </p>
  
  <p>I know that I need pass the parameter in <code>public function getHistorial($tarea)</code> </p>
  
  <p>But I need this :</p>
  
  <pre><code>public function getHistorial() {
  $aTransfer = new daoHistorial();
  foreach($aTransfer-&gt;sqlSelect($tarea) as $sKey=&gt;$oValue){
  </code></pre>
  
  <p>because after I need <code>getHistorial()</code> without parameter.</p>