cake-php
[Arriba] [Todas las Listas]

Modelo::AfterFind $formato de resultados, asociaciones

To: cake-php@xxxxxxxxxxxxxxxx
Subject: Modelo::AfterFind $formato de resultados, asociaciones
From: Vanja Dizdarević <lex.non.scripta@xxxxxxxxx>
Date: Tue, 25 Jun 2013 11:21:54 -0700 (PDT)
Delivery-date: Tue, 25 Jun 2013 14:22:06 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=h0t/u4isbglH1TgfvTKPkaKTK6ilIJYPe3KO3yAXIn4=; b=mzrbgpyWf2RtEK1PjIw2gMdjbnDnDmz8XlyrFBDb0EgW4oYtpCBQpfhms0LVlkxhqG skfh9uWey1ylBS9gLAM1f8JLucbCyDwsgIdQ0Toe4CGIaBlq4x320wOlGuZaxM4+7JXt 8BEBDx51V2d5SjOZBXdnNoinz9qYdl43IyCkpquP7FGDze86es1S2SwoA5zfSJDdR1dh rIsm4Mmf6wi1GSniyvTvKuDXLJ6MTqSsKLxMsO3f39aYB1NhEejiTa7+XxW/r0lB4y/p p6/bKVn9Aen59aYRvZjTxrJ1TAcPd3ONOGSkJaCY5Mg26HMZa2drUVnyRyn1004IP+ji Y7RA==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-beenthere:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=h0t/u4isbglH1TgfvTKPkaKTK6ilIJYPe3KO3yAXIn4=; b=bfeh4nm6urTIRHE0/I0OjpWhdyHV+BQr53qs1Nh3xASGBQwYIWHTwrMMUmE5vhuWaB Kb0+h7OYJMGwXEaejGGgdQ8GEFzP63c2eCUgSouySAKxCba6NJmiTpLu1KUAJ9/8m9Nq uFAcZuCTqc1gBGRa9W40GZ73+4iJGswtCc0lMc6RabA+hq3GLY42LIUtycKgRMYAGnYn SMMAxleDq0oO4hxMzpPeLDUqq+eTNRboZ/DNCzywOtNClCAtT+dF2LU1jzo/rd0Hab12 Mwenx212zWci9SnjU3QRQ9aiEC22aAZTrl8lNwaOR/Z0a26rbcuhAgVcI/TOYQOgSITJ fqWw==
Envelope-to: traductor@xxxxxxxxxxx
List-archive: <http://groups.google.com/group/cake-php>
List-help: <http://groups.google.com/support/>, <mailto:cake-php+help@googlegroups.com>
List-id: <cake-php.googlegroups.com>
List-post: <http://groups.google.com/group/cake-php/post>, <mailto:cake-php@googlegroups.com>
List-subscribe: <http://groups.google.com/group/cake-php/subscribe>, <mailto:cake-php+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/cake-php/subscribe>, <mailto:googlegroups-manage+1003367825667+unsubscribe@googlegroups.com>
Mailing-list: list cake-php@xxxxxxxxxxxxxxxx; contact cake-php+owners@xxxxxxxxxxxxxxxx
Reply-to: cake-php@xxxxxxxxxxxxxxxx
Sender: cake-php@xxxxxxxxxxxxxxxx
Cuando muchos han fallado antes de mí, estoy probando a masaje algún dato en 
el *afterFind *callback en *CakePHP 2.3.6.

 Función pública *afterFind($resultados, $primario = falso)
        $#verbcj = padre::*afterFind($resultados, $primario);
        *foreach ($resultados como $clave => $*val)
              //#punt.. Hacer nom_nom_nom
As many have failed before me, I am trying to massage some data in the 
afterFind callback in CakePHP 2.3.6.

 public function afterFind($results, $primary = false) {
        $results = parent::afterFind($results, $primary);
        foreach ($results as $key => $val) {
              //... do stuff
        }
        return $results;
    }

But, as I have seen in many examples on the web, there are many different 
formats that can be expected in the $results array, depending on which 
model called the find method (associated data gets quite ugly).
I'm thinking of using THIS solution: 
https://groups.google.com/d/topic/cake-php/Mqufi67UoFo/discussion
Is this *really *the best method we have?

If yes, I sure hope this will change in CakePHP 3.0. IMHO, complex array 
format tests shouldn't exist in a model. Why not just pass me the results 
array before merging it into the caller-model results?

Are there any alternatives? In despair, I'm thinking of changing the Core 
DboSource and plugging in a new callback before MergeAssociation. Yes, it's 
that bad, please help! :)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


<Anterior por Tema] Tema Actual [Siguiente por Tema>