Re: Model Associations - just feels wrong

2010-03-19 Thread Antônio Marco
Hi, TheKerk, morning!

Can you post the models association's code here?

Thanks.

On 17 mar, 23:41, TheHerk  wrote:
> Here is a link to a screenshot of a class diagram I am working on,
> with noted model associations. There are several relationships in the
> diagram that feel wrong to me. The one in the diagram that illustrates
> this is between ZipLocation and State. In this case, state is
> enumerated in its own table. For some reason, to me, it seems strange
> that  ZipLocation, the parent, is belongsTo. I keep thinking in my
> head, “Each ZipLocation has one associated State,” but it doesn't seem
> to work that way. There are several more instances of this dilemma,
> but they are just the same.
>
> http://i8.photobucket.com/albums/a24/atomickeg/public/classes.png
>
> Does this look remotely correct?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Scaffolding with data in different PostgreSQL schemas

2009-08-12 Thread Antônio Marco

Hi, folks!

I'm having a problem with Scaffolding with data in different
PostgreSQL schemas.

There are 2 different PostgreSQL schemas with related tables:

- dme
- habitacao

Some habitation's tables has foreign key to dme's tables.

There are 2 different Cake application each one with your own models
but also related:

- dme
- habitacao

The problem occurs in the habitacao's INDEX action with does not print
the displayField of the dme's related models.

Make I myself clear?

Any help will be wellcome.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form with saving of true/false/null

2009-08-01 Thread Antônio Marco

I would use delocalizer's idea just changing the $optarray to:

('0' => 'No', '1' => 'Yes', 'null' => 'No info')

Good look.

On Jul 31, 7:33 am, delocalizer  wrote:
> As for the coding, just use the form helper's automagic radio input:
> eg
> input('fieldname',array('type'=>'radio','options'=>
> $optarray)); ?>
> $optarray is the array of options, eg. array
> ('0'=>'No','1'=>'Yes','2'=>'No info') for the example you give.
>
> On Jul 31, 8:29 pm, delocalizer  wrote:
>
> > The other way you can approach clearing radio input groups is to add
> > some little button or widget next to each group with a javascript
> > onClick function that sets the values to empty. At least that's what I
> > do. It looks prettier & and a bit more logical than an extra radio
> > option.
>
> > cheers,
> > Conrad.
>
> > On Jul 31, 4:13 pm, Kanten  wrote:
>
> > > I have been giving this some thought and I do get what you mean, but
> > > it is very important that the user can always change e.g. an "yes"
> > > answer into "not info on subject". Database wise I think you are
> > > right, that I should define three different values (no = 0, yes = 1,
> > > no info = 2) instead of using no info = Null.
>
> > > Thank you very much for your help.
>
> > > /Anders
>
> > > On Jul 30, 9:41 am, delocalizer  wrote:
>
> > > > You sure you want an explicit third option 'no information on the
> > > > subject'? Wouldn't it be better to just have a radio group with 2
> > > > buttons (Yes/No or True/False) with a default value of NULL for that
> > > > field in your database? Or if you really want to have a third option
> > > > to force a user to enter something, mapping to a value other than
> > > > empty string or 'null' might be wise, as depending on how your db
> > > > field is defined, these may not be distinguishable from 'no data
> > > > entered'. The 'right' solution really depends on the particular logic
> > > > of your application - what data your users should enter and how that
> > > > data will be used and analysed once it's in the database.
>
> > > > On Jul 30, 12:40 am, "rich...@home"  wrote:
>
> > > > > I'd use a drop down select instead of an option group.
>
> > > > > This should do the trick:
>
> > > > > input("Model.field", array("options"=>array(""=>"No
> > > > > information on subject", true=>"True", false=>"False))); ?>
>
> > > > > On Jul 29, 12:29 pm, Kanten  wrote:
>
> > > > > > Is there really noone, that can help me with this one?
>
> > > > > > Thanks
> > > > > > Anders
>
> > > > > > On Jul 10, 1:49 pm, Kanten  wrote:
>
> > > > > > > Hi,
>
> > > > > > > I am making a database for research and for this project I have a 
> > > > > > > lot
> > > > > > > of dichotomous (binary) variables where I need to be able to
> > > > > > > discrimate between true, false and "no information on
> > > > > > > subject" (=null). I would like to store it as a bool field in 
> > > > > > > MySQL.
> > > > > > > User interface wise I was thinking of using radio buttons with the
> > > > > > > option of choosing between the three posibilities.
>
> > > > > > > Is there some easy way of doing this using the builtin form 
> > > > > > > helper, or
> > > > > > > do I need to to modify it somehow?
>
> > > > > > > Thanks
> > > > > > > Anders
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Changing field type in scaffold form

