Hi folks! I created 3 tables as shown bellow:
CREATE TABLE geo.plots ( id serial NOT NULL, created timestamp, modified timestamp, the_geom varchar(255), inscricao_imobiliaria varchar(14) NOT NULL, quadra varchar(10), lote smallint, numero_residencial_previo smallint, PRIMARY KEY (id) ) WITH OIDS; CREATE TABLE geo.plot_addresses ( id serial NOT NULL, created timestamp, modified timestamp, plot_id int NOT NULL, address_id int NOT NULL, endereco_principal bool NOT NULL DEFAULT true, PRIMARY KEY (id), FOREIGN KEY (plot_id) REFERENCES geo.plots (id), FOREIGN KEY (address_id) REFERENCES dme.addresses (id) ) WITH OIDS; CREATE TABLE dme.addresses ( id serial NOT NULL, created timestamp, modified timestamp, habilitado bool NOT NULL DEFAULT true, street_postal_code_id int NOT NULL, parent_id int, complemento bool NOT NULL DEFAULT false, numero smallint, bloco varchar(10), andar smallint, unidade smallint, posicao smallint, caixa_postal smallint, complemento_livre varchar(255), PRIMARY KEY (id), FOREIGN KEY (street_postal_code_id) REFERENCES dme.street_postal_codes (id), FOREIGN KEY (parent_id) REFERENCES dme.addresses (id) ) WITH OIDS; They are associated as shown bellow: // class Plot extends AppModel { var $name = 'Plot'; var $useDbConfig = 'geo'; var $hasMany = array( 'PlotAddresses' => array( 'className' => 'PlotAddress', 'foreignKey' => 'plot_id' ) ); } // class PlotAddress extends AppModel { var $name = 'PlotAddress'; var $useDbConfig = 'geo'; var $belongsTo = array( 'Plot' => array( 'className' => 'Plot', 'foreignKey' => 'plot_id' ), 'Address' => array( 'className' => 'Address', 'foreignKey' => 'address_id' ) ); } // class Address extends AppModel { var $name = 'Address'; var $useDbConfig = 'dme'; var $hasOne = array( 'PlotAddress' => array( 'className' => 'PlotAddress', 'foreignKey' => 'address_id' ) ); } I have used Scaffolding in this application but when I run the index of PlotAddresses, I receive the message bellow: Notice (8): Undefined index: Address [CORE.rc2/libs/view/scaffolds/ index.ctp, line 81] Verifing the line, I saw that the problem is related to "belongTo" association. Can anybody help me to solve this problem? Is my association incorrect? Thanks a lot. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---