Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/03/2010, 10:53
niewpendejo
 
Fecha de Ingreso: agosto-2009
Mensajes: 138
Antigüedad: 15 años, 4 meses
Puntos: 0
Respuesta: Zend framewor y conexion a base de datos

hola tengo el siguiente codigo:

Código PHP:
class Application_Model_DbTable_Grupos extends Zend_Db_Table_Abstract
{

    protected 
$_name 'group_serv';
    protected 
$_primary 'Groups';
    public function 
init()
    {
     
      

    }
    public function 
listar(){

        return 
$this->fetchAll();
    }

Código PHP:
class Application_Model_GuestgroupMapper
{

   
    public function 
listar()
    {

        
$grupos = new Application_Model_DbTable_Grupos();
        
        return 
$grupos->listar();
       
    }

Código PHP:
class LoginController extends Zend_Controller_Action
{

    public function 
init()
    {
       
    }
  
    public function 
indexAction()
    {
        
// action body

       
$grupos = new Application_Model_GuestgroupMapper();
        
// Prepara un listado de las 10 últimas ciudades
        
$a $grupos->listar();
        
print_r($a);

pero el pint_r saca un chorizo enorme y yo solo quiero traer los grupos.esto es lo que saca:
Código:
end_Db_Table_Rowset Object ( [_data:protected] => Array ( [0] => Array ( [Groups] => G1 [Id] => S1-641023 ) [1] => Array ( [Groups] => G2 [Id] => D1-641022 ) ) [_table:protected] => Application_Model_DbTable_Grupos Object ( [_name:protected] => group_serv [_primary:protected] => Array ( [1] => Groups ) [_definition:protected] => [_definitionConfigName:protected] => [_db:protected] => Zend_Db_Adapter_Pdo_Mysql Object ( [_pdoType:protected] => mysql [_numericDataTypes:protected] => Array ( [0] => 0 [1] => 1 [2] => 2 [INT] => 0 [INTEGER] => 0 [MEDIUMINT] => 0 [SMALLINT] => 0 [TINYINT] => 0 [BIGINT] => 1 [SERIAL] => 1 [DEC] => 2 [DECIMAL] => 2 [DOUBLE] => 2 [DOUBLE PRECISION] => 2 [FIXED] => 2 [FLOAT] => 2 ) [_defaultStmtClass:protected] => Zend_Db_Statement_Pdo [_config:protected] => Array ( [host] => localhost [username] => root [password] => simec [dbname] => red [charset] => [persistent] => [options] => Array ( [caseFolding] => 0 [autoQuoteIdentifiers] => 1 ) [driver_options] => Array ( ) ) [_fetchMode:protected] => 2 [_profiler:protected] => Zend_Db_Profiler Object ( [_queryProfiles:protected] => Array ( ) [_enabled:protected] => [_filterElapsedSecs:protected] => [_filterTypes:protected] => ) [_defaultProfilerClass:protected] => Zend_Db_Profiler [_connection:protected] => PDO Object ( ) [_caseFolding:protected] => 0 [_autoQuoteIdentifiers:protected] => 1 [_allowSerialization:protected] => 1 [_autoReconnectOnUnserialize:protected] => ) [_schema:protected] => [_cols:protected] => Array ( [0] => Groups [1] => Id ) [_identity:protected] => 1 [_sequence:protected] => 1 [_metadata:protected] => Array ( [Groups] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => group_serv [COLUMN_NAME] => Groups [COLUMN_POSITION] => 1 [DATA_TYPE] => varchar [DEFAULT] => [NULLABLE] => [LENGTH] => 20 [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => 1 [PRIMARY_POSITION] => 1 [IDENTITY] => ) [Id] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => group_serv [COLUMN_NAME] => Id [COLUMN_POSITION] => 2 [DATA_TYPE] => varchar [DEFAULT] => [NULLABLE] => [LENGTH] => 20 [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => [IDENTITY] => ) ) [_metadataCache:protected] => [_metadataCacheInClass:protected] => 1 [_rowClass:protected] => Zend_Db_Table_Row [_rowsetClass:protected] => Zend_Db_Table_Rowset [_referenceMap:protected] => Array ( ) [_dependentTables:protected] => Array ( ) [_defaultSource:protected] => defaultNone [_defaultValues:protected] => Array ( ) ) [_connected:protected] => 1 [_tableClass:protected] => Application_Model_DbTable_Grupos [_rowClass:protected] => Zend_Db_Table_Row [_pointer:protected] => 0 [_count:protected] => 2 [_rows:protected] => Array ( ) [_stored:protected] => 1 [_readOnly:protected] => )
que es lo que hago mal