cake-php
[Arriba] [Todas las Listas]

Re: counterCache - CakePHP 2.0

To: cake-php@xxxxxxxxxxxxxxxx
Subject: Re: counterCache - CakePHP 2.0
From: wizkid <244863@xxxxxxxxx>
Date: Wed, 5 Jun 2013 04:10:06 -0700 (PDT)
Delivery-date: Wed, 05 Jun 2013 07:10:20 -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=VpxV98biDuhL6K9U8OHupEEka8RJvhgxLp/mgi+quZQ=; b=pYYeRcJAzU7pP/YCXEnb7bcpDTdOr9vqe9IO+3JmwsyUOGd4hQ1FL2zZwLaPYoPJ25 0qcJoEZ4yVZl4j9WVm9IKLU17Dtm2vkUsXxG/2NOTrHl0JtRgcEIvoHfurTVla6XfJ3a dYA/tEKyq7t8HK/9iSPXxmhvdPScEWlhfAUgwQfO8xi+tx0NF5CyfpIBUCsxYx+Td3Vt SJZ7uZMjoGyTos79Vms5mvPsradGPNXDVPTR9G19PPPmwV1sFnvV9IM8sT0Sz4Ei3O1r Ztio1uQWUc5JCHNW6oQx7VGNJgJopVspxNgNQjOL3Z16OJkSMepzxTjMsUeVFUHZjowT RT3Q==
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=VpxV98biDuhL6K9U8OHupEEka8RJvhgxLp/mgi+quZQ=; b=hQbc/WajsCBlAQ7+KNzc8NvZFeyv/5K3tHc4/PQxFga3XKCAZz9DlHJfQIZJE5NPVk vw4CUpuh1zAdMsrTrRUGeRZ43uAXKVZlhT9PpSIa9uX/qjr4UcSqgpScW1lWUo8s0Uhh 7U1DP3o7zjycGEESuujy78JU3PLhae3fVqzQyNzusdso55xwfwvUhp5pBinjLRse5HnL y+LrruelqT+NWaZmrp6xTUsTl7YK8FWz8nGOvxKOSCQl6b+TDo/vJDCY+Ieyt1xq8XI1 RmDyZgkwcYL4ou3WmCfAtIFSjJg3eIZYobjK0tQUnN95s6HQFrXi0UKt26Hei7hqjVig B1wg==
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <07feb29d-c42f-45bf-bbc6-3a0d155f7d06@googlegroups.com>
List-archive: <http://groups.google.com/group/cake-php?hl=en>
List-help: <http://groups.google.com/support/?hl=en>, <mailto:cake-php+help@googlegroups.com>
List-id: <cake-php.googlegroups.com>
List-post: <http://groups.google.com/group/cake-php/post?hl=en>, <mailto:cake-php@googlegroups.com>
List-subscribe: <http://groups.google.com/group/cake-php/subscribe?hl=en>, <mailto:cake-php+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/cake-php/subscribe?hl=en>, <mailto:googlegroups-manage+1003367825667+unsubscribe@googlegroups.com>
Mailing-list: list cake-php@xxxxxxxxxxxxxxxx; contact cake-php+owners@xxxxxxxxxxxxxxxx
References: <07feb29d-c42f-45bf-bbc6-3a0d155f7d06@googlegroups.com>
Reply-to: cake-php@xxxxxxxxxxxxxxxx
Sender: cake-php@xxxxxxxxxxxxxxxx

*app/*lib/Modelo/de Modelo/del pastel.*php Línea 1963

envolví el *updateAll función con:

si (!Vacío($llaves[$*foreignKey]))

#verbcj un tratar.


En martes, junio 4, 2013 4:45:42 PM *UTC+1, *wizkid escribió:
>
> #### Qué Añadí un *cacheCounter a un $*belongsTo relación donde el DB aceptará *NULL para la llave_extranjera
>
> Por ejemplo: Direcciones *haveMany Usuarios, pero unos usuarios no tiene que tener 
> una dirección.
>
> #### Qué pasado
>
> Cuándo fui para eliminar el Usuario conseguía el siguiendo error:
>
> ACTUALIZA [direcciones] PONE [el usuario_cuenta] = 0 DÓNDE [*id] ES *N''
>
> está intentando actualizar el *cacheCounter cuándo la relación no existe.
>
>
> #### Qué esperé pasar
>
> Cuándo creo el Usuario ($esto->Usuario->salvar) con una dirección_*id de *NULL, o incluso 
> editar el Usuario ($esto->Usuario->salvar) no consigo el error??
>
> Es allí algo puedo poner al *counterScope para parar esto de pasar?? 
> 
>
>

-- 
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?*hl=*en.
Para más opciones, visita *https://grupos.*google.*com/Los Grupos/optan_fuera.



app/lib/Cake/Model/Model.php Line 1963

I wrapped the updateAll function with:

if (!empty($keys[$foreignKey])) {

Works a treat.


On Tuesday, June 4, 2013 4:45:42 PM UTC+1, wizkid wrote:
>
> #### What I did
>
>
> Added a cacheCounter onto a $belongsTo relationship where the DB will 
> accept NULL for the foreign_key
>
> For Example: Addresses haveMany Users, but a users does not have to have 
> an address.
>
> #### What happened
>
> When I went to delete the User I got the following error:
>
> UPDATE [addresses] SET [user_count] = 0 WHERE [id] IS N''
>
> It is trying to update the cacheCounter when the relationship does not 
> exist.
>
>
> #### What I expected to happen
>
> When I create the User ($this->User->save) with an address_id of NULL, or 
> even edit the User ($this->User->save) I do not get the error??
>
> Is there something I can put into the counterScope to stop this from 
> happening??
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


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