Hi,

I'm not one to post questions, I usually google and roll my own, but
I'm stumped on something. I have part of a website that was done in
CakePHP which has to integrate with others bits, and while there are
several issues with the way things were done, we have to do what we
know in order to deliver more and better information to our company.
I had a bit of time avaiable and wanted to migrate it from 1.1 to 1.2,
so that I can take better advantage of added core functionality and
bakery modules.

So, I have Faults (AvariasManutencao) which, among others things that
are working well, are connected to two groups of users (which couldn't
be normalized to a single join table in 1.1. Doesn't really matter.).
Those users come from Drupal on another 'mysql database' (which are
really schemas, not databases), so I wrote a custom query with the dot
notation to access the other database. Cake properly runs my query,
but then does nothing with the values! They are not returned along
with all the other information. This worked in 1.1, but is not working
in 1.2. Oddly, saving actually still works with the default query...

I've simplified here and included only one group of users.

var $hasAndBelongsToMany = array('AgentesConcluida' =>
                               array('className'    => 'Utilizador',
                                     'joinTable'    =>
'agentes_concluida_avarias_manutencao',
                                     'foreignKey'   =>
'avaria_manutencao_id',
                                     'associationForeignKey'=> 'uid',
                                     'order'        =>
'AgentesConcluida.display ASC',
                                     'unique'       =>
true,
                                     'finderQuery'  => 'SELECT
`AgentesConcluida`.* FROM drupaldb.`users` AS `AgentesConcluida` JOIN
bd_avarias.`agentes_concluida_avarias_manutencao` AS
`AgentesConcluidaAvariasManutencao` ON
(`AgentesConcluidaAvariasManutencao`.`avaria_manutencao_id` =
{$__cakeID__$} AND `AgentesConcluidaAvariasManutencao`.`uid` =
`AgentesConcluida`.`uid`) '
                               ));

pr($this->find('first',array(
                    'conditions'=>"AvariaManutencao.numero=$numero AND
AvariaManutencao.serie_id=$serie_id AND AvariaManutencao.local_id=
$manutencao",
                   'order'=>"AvariaManutencao.numero ASC",
                   'recursive'=>4)));

gives (and yes, there are values for that id in the join table):

Array
(
    [AvariaManutencao] => Array
        (
            [id] => 3618
            [local_id] => 3
            [numero] => 931
               ...
       )
    [AgentesConcluida] => Array
        (
        )
)

but it does run (because it appears in the query list in the debug
text):
        SELECT `AgentesConcluida`.* FROM drupaldb.`users` AS
`AgentesConcluida` JOIN
bd_avarias.`agentes_concluida_avarias_manutencao` AS
`AgentesConcluidaAvariasManutencao` ON
(`AgentesConcluidaAvariasManutencao`.`avaria_manutencao_id` = 3618 AND
`AgentesConcluidaAvariasManutencao`.`uid` = `AgentesConcluida`.`uid`)

which returns the proper values in phpMyAdmin.

I'm pretty stumped and about to hack it pretty badly, so please stop
me from making this application anymore complicated.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to