Hello people.
I was wondering about this piece of code:
$aux = $this->PessoaFisica->find("PessoaFisica.cpf =
'{$this->data['Form']['cpf']}'", array('cpf'), null, 0);
pr($aux);
which outputs this:
Array
(
[PessoaFisica] => Array
(
[cpf] => 123
)
)
Fine, but my point is the SQL executed behind the scenes:
SELECT `PessoaFisica`.`cpf`
FROM `cli_pessoafisica` AS `PessoaFisica`
LEFT JOIN `cli_pessoa` AS `Pessoa` ON `PessoaFisica`.`id` =
`Pessoa`.`id`
LEFT JOIN `cli_curriculo` AS `Curriculo` ON `Curriculo`.`id` =
`PessoaFisica`.`id`
WHERE cpf like '123' LIMIT 1
I can see two "left join" unnecessary here (i know this is because
$hasMany, $hasOne, $blahblah). So, i think this two "left join" should
not be generated by Cake because in Find() I have put (0) value ( the
param $recursive = null of find() function).
I guess this will hurt performance with a table with large amout of
data, or with more and more complex $hasMany, $hasOne structures in
Models.
And continuing, if I remove the field i desire:
$aux = $this->PessoaFisica->find("PessoaFisica.cpf =
'{$this->data['Form']['cpf']}'", null, null, 0); (but now with $fields
parameter null)
i have a different result:
Array
(
[PessoaFisica] => Array
(
[id] => 1
{...}
)
[Pessoa] => Array
(
[id] => 1
{...}
)
[Curriculo] => Array
(
[id] => 1
{...}
)
)
I put 0(zero) in $recursive parameter, so in this case i really
*don't* want ALL this amout of data.
Could somebody enlighten me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---