2009-07-24 Thread Antônio Marco

Hi, folks!

FACTS:

[1] I'm using scaffolding;
[2] I have a table wich contains a INT2 column named LEVEL. This
column accepts only values IN (0, 1, 2, 3, 4, 5, 6);
[3] When the scaffold form is shown, the LEVEL field is a simple *
TEXT type * field.

My question is:

Would be possible to change a * TEXT type * field to a * SELECT type *
field by manipulating the $this->viewVars OR setting up something in
the related model OR something else?

Notice that I do not want manually create a form.

Any help will be welcome.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



An external URL pointing to the application

2009-04-02 Thread Antônio Marco

Hi folks, morning (here in Brazil)!

I'm developing an application wich sends an e-mail to a claimant. This
e-mail contains a complete URL that points to an action wich validates
the claimant's e-mail account.

The problem is I have two development environments: test (my CPU) and
production (the HTTP server).

So, how to send the correct ***domain*** in the URL, automaticaly?

CakePHP controllers has both $base and $here properties "relative to
the webroot of the application", but these properties don't solve my
problem.

Thanks for any help.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM and findAll

2009-03-12 Thread Antônio Marco

Hi!

I have an app with a few models; Claimant, Professional and
ApprovalRequisition among them.

Some of most important associations are:

- Claimant hasMany ApprovalRequisitions;
- Professional hasAndBelongsToMany ApprovalRequisition; and,
- ApprovalRequisition hasAndBelongsToMany Professional.

Starting from the ApprovalRequisition model, I need to retrieve all
Claimant's ApprovalRequisitions. Until now, no problem.

I'm using the code:

$claimant_approval_requisitions = $this->ApprovalRequisition->find(
'all',
array(
'conditions' => array(
'ApprovalRequisition.claimant_id' => $claimant_id
)
)
);

debug($claimant_approval_requisitions) shows:

Array(
[0] => Array(
[ApprovalRequisition] => Array(
[id] => 1
[created] => 2009-03-11 11:27:35
[modified] => 2009-03-11 11:27:35
[claimant_id] => 1
)

[Claimant] => Array(
[id] => 1
[created] => 2009-02-17 16:55:30
[modified] => 2009-02-17 16:55:30
)

[Professional] => Array(
[0] => Array(
[id] => 2
[created] => 2009-03-12 09:37:38
[modified] => 2009-03-12 09:37:38
[ApprovalRequisitionsProfessional] => Array(
[id] => 3
[created] => 2009-03-12 09:40:46
[modified] => 2009-03-12 09:40:46
[requisition_id] => 1
[professional_id] => 2
)
)

[1] => Array(
[id] => 1
[created] => 2009-02-17 16:55:30
[modified] => 2009-03-04 10:08:37
[ApprovalRequisitionsProfessional] => Array(
[id] => 1
[created] => 2009-03-11 11:27:35
[modified] => 2009-03-11 11:27:35
[requisition_id] => 1
[professional_id] => 1
)
)
)
)

[1] => Array(
[ApprovalRequisition] => Array(
[id] => 2
[created] => 2009-03-12 11:26:01
[modified] => 2009-03-12 11:26:01
[claimant_id] => 1
)

[Claimant] => Array(
[id] => 1
[created] => 2009-02-17 16:55:30
[modified] => 2009-02-17 16:55:30
)

[Professional] => Array(
[0] => Array(
[id] => 1
[created] => 2009-02-17 16:55:30
[modified] => 2009-03-04 10:08:37
[ApprovalRequisitionsProfessional] => Array(
[id] => 4
[created] => 2009-03-12 11:26:01
[modified] => 2009-03-12 11:26:01
[requisition_id] => 2
[professional_id] => 1
)
)
)
)
)

My problem is retrieving all Professional's ApprovalRequisitions...

Basically, I wish to retrieve *ONLY* ApprovalRequisitions that belongs
to a given Professional. Simple like that.

Yes, I know that would be much more simple starting from the
Professional model to obtain all yours ApprovalRequisitions.

Can someone help me?

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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How should I associate these tables?

2008-12-04 Thread Antônio Marco

No, I can't move all my tables to same schema.

But thanks anyway.

