Message from discussion
Model retornando array
Received: by 10.58.147.42 with SMTP id th10mr8179905veb.23.1352844135985;
Tue, 13 Nov 2012 14:02:15 -0800 (PST)
X-BeenThere: zfbrasil@googlegroups.com
Received: by 10.52.34.13 with SMTP id v13ls9549169vdi.3.gmail; Tue, 13 Nov
2012 14:02:12 -0800 (PST)
Received: by 10.58.147.42 with SMTP id th10mr8179844veb.23.1352844132435;
Tue, 13 Nov 2012 14:02:12 -0800 (PST)
Received: by 10.58.147.42 with SMTP id th10mr8179842veb.23.1352844132419;
Tue, 13 Nov 2012 14:02:12 -0800 (PST)
Return-Path: <th.paiva.al...@gmail.com>
Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52])
by gmr-mx.google.com with ESMTPS id bn19si3789136vdb.0.2012.11.13.14.02.12
(version=TLSv1/SSLv3 cipher=OTHER);
Tue, 13 Nov 2012 14:02:12 -0800 (PST)
Received-SPF: pass (google.com: domain of th.paiva.al...@gmail.com designates 209.85.212.52 as permitted sender) client-ip=209.85.212.52;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of th.paiva.al...@gmail.com designates 209.85.212.52 as permitted sender) smtp.mail=th.paiva.al...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-vb0-f52.google.com with SMTP id k17so11162084vbj.39
for <zfbrasil@googlegroups.com>; Tue, 13 Nov 2012 14:02:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=GP+HvPQZyUS7qvWavBWgFEOxBD2pQzzmdPnWWtafZDA=;
b=wqRPuBN/ids7qvuTbPd6AlYe0bg3WhMTTj/S1ezA6ueJTA6DbQKL1KgSVitXQ/P1wR
p241UIrcV8rya33EM1fzhwJbyOKNytFYyAHvZJBkTIacOY2b6CuBjcVvbkiFiWLXmcUj
U/X1xWNP5YGmxmp10Sjt9/SOXuRlnhfRAthqJyhX/utwjd3BJ0vvmot4aRtJIf4XuT9w
Lz/pXusfPTx5JNWvJjXz5Ft25Az7kay/y8QmNCZYjdaVgw1J3tZOQZ+VOLD9CuunIQA5
wXuEQr+k1hyEQN2atMzHZm38GuXmOqRn9stS35dX4rr5SmwVv1Wz0jPKYbFxB5d+KoAu
xxMw==
MIME-Version: 1.0
Received: by 10.52.29.141 with SMTP id k13mr29428073vdh.131.1352844132286;
Tue, 13 Nov 2012 14:02:12 -0800 (PST)
Received: by 10.58.245.169 with HTTP; Tue, 13 Nov 2012 14:02:12 -0800 (PST)
In-Reply-To: <CAEPwAwPWLUwTOmTO7EftdZSgyruw0L62-gxb7MiNcdCbq12...@mail.gmail.com>
References: <CAEPwAwPWLUwTOmTO7EftdZSgyruw0L62-gxb7MiNcdCbq12...@mail.gmail.com>
Date: Tue, 13 Nov 2012 19:02:12 -0300
Message-ID: <CABz0uAF7doTCus7=LVzQJRxLdDWDL=5sPF8hLx9D9YWGyNG...@mail.gmail.com>
Subject: Re: [zfbrasil] Model retornando array
From: Thiago Paiva <th.paiva.al...@gmail.com>
To: zfbrasil@googlegroups.com
Content-Type: multipart/alternative; boundary=20cf307c9b0cf0ff5504ce679168
--20cf307c9b0cf0ff5504ce679168
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
$this->_db->getAdapter()->fetchAll($sql) ou eh o getDefaultAdapter, mas,
enfim, tenta esses =3D)
Em 13 de novembro de 2012 18:38, Sergio Augusto Vladisauskis <
sergi...@gmail.com> escreveu:
> Pessoal, criei uma fun=E7=E3o dentro do meu modelo e ao inv=E9s de me ret=
ornar
> um objeto, ele est=E1 me voltando um array, teria como retornar um objeto=
?
>
> Ex:
>
> public function getHistoricos( $conta_id =3D NULL )
> {
> $select =3D $this->_db->select()
> ->from( array( "h" =3D> $this->_name ) )
> ->join( array( "c" =3D> "tbl_conta" ), "c.id =
=3D
> h.conta_id" )
> ->where( 'h.conta_id =3D ?', $conta_id );
>
> return $this->_db->fetchAll( $select );
> }
>
> O fetchAll retorna um objeto, mas a fun=E7=E3o acima retorna um array.
> --
> Sergio Augusto Vladisauskis
> -> Oportunix IT Services Brasil - ME
> -> Site: http://www.facebook.com/oportunix
> -> Fone: +55 (15) 3411-2300
> -> M=F3vel: +55 (15) 8164-4014 [TIM] / +55 (11) 9-5308-7965 [Vivo]
> -> Skype: oportunix
> -> Registered Linux User: 305281
>
> --
> Essa mensagem faz parte do grupo "zfbrasil" no Google Groups.
> Para escrever neste grupo, envie um email para zfbrasil@googlegroups.com
> Para se desligar do grupo, envie um email para
> zfbrasil-unsubscribe@googlegroups.com
> Mais informa=E7=F5es, visite o grupo em
> http://groups.google.com/group/zfbrasil?hl=3Dpt-BR
--=20
Atenciosamente,
Thiago Paiva de Oliveira Alves
////////////////////////////////////////////////////////////////////////
////*Bacharel em Ci=EAncias da Computa=E7=E3o ////
////////////////////////////////////////////////////////////////////////
--20cf307c9b0cf0ff5504ce679168
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
$this->_db->getAdapter()->fetchAll($sql) ou eh o getDefaultAdapter=
, mas, enfim, tenta esses =3D)<div><br><div class=3D"gmail_quote">Em 13 de =
novembro de 2012 18:38, Sergio Augusto Vladisauskis <span dir=3D"ltr"><<=
a href=3D"mailto:sergi...@gmail.com" target=3D"_blank">sergi...@gmail.com</=
a>></span> escreveu:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Pessoal, criei uma fun=E7=E3o dentro do meu =
modelo e ao inv=E9s de me retornar um objeto, ele est=E1 me voltando um arr=
ay, teria como retornar um objeto?<div>
<br></div><div>Ex:</div><div><br></div><div><div>public function getHistori=
cos( $conta_id =3D NULL )</div>
<div>=A0 =A0 {</div><div>=A0 =A0 =A0 =A0 $select =3D $this->_db->sele=
ct()</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->=
;from( array( "h" =3D> $this->_name ) )</div><div>=A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->join( array( "c&q=
uot; =3D> "tbl_conta" ), "<a href=3D"http://c.id" target=
=3D"_blank">c.id</a> =3D h.conta_id" )</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->where( &#=
39;h.conta_id =3D ?', $conta_id );</div><div>=A0 =A0 =A0 =A0=A0</div><d=
iv>=A0 =A0 =A0 =A0 return $this->_db->fetchAll( $select );</div><div>=
=A0 =A0 }</div></div><div><br></div><div>O fetchAll retorna um objeto, mas =
a fun=E7=E3o acima retorna um array.</div>
<div>--<br>Sergio Augusto Vladisauskis<br>-> Oportunix IT Services Brasi=
l - ME<br>-> Site: <a href=3D"http://www.facebook.com/oportunix" target=
=3D"_blank">http://www.facebook.com/oportunix</a><br>-> Fone: <a href=3D=
"tel:%2B55%20%2815%29%203411-2300" value=3D"+551534112300" target=3D"_blank=
">+55 (15) 3411-2300</a><br>
-> M=F3vel: <a href=3D"tel:%2B55%20%2815%29%208164-4014" value=3D"+55158=
1644014" target=3D"_blank">+55 (15) 8164-4014</a> [TIM] / <a href=3D"tel:%2=
B55%20%2811%29%209-5308-7965" value=3D"+5511953087965" target=3D"_blank">+5=
5 (11) 9-5308-7965</a> [Vivo]<br>
-> Skype: oportunix<br>-> Registered Linux User: 305281<span class=3D=
"HOEnZb"><font color=3D"#888888"><br>
</font></span></div><span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
Essa mensagem faz parte do grupo "zfbrasil" no Google Groups.<br>
Para escrever neste grupo, envie um email para <a href=3D"mailto:zfbrasil@g=
ooglegroups.com" target=3D"_blank">zfbrasil@googlegroups.com</a><br>
Para se desligar do grupo, envie um email para <a href=3D"mailto:zfbrasil-u=
nsubscribe@googlegroups.com" target=3D"_blank">zfbrasil-unsubscribe@googleg=
roups.com</a><br>
Mais informa=E7=F5es, visite o grupo em <a href=3D"http://groups.google.com=
/group/zfbrasil?hl=3Dpt-BR" target=3D"_blank">http://groups.google.com/grou=
p/zfbrasil?hl=3Dpt-BR</a></font></span></blockquote></div><br><br clear=3D"=
all"><div>
<br></div>-- <br>Atenciosamente,<br><br>Thiago Paiva de Oliveira Alves<br><=
br>=A0 ////////////////////////////////////////////////////////////////////=
////<br>=A0////*Bacharel em Ci=EAncias da Computa=E7=E3o=A0=A0=A0=A0=A0=A0 =
////<br>///////////////////////////////////////////////////////////////////=
/////<br>
</div>
--20cf307c9b0cf0ff5504ce679168--