cake-php
[Arriba] [Todas las Listas]

Re: Modelo::AfterFind $formato de resultados, asociaciones

To: cake-php@xxxxxxxxxxxxxxxx
Subject: Re: Modelo::AfterFind $formato de resultados, asociaciones
From: Vanja Dizdarević <lex.non.scripta@xxxxxxxxx>
Date: Sat, 29 Jun 2013 21:59:00 -0700 (PDT)
Delivery-date: Sun, 30 Jun 2013 00:59:18 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:date:from:to:message-id:in-reply-to:references: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=IWHNgST0Y0oWAG0NgTVJwvV/RX7otw1JpWmNPe3a6UM=; b=uPU8rwJzXqpqqdylDmnYWUg/J2cXnzO0arEuGG66r7iDkpNQLAP/yRUNpzatwQmnbq 999tSuZGlpujpbe0zulFCZGRNQMEaXZvTxSh6mBH/zx7bmgNABO18fPZwcIqLfAr4/ZV 2o8lzrAefDbY0gFsk1pk5ENyPwTNdtkT500Xt6/M+7JZh0v/vI53ES4/cRinoJx/zauU pgyH4EPtP3awfr4Qvl3UXKTxRoyqWi9RLvW4052T8oXGGg3P1T4BD9mjS2AGJ0ZbFGCn 2u0el9qFvpdL0puf0m54AkEWR83QjCz4r65ajL+Vmp3AIx0Ta/C0L1pxxg2npACxUStq 2baw==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-beenthere:date:from:to:message-id:in-reply-to:references: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=IWHNgST0Y0oWAG0NgTVJwvV/RX7otw1JpWmNPe3a6UM=; b=aOopjTVD5faZbkSeavAU5SQqAsaMyUbwTvJDmcpXFiBFNuJcodfb/K+KKumqBj3csw OJSPT5l9WJozscnZ+FG3rt0+PgiHLUmjFPZuXG8YzHnQQ1UhGiYxFipbe3ZXqmG/o0kD zRV1UbbDcQOm+nY62MmO9TTBgvfvPn6N1mdKgLxQfNYJbaAkGQmOrS6MRh9Yw2SsbD/e oYY5YXdXJf1+A96ckanqEgSL38gxriMIOP7IA3qW0EbLvGpe44wzl1riFNoj+aHMROeF kmc02p9AEiz/e4h+EOl0/BHi0Hy23KZsrWlUm5n0aDvQg+rWrbjcRxH10CRwSCCLZ43W Oqpg==
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <5ad9f3ff-6c45-4d8a-b7e0-d5bf1ebdac97@googlegroups.com>
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
References: <12f3399f-39a3-4690-8bc8-986e870da0a0@googlegroups.com> <c253ea6d-61f4-4357-ba0f-e38cad818f32@googlegroups.com> <1c057a5d-0d1a-4219-b2a0-d056c88ffff9@googlegroups.com> <e3c1b85d-c7b2-4e2e-95cf-a5b68c0b3447@googlegroups.com> <99fec2a3-294e-4374-abc1-ffffece3c781@googlegroups.com> <5ad9f3ff-6c45-4d8a-b7e0-d5bf1ebdac97@googlegroups.com>
Reply-to: cake-php@xxxxxxxxxxxxxxxx
Sender: cake-php@xxxxxxxxxxxxxxxx
Después de correr más pruebas, aquí otro *confusor:

*NullParent *hasMany *NullChild

$esto->*NullParent->*saveAssociated([
           '*NullParent' => ['nombre' => '*wee'],
           '*NullChild' => [
               ['nombre' => '*wee'],
               ['nombre' => '*doo']
     ]
]);

depura($resultados) de **beforeSave *cosechas:

variedad(
'*NullParent' => variedad(
'nombre' => '*wee'
),
'*NullChild' => variedad(
(*int) 0 => variedad(
'*NullChild' => variedad(
'nombre' => '*wee'
)
),
(*int) 1 => variedad(
'*NullChild' => variedad(
'nombre' => '*doo'
)
)
)
)

Por qué lo es *AssocModel.#unknown{^*n}.*AssocModel.*id Formato aquí? Es justo un sencillo, 
no-profundo, *hasMany asoció salva.

Sé estoy mezclando *beforeSave con *afterFind ahora, pero es realmente confundiendo. 
He sido utilizando pastel para muchos años ahora y siento realmente frustró no 
siendo capaz de coger estas convenciones con respecto a Modelos=>*callbacks=>formatos 
de variedad. Hace escribir modelos gordos un dolor real.

-- 
Gustarnos en *FaceBook *https://www.facebook.com/*CakePHP
nos Encuentra en *Twitter *http://*twitter.*com/*CakePHP

--- 
Recibiste este mensaje porque eres *subscribed al *Google Grupos "*CakePHP" grupo.
A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un *email a pastel-*php+unsubscribe@xxxxxxxxxxxxxxxx.
A correo a este grupo, envía *email a pastel-php@xxxxxxxxxxxxxxxx.
Visita este grupo en *http://grupos.*google.*com/Pastel/de grupo-*php.
Para más opciones, visita *https://grupos.*google.*com/Los Grupos/optan_fuera.


After running more tests, here's another confusor:

NullParent hasMany NullChild

$this->NullParent->saveAssociated([
           'NullParent' => ['name' => 'wee'],
           'NullChild' => [
               ['name' => 'wee'],
               ['name' => 'doo']
     ]
]);

debug($results) from *beforeSave *yields:

array(
'NullParent' => array(
'name' => 'wee'
),
'NullChild' => array(
(int) 0 => array(
'NullChild' => array(
'name' => 'wee'
)
),
(int) 1 => array(
'NullChild' => array(
'name' => 'doo'
)
)
)
)

Why is it AssocModel.{n}.AssocModel.id format here? It's just a simple, 
non-deep, hasMany associated save.

I know I'm mixing beforeSave with afterFind now, but it's really confusing. 
I've been using cake for many years now and I feel really frustrated not 
being able to grasp these conventions regarding Models=>callbacks=>array 
formats. It makes writing fat models a real pain.

-- 
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>