On 25 nov, 13:35, teknoid <[EMAIL PROTECTED]> wrote:
> I assume in that case you'll need to create a model for your join
> table (which is otherwise created for you)...
> and specify which schema (db) it uses.
> Otherwise, if you can, move them all to the same schema.
>
> On Nov 25, 7:55 am, Antônio Marco <[EMAIL PROTECTED]> wrote:
>
> > Thanks, teknoid!
>
> > But now I'm having a new problem... My applications uses tables
> > separated in different schemas.Thesetables are related one each
> > other as shown above.
>
> > I'm trying the HBTM association between "geo.plots" and
> > "dme.addresses" tables. I created the "geo.addresses_plots" table but
> > when I run my application I receives the message bellow:
>
> > Warning (2): pg_query() [function.pg-query]: Query failed: ERRO:
> > relation "addresses_plots" do not exists [CORE.rc2/libs/model/
> > datasources/dbo/dbo_postgres.php, line 152]
>
> > Can you help me once more?
>
> > I hope so.
>
> > On 24 nov, 18:50, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > This is a basic HABTM (hasAndBelongsToMany) relationship.
> > > Read up on it in the manual... you should also rename the join table
> > > (if you'd like to keep consistent with conventions).
>
> > > On Nov 24, 2:40 pm, Antônio Marco <[EMAIL PROTECTED]> wrote:
>
> > > > Hi folks!
>
> > > > I created 3 tables as shown bellow:
>
> > > > CREATE TABLE geo.plots
> > > > (
> > > >   id  serial   NOT NULL,
> > > >   created timestamp,
> > > >   modifiedtimestamp,
>
> > > >   the_geomvarchar(255),
>
> > > >   inscricao_imobiliaria   varchar(14) NOT NULL,
>
> > > >   quadra  varchar(10),
> > > >   lotesmallint,
>
> > > >   numero_residencial_previo   smallint,
>
> > > >   PRIMARY KEY (id)
> > > > )
> > > > WITH OIDS;
>
> > > > CREATE TABLE geo.plot_addresses
> > > > (
> > > >   id  serial   NOT NULL,
> > > >   created timestamp,
> > > >   modifiedtimestamp,
>
> > > >   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
> > > > (
> > > >   idserial   NOT NULL,
> > > >   created   timestamp,
> > > >   modified  timestamp,
>
> > > >   habilitadobool NOT NULL DEFAULT true,
>
> > > >   street_postal_code_id int  NOT NULL,
> > > >   parent_id int,
>
> > > >   complemento   bool NOT NULL DEFAULT false,
>
> > > >   numerosmallint,
>
> > > >   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'
&

Re: How should I associate these tables?

2008-11-27 Thread Antônio Marco

No, I don't move all my tables to same schema.

But thanks anyway.

On 25 nov, 13:35, teknoid <[EMAIL PROTECTED]> wrote:
> I assume in that case you'll need to create a model for your join
> table (which is otherwise created for you)...
> and specify which schema (db) it uses.
> Otherwise, if you can, move them all to the same schema.
>
> On Nov 25, 7:55 am, Antônio Marco <[EMAIL PROTECTED]> wrote:
>
> > Thanks, teknoid!
>
> > But now I'm having a new problem... My applications uses tables
> > separated indifferentschemas. These tables are related one each
> > other as shown above.
>
> > I'm trying the HBTM association between "geo.plots" and
> > "dme.addresses" tables. I created the "geo.addresses_plots" table but
> > when I run my application I receives the message bellow:
>
> > Warning (2): pg_query() [function.pg-query]: Query failed: ERRO:
> > relation "addresses_plots" do not exists [CORE.rc2/libs/model/
> > datasources/dbo/dbo_postgres.php, line 152]
>
> > Can you help me once more?
>
> > I hope so.
>
> > On 24 nov, 18:50, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > This is a basic HABTM (hasAndBelongsToMany) relationship.
> > > Read up on it in the manual... you should also rename the join table
> > > (if you'd like to keep consistent with conventions).
>
> > > On Nov 24, 2:40 pm, Antônio Marco <[EMAIL PROTECTED]> wrote:
>
> > > > Hi folks!
>
> > > > I created 3 tables as shown bellow:
>
> > > > CREATE TABLE geo.plots
> > > > (
> > > >   id  serial   NOT NULL,
> > > >   created timestamp,
> > > >   modifiedtimestamp,
>
> > > >   the_geomvarchar(255),
>
> > > >   inscricao_imobiliaria   varchar(14) NOT NULL,
>
> > > >   quadra  varchar(10),
> > > >   lotesmallint,
>
> > > >   numero_residencial_previo   smallint,
>
> > > >   PRIMARY KEY (id)
> > > > )
> > > > WITH OIDS;
>
> > > > CREATE TABLE geo.plot_addresses
> > > > (
> > > >   id  serial   NOT NULL,
> > > >   created timestamp,
> > > >   modifiedtimestamp,
>
> > > >   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
> > > > (
> > > >   idserial   NOT NULL,
> > > >   created   timestamp,
> > > >   modified  timestamp,
>
> > > >   habilitadobool NOT NULL DEFAULT true,
>
> > > >   street_postal_code_id int  NOT NULL,
> > > >   parent_id int,
>
> > > >   complemento   bool NOT NULL DEFAULT false,
>
> > > >   numerosmallint,
>
> > > >   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'
&

Re: How should I associate these tables?

2008-11-25 Thread Antônio Marco

Thanks, teknoid!

But now I'm having a new problem... My applications uses tables
separated in different schemas. These tables are related one each
other as shown above.

I'm trying the HBTM association between "geo.plots" and
"dme.addresses" tables. I created the "geo.addresses_plots" table but
when I run my application I receives the message bellow:

Warning (2): pg_query() [function.pg-query]: Query failed: ERRO:
relation "addresses_plots" do not exists [CORE.rc2/libs/model/
datasources/dbo/dbo_postgres.php, line 152]

Can you help me once more?

I hope so.

On 24 nov, 18:50, teknoid <[EMAIL PROTECTED]> wrote:
> This is a basic HABTM (hasAndBelongsToMany) relationship.
> Read up on it in the manual... you should also rename the join table
> (if you'd like to keep consistent with conventions).
>
> On Nov 24, 2:40 pm, Antônio Marco <[EMAIL PROTECTED]> wrote:
>
> > Hi folks!
>
> > I created 3 tables as shown bellow:
>
> > CREATE TABLE geo.plots
> > (
> >   id  serial   NOT NULL,
> >   created timestamp,
> >   modifiedtimestamp,
>
> >   the_geomvarchar(255),
>
> >   inscricao_imobiliaria   varchar(14) NOT NULL,
>
> >   quadra  varchar(10),
> >   lotesmallint,
>
> >   numero_residencial_previo   smallint,
>
> >   PRIMARY KEY (id)
> > )
> > WITH OIDS;
>
> > CREATE TABLE geo.plot_addresses
> > (
> >   id  serial   NOT NULL,
> >   created timestamp,
> >   modifiedtimestamp,
>
> >   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
> > (
> >   idserial   NOT NULL,
> >   created   timestamp,
> >   modified  timestamp,
>
> >   habilitadobool NOT NULL DEFAULT true,
>
> >   street_postal_code_id int  NOT NULL,
> >   parent_id int,
>
> >   complemento   bool NOT NULL DEFAULT false,
>
> >   numerosmallint,
>
> >   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
-~--~~~~--~~--~--~---



How should I associate these tables?

2008-11-24 Thread Antônio Marco

Hi folks!

I created 3 tables as shown bellow:

CREATE TABLE geo.plots
(
  id  serial   NOT NULL,
  created timestamp,
  modifiedtimestamp,

  the_geomvarchar(255),

  inscricao_imobiliaria   varchar(14) NOT NULL,

  quadra  varchar(10),
  lotesmallint,

  numero_residencial_previo   smallint,

  PRIMARY KEY (id)
)
WITH OIDS;

CREATE TABLE geo.plot_addresses
(
  id  serial   NOT NULL,
  created timestamp,
  modifiedtimestamp,

  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
(
  idserial   NOT NULL,
  created   timestamp,
  modified  timestamp,

  habilitadobool NOT NULL DEFAULT true,

  street_postal_code_id int  NOT NULL,
  parent_id int,

  complemento   bool NOT NULL DEFAULT false,

  numerosmallint,

  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
-~--~~~~--~~--~--~---



Reserved words

2008-10-10 Thread Antônio Marco

Hi, there!

Is "Plot" a CakePHP reserved word?

I'm receiving the message below:

Notice (8): Undefined index:  Plot [CORE/libs/view/scaffolds/
index.ctp, line 56]

When I change the "Plot" to another one the message goes out.

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
-~--~~~~--~~--~--~---