Your example used only hasOne associacion, but I want to have also back associacion belongsTo I just noticed that in bakers <-> brands example brands were not grabbed in index() controller method, and thats because lack of belongsTo i guess. hasOne (which prints out associaced brand when I view single records) works for me too, but problem persists when I try to have bakers and their brands in findAll() something like array( [0] => array([Baker] => array(), [Brand] => array()), [1] => array([Baker] => array(), [Brand] => array()), [2] => array([Baker] => array(), [Brand] => array()) )
can you try to recreate this ?? without other models just bakers in one db, and brands in the other db I'm always using newest version from svn On 12 Gru, 11:26, grigri <[EMAIL PROTECTED]> wrote: > Sounds like a version issue to me, I remember a while ago queries were > merged to use IN(...) rather than multiple separate ones. > > I'm using the bleeding edge, I'm not sure what revision my playground > was when I ran the tests (updated it this morning) but it was > definitely after the pre-beta release. > > Check trac for the correct revision and update your version, and you > shouldn't have this issue. > > On Dec 12, 10:16 am, Zwift <[EMAIL PROTECTED]> wrote: > > > Thanks. > > After more investigation I found out that bake didn't add uses > > LocalNumber to LocalAccounts Controller > > However after I added this > > It displays LocalAccounts for each existing LocalNumber... > > Example > > I have LocalNumbers 10001, 10002, 10003, 10004 > > and only one LocalAccount with assigned number 10003 > > > But it displays all of them (there is a SELECT query for each existing > > LocalNumber), it looks more or less like this > > id | user_id | localNumber > > | | 10001 > > | | 10002 > > 1 | 1 | 10003 //this record exists > > | | 10004 > > > and this is done only when using associacion between two databases > > (there is no problem in when both tables are in one because of JOIN I > > guess) > > can I prevent cake for doing this somehow ?? > > > On 11 Gru, 14:54, grigri <[EMAIL PROTECTED]> wrote: > > > > I just copied a model across from another project and added the > > > dbconfig to the config file under a different key. > > > > Code + SQL here :http://openpaste.org/en/4255/ > > > > (I always have a 'playground' cake app setup on my local machine for > > > various testing and experimentation) > > > > On Dec 11, 1:38 pm, Zwift <[EMAIL PROTECTED]> wrote: > > > > > Can you paste here your SQL Dumb, and models code > > > > > I just don't understand whats going on here? > > > > > Or did you used my above example?? > > > > > Hell... > > > > Darkness... > > > > > On 11 Gru, 14:11, grigri <[EMAIL PROTECTED]> wrote: > > > > > > I just ran a quick test (I've never actually needed to have more than > > > > > one db config for the same app so far) and it works fine, even without > > > > > the external bit. > > > > > > It seems completely transparent, and it's only seeing the sql logs > > > > > that you realise it does a separate query, not a join, for the > > > > > external association. > > > > > > On Dec 11, 12:35 pm, Zwift <[EMAIL PROTECTED]> wrote: > > > > > > > After some researching I just need to know - is it even possible??? > > > > > > Many people (on IRC) says: yes, sure > > > > > > But hell I cannot make it work even with simples User <-> Profile > > > > > > associacion (from tempdocs) > > > > > > > On 11 Gru, 11:56, Zwift <[EMAIL PROTECTED]> wrote: > > > > > > > > I think > > > > > > > nothttp://api.cakephp.org/1.2/libs_2model_2model_8php-source.html(from > > > > > > > line 260) > > > > > > > > On 11 Gru, 11:44, grigri <[EMAIL PROTECTED]> wrote: > > > > > > > > > If your models are using different datasources you have to set > > > > > > > > the > > > > > > > > 'external' attribute in the association (I think). > > > > > > > > > On Dec 11, 9:28 am, Zwift <[EMAIL PROTECTED]> wrote: > > > > > > > > > > 2 Models > > > > > > > > > FIRST: > > > > > > > > > > class LocalNumber extends AppModel { > > > > > > > > > var $useDbConfig = 'prepaid'; > > > > > > > > > var $useTable = 'cards'; > > > > > > > > > var $primaryKey = 'number'; > > > > > > > > > var $displayField = 'number'; > > > > > > > > > var $name = 'LocalNumber'; > > > > > > > > > var $recursive = 2; > > > > > > > > > > var $hasOne = array( > > > > > > > > > 'LocalAccount' => array( > > > > > > > > > 'ClassName' => 'LocalAccount', > > > > > > > > > 'foreignKey' => 'local_number_id' > > > > > > > > > ) > > > > > > > > > ); > > > > > > > > > > } > > > > > > > > > > SECOND: > > > > > > > > > class LocalAccount extends AppModel { > > > > > > > > > > var $name = 'LocalAccount'; > > > > > > > > > > var $belongsTo = array( > > > > > > > > > 'LocalNumber' => array('className' => > > > > > > > > > 'LocalNumber', > > > > > > > > > 'foreignKey' => > > > > > > > > > 'local_number_id') > > > > > > > > > ); > > > > > > > > > > } > > > > > > > > > > And I have no idea why its not working - LocalNumber just > > > > > > > > > doesn't > > > > > > > > > appear in view (view and controller were baked). > > > > > > > > > Any ideas? Maybe I did something wrong?? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
