Re: Newbie questions regarding views files and layout

2010-06-27 Thread cricket
On Sun, Jun 27, 2010 at 3:08 PM, jimbo jamesam...@gmail.com wrote:
 I have been looking through the documentation and tutorials regarding
 changing the default layout. When the home page is loaded it states
 To change its layout, edit: C:\CakePHP\uniform\UniServer\www
 \project1\views\layouts\default.ctp however, the other articles that
 I have read state that creating a default.thml file will override the
 default style. When I try to create a default.thml in \views\layouts\
 the page does not render the new layout. When I alter the default.ctp
 file it does. It seems (at least from what I have read) that both .ctp
 and .thml are views files. Can someone explain the difference between
 them and maybe suggest what I might be doing wrong?  Thank you in
 advance.

.thml is an old extension. Cake uses .ctp now.

Always look for a date on any articles about Cake that you find
online. There have been a lot of changes. Articles that reference the
.html extension are probably way out of date.

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


Re: Newbie questions about model relations

2008-10-19 Thread teknoid

Where is the model association between Design and Status and vice
versa?
Your models need to know how they relate to each other.
Please review the manual as it quite clearly describes all of the
that.



On Oct 18, 12:06 pm, Marritza [EMAIL PROTECTED] wrote:
 Ok, let me clarify finally. (Never used newsgroups before so pardon lack of
 complete information :P )

 class Design extends AppModel {

         var $primaryKey = 'designs_id';
         var $useTable = 'design';

 }

 class Status extends AppModel {

         var $primaryKey = 'status_id';
         var $useTable = 'status';

 }

 I'm not using foreign keys. The db schema has been posted in the first
 message.



 teknoid-3 wrote:

  If you cannot alter db structure, that's fine. Cake works perfectly
  well with legacy DB's, but you have to ensure that you specify any
  settings that do not follow conventions. That includes table names,
  primary keys as well as foreign keys.

  You didn't provide your model definitions, so it's hard to guess as to
  what could be culprit.

  On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
  Forgot to mention - I am using $prmaryKey syntax in each model, because I
  have limited possibilities to alter the db structure. Tho, it is possible
  for me to create a sample table using cake conventions, I'll try again
  then.

  teknoid-3 wrote:

   You shouldn't break conventions when naming your primary keys.
   Cake will expect your primary key to be named 'id'... So Design.id and
   Status.id.

   Of course you can override those by setting a $prmaryKey = 'myOwnKey';
   in the model, but why make your life more difficult?

   On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
   Hello!

   I'm using Cake for several days now, I'm still under big impression of
   its
   capabilities.

   Nevertheless, I have faced a problem, to which solution, which I have
   found,
   feels not logical in the Cake ways of doing things. First, let me show
   you
   my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

   table DESIGNS
   designs_id serial - primary key
   job_name
   status_id
   ...etc

   table STATUS
   status_id serial - primary key
   name

   The expected outcome is simple - I'm querying the Design model to
   retrieve
   data about a job, and I expect to see the status name which is related
   thru
   Design.status_id = Status.status_id.

   Now, when I tried to accomplish it with $hasOne in the Design model
  the
   result is that Status is joined not on the forementioned basis, but on
   Design.design_id - Status.status_id.

   to my surprise, it works using $belongsTo relation.

   Perhaps there is something wrong with my understanding of the Cake
   relation
   ways, perhaps I'm simply overlooking some basic stuff.

   Anyhow, any help greatly appreciated.

   --
   View this message in

  context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
   Sent from the CakePHP mailing list archive at Nabble.com.

  --
  View this message in
  context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
  Sent from the CakePHP mailing list archive at Nabble.com.

 --
 View this message in 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Newbie questions about model relations

2008-10-19 Thread Marritza


Meanwhile, I have thoroughly re-read the manual on the associations, spent
some time recreating db structure, rewritten the associations and now it
works.

Not to mention some small typos in the params (all that camel-case and
stuff)

Thanks anyway!
(case closed)


teknoid-3 wrote:
 
 
 Where is the model association between Design and Status and vice
 versa?
 Your models need to know how they relate to each other.
 Please review the manual as it quite clearly describes all of the
 that.
 
 
 
 On Oct 18, 12:06 pm, Marritza [EMAIL PROTECTED] wrote:
 Ok, let me clarify finally. (Never used newsgroups before so pardon lack
 of
 complete information :P )

 class Design extends AppModel {

         var $primaryKey = 'designs_id';
         var $useTable = 'design';

 }

 class Status extends AppModel {

         var $primaryKey = 'status_id';
         var $useTable = 'status';

 }

 I'm not using foreign keys. The db schema has been posted in the first
 message.



 teknoid-3 wrote:

  If you cannot alter db structure, that's fine. Cake works perfectly
  well with legacy DB's, but you have to ensure that you specify any
  settings that do not follow conventions. That includes table names,
  primary keys as well as foreign keys.

  You didn't provide your model definitions, so it's hard to guess as to
  what could be culprit.

  On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
  Forgot to mention - I am using $prmaryKey syntax in each model,
 because I
  have limited possibilities to alter the db structure. Tho, it is
 possible
  for me to create a sample table using cake conventions, I'll try again
  then.

  teknoid-3 wrote:

   You shouldn't break conventions when naming your primary keys.
   Cake will expect your primary key to be named 'id'... So Design.id
 and
   Status.id.

   Of course you can override those by setting a $prmaryKey =
 'myOwnKey';
   in the model, but why make your life more difficult?

   On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
   Hello!

   I'm using Cake for several days now, I'm still under big impression
 of
   its
   capabilities.

   Nevertheless, I have faced a problem, to which solution, which I
 have
   found,
   feels not logical in the Cake ways of doing things. First, let me
 show
   you
   my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

   table DESIGNS
   designs_id serial - primary key
   job_name
   status_id
   ...etc

   table STATUS
   status_id serial - primary key
   name

   The expected outcome is simple - I'm querying the Design model to
   retrieve
   data about a job, and I expect to see the status name which is
 related
   thru
   Design.status_id = Status.status_id.

   Now, when I tried to accomplish it with $hasOne in the Design model
  the
   result is that Status is joined not on the forementioned basis, but
 on
   Design.design_id - Status.status_id.

   to my surprise, it works using $belongsTo relation.

   Perhaps there is something wrong with my understanding of the Cake
   relation
   ways, perhaps I'm simply overlooking some basic stuff.

   Anyhow, any help greatly appreciated.

   --
   View this message in

 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
   Sent from the CakePHP mailing list archive at Nabble.com.

  --
  View this message in
 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
  Sent from the CakePHP mailing list archive at Nabble.com.

 --
 View this message in
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
  
 
 

-- 
View this message in context: 
http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20059649.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Newbie questions about model relations

2008-10-18 Thread Marritza


Forgot to mention - I am using $prmaryKey syntax in each model, because I
have limited possibilities to alter the db structure. Tho, it is possible
for me to create a sample table using cake conventions, I'll try again then.


teknoid-3 wrote:
 
 
 You shouldn't break conventions when naming your primary keys.
 Cake will expect your primary key to be named 'id'... So Design.id and
 Status.id.
 
 Of course you can override those by setting a $prmaryKey = 'myOwnKey';
 in the model, but why make your life more difficult?
 
 On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
 Hello!

 I'm using Cake for several days now, I'm still under big impression of
 its
 capabilities.

 Nevertheless, I have faced a problem, to which solution, which I have
 found,
 feels not logical in the Cake ways of doing things. First, let me show
 you
 my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

 table DESIGNS
 designs_id serial - primary key
 job_name
 status_id
 ...etc

 table STATUS
 status_id serial - primary key
 name

 The expected outcome is simple - I'm querying the Design model to
 retrieve
 data about a job, and I expect to see the status name which is related
 thru
 Design.status_id = Status.status_id.

 Now, when I tried to accomplish it with $hasOne in the Design model the
 result is that Status is joined not on the forementioned basis, but on
 Design.design_id - Status.status_id.

 to my surprise, it works using $belongsTo relation.

 Perhaps there is something wrong with my understanding of the Cake
 relation
 ways, perhaps I'm simply overlooking some basic stuff.

 Anyhow, any help greatly appreciated.

 --
 View this message in
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
  
 
 

-- 
View this message in context: 
http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20046244.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Newbie questions about model relations

2008-10-18 Thread teknoid

If you cannot alter db structure, that's fine. Cake works perfectly
well with legacy DB's, but you have to ensure that you specify any
settings that do not follow conventions. That includes table names,
primary keys as well as foreign keys.

You didn't provide your model definitions, so it's hard to guess as to
what could be culprit.

On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
 Forgot to mention - I am using $prmaryKey syntax in each model, because I
 have limited possibilities to alter the db structure. Tho, it is possible
 for me to create a sample table using cake conventions, I'll try again then.



 teknoid-3 wrote:

  You shouldn't break conventions when naming your primary keys.
  Cake will expect your primary key to be named 'id'... So Design.id and
  Status.id.

  Of course you can override those by setting a $prmaryKey = 'myOwnKey';
  in the model, but why make your life more difficult?

  On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
  Hello!

  I'm using Cake for several days now, I'm still under big impression of
  its
  capabilities.

  Nevertheless, I have faced a problem, to which solution, which I have
  found,
  feels not logical in the Cake ways of doing things. First, let me show
  you
  my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

  table DESIGNS
  designs_id serial - primary key
  job_name
  status_id
  ...etc

  table STATUS
  status_id serial - primary key
  name

  The expected outcome is simple - I'm querying the Design model to
  retrieve
  data about a job, and I expect to see the status name which is related
  thru
  Design.status_id = Status.status_id.

  Now, when I tried to accomplish it with $hasOne in the Design model the
  result is that Status is joined not on the forementioned basis, but on
  Design.design_id - Status.status_id.

  to my surprise, it works using $belongsTo relation.

  Perhaps there is something wrong with my understanding of the Cake
  relation
  ways, perhaps I'm simply overlooking some basic stuff.

  Anyhow, any help greatly appreciated.

  --
  View this message in
  context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
  Sent from the CakePHP mailing list archive at Nabble.com.

 --
 View this message in 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Newbie questions about model relations

2008-10-18 Thread Marritza


Ok, let me clarify finally. (Never used newsgroups before so pardon lack of
complete information :P )

class Design extends AppModel {

var $primaryKey = 'designs_id';
var $useTable = 'design';
}

class Status extends AppModel {

var $primaryKey = 'status_id';
var $useTable = 'status';
}

I'm not using foreign keys. The db schema has been posted in the first
message.


teknoid-3 wrote:
 
 
 If you cannot alter db structure, that's fine. Cake works perfectly
 well with legacy DB's, but you have to ensure that you specify any
 settings that do not follow conventions. That includes table names,
 primary keys as well as foreign keys.
 
 You didn't provide your model definitions, so it's hard to guess as to
 what could be culprit.
 
 On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
 Forgot to mention - I am using $prmaryKey syntax in each model, because I
 have limited possibilities to alter the db structure. Tho, it is possible
 for me to create a sample table using cake conventions, I'll try again
 then.



 teknoid-3 wrote:

  You shouldn't break conventions when naming your primary keys.
  Cake will expect your primary key to be named 'id'... So Design.id and
  Status.id.

  Of course you can override those by setting a $prmaryKey = 'myOwnKey';
  in the model, but why make your life more difficult?

  On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
  Hello!

  I'm using Cake for several days now, I'm still under big impression of
  its
  capabilities.

  Nevertheless, I have faced a problem, to which solution, which I have
  found,
  feels not logical in the Cake ways of doing things. First, let me show
  you
  my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

  table DESIGNS
  designs_id serial - primary key
  job_name
  status_id
  ...etc

  table STATUS
  status_id serial - primary key
  name

  The expected outcome is simple - I'm querying the Design model to
  retrieve
  data about a job, and I expect to see the status name which is related
  thru
  Design.status_id = Status.status_id.

  Now, when I tried to accomplish it with $hasOne in the Design model
 the
  result is that Status is joined not on the forementioned basis, but on
  Design.design_id - Status.status_id.

  to my surprise, it works using $belongsTo relation.

  Perhaps there is something wrong with my understanding of the Cake
  relation
  ways, perhaps I'm simply overlooking some basic stuff.

  Anyhow, any help greatly appreciated.

  --
  View this message in
 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
  Sent from the CakePHP mailing list archive at Nabble.com.

 --
 View this message in
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
  
 
 

-- 
View this message in context: 
http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20048173.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Newbie questions about model relations

2008-10-18 Thread Lamonte(Scheols/Demonic)
Yeah cake its strict on everything  so you can't name your id design_id
stupid? Yes I know.

On Sat, Oct 18, 2008 at 11:06 AM, Marritza [EMAIL PROTECTED] wrote:



 Ok, let me clarify finally. (Never used newsgroups before so pardon lack of
 complete information :P )

 class Design extends AppModel {

var $primaryKey = 'designs_id';
var $useTable = 'design';
 }

 class Status extends AppModel {

var $primaryKey = 'status_id';
var $useTable = 'status';
 }

 I'm not using foreign keys. The db schema has been posted in the first
 message.


 teknoid-3 wrote:
 
 
  If you cannot alter db structure, that's fine. Cake works perfectly
  well with legacy DB's, but you have to ensure that you specify any
  settings that do not follow conventions. That includes table names,
  primary keys as well as foreign keys.
 
  You didn't provide your model definitions, so it's hard to guess as to
  what could be culprit.
 
  On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
  Forgot to mention - I am using $prmaryKey syntax in each model, because
 I
  have limited possibilities to alter the db structure. Tho, it is
 possible
  for me to create a sample table using cake conventions, I'll try again
  then.
 
 
 
  teknoid-3 wrote:
 
   You shouldn't break conventions when naming your primary keys.
   Cake will expect your primary key to be named 'id'... So Design.id and
   Status.id.
 
   Of course you can override those by setting a $prmaryKey = 'myOwnKey';
   in the model, but why make your life more difficult?
 
   On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
   Hello!
 
   I'm using Cake for several days now, I'm still under big impression
 of
   its
   capabilities.
 
   Nevertheless, I have faced a problem, to which solution, which I have
   found,
   feels not logical in the Cake ways of doing things. First, let me
 show
   you
   my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).
 
   table DESIGNS
   designs_id serial - primary key
   job_name
   status_id
   ...etc
 
   table STATUS
   status_id serial - primary key
   name
 
   The expected outcome is simple - I'm querying the Design model to
   retrieve
   data about a job, and I expect to see the status name which is
 related
   thru
   Design.status_id = Status.status_id.
 
   Now, when I tried to accomplish it with $hasOne in the Design model
  the
   result is that Status is joined not on the forementioned basis, but
 on
   Design.design_id - Status.status_id.
 
   to my surprise, it works using $belongsTo relation.
 
   Perhaps there is something wrong with my understanding of the Cake
   relation
   ways, perhaps I'm simply overlooking some basic stuff.
 
   Anyhow, any help greatly appreciated.
 
   --
   View this message in
  
  context:
 http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
   Sent from the CakePHP mailing list archive at Nabble.com.
 
  --
  View this message in
  context:
 http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
  Sent from the CakePHP mailing list archive at Nabble.com.
  
 
 

 --
 View this message in context:
 http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20048173.html
 Sent from the CakePHP mailing list archive at Nabble.com.


 



-- 
Join cleanscript.com Come here for professional PHP coding.

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



Re: Newbie questions about model relations

2008-10-18 Thread Joel Perras

 Yeah cake its strict on everything  so you can't name your id design_id
 stupid? Yes I know.

Thank you for indicating that you have no idea what you're talking
about. Go back to selling $70 websites and leave the rest of the
internet in peace.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Newbie questions about model relations

2008-10-18 Thread Pablo Viojo
You are wrong, you can name your id whatever you want as long as you  
define it using $primaryKey

Sent from my iPhone

On 18-10-2008, at 16:43, Lamonte(Scheols/Demonic)  
[EMAIL PROTECTED] wrote:

 Yeah cake its strict on everything  so you can't name your id  
 design_id stupid? Yes I know.

 On Sat, Oct 18, 2008 at 11:06 AM, Marritza [EMAIL PROTECTED] wrote:


 Ok, let me clarify finally. (Never used newsgroups before so pardon  
 lack of
 complete information :P )

 class Design extends AppModel {

var $primaryKey = 'designs_id';
var $useTable = 'design';
 }

 class Status extends AppModel {

var $primaryKey = 'status_id';
var $useTable = 'status';
 }

 I'm not using foreign keys. The db schema has been posted in the first
 message.


 teknoid-3 wrote:
 
 
  If you cannot alter db structure, that's fine. Cake works perfectly
  well with legacy DB's, but you have to ensure that you specify any
  settings that do not follow conventions. That includes table names,
  primary keys as well as foreign keys.
 
  You didn't provide your model definitions, so it's hard to guess  
 as to
  what could be culprit.
 
  On Oct 18, 7:45 am, Marritza [EMAIL PROTECTED] wrote:
  Forgot to mention - I am using $prmaryKey syntax in each model,  
 because I
  have limited possibilities to alter the db structure. Tho, it is  
 possible
  for me to create a sample table using cake conventions, I'll try  
 again
  then.
 
 
 
  teknoid-3 wrote:
 
   You shouldn't break conventions when naming your primary keys.
   Cake will expect your primary key to be named 'id'... So  
 Design.id and
   Status.id.
 
   Of course you can override those by setting a $prmaryKey =  
 'myOwnKey';
   in the model, but why make your life more difficult?
 
   On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
   Hello!
 
   I'm using Cake for several days now, I'm still under big  
 impression of
   its
   capabilities.
 
   Nevertheless, I have faced a problem, to which solution, which  
 I have
   found,
   feels not logical in the Cake ways of doing things. First, let  
 me show
   you
   my table structure: (btw, I'm using PostgreSQL 8.3 on Debian  
 Etch).
 
   table DESIGNS
   designs_id serial - primary key
   job_name
   status_id
   ...etc
 
   table STATUS
   status_id serial - primary key
   name
 
   The expected outcome is simple - I'm querying the Design model  
 to
   retrieve
   data about a job, and I expect to see the status name which is  
 related
   thru
   Design.status_id = Status.status_id.
 
   Now, when I tried to accomplish it with $hasOne in the Design  
 model
  the
   result is that Status is joined not on the forementioned  
 basis, but on
   Design.design_id - Status.status_id.
 
   to my surprise, it works using $belongsTo relation.
 
   Perhaps there is something wrong with my understanding of the  
 Cake
   relation
   ways, perhaps I'm simply overlooking some basic stuff.
 
   Anyhow, any help greatly appreciated.
 
   --
   View this message in
  
  context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418
   
 ...
   Sent from the CakePHP mailing list archive at Nabble.com.
 
  --
  View this message in
  context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418
   
 ...
  Sent from the CakePHP mailing list archive at Nabble.com.
  
 
 

 --
 View this message in context: 
 http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20048173.html
 Sent from the CakePHP mailing list archive at Nabble.com.






 -- 
 Join cleanscript.com Come here for professional PHP coding.

 

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



Re: Newbie questions about model relations

2008-10-17 Thread teknoid

You shouldn't break conventions when naming your primary keys.
Cake will expect your primary key to be named 'id'... So Design.id and
Status.id.

Of course you can override those by setting a $prmaryKey = 'myOwnKey';
in the model, but why make your life more difficult?

On Oct 17, 8:17 pm, Marritza [EMAIL PROTECTED] wrote:
 Hello!

 I'm using Cake for several days now, I'm still under big impression of its
 capabilities.

 Nevertheless, I have faced a problem, to which solution, which I have found,
 feels not logical in the Cake ways of doing things. First, let me show you
 my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).

 table DESIGNS
 designs_id serial - primary key
 job_name
 status_id
 ...etc

 table STATUS
 status_id serial - primary key
 name

 The expected outcome is simple - I'm querying the Design model to retrieve
 data about a job, and I expect to see the status name which is related thru
 Design.status_id = Status.status_id.

 Now, when I tried to accomplish it with $hasOne in the Design model the
 result is that Status is joined not on the forementioned basis, but on
 Design.design_id - Status.status_id.

 to my surprise, it works using $belongsTo relation.

 Perhaps there is something wrong with my understanding of the Cake relation
 ways, perhaps I'm simply overlooking some basic stuff.

 Anyhow, any help greatly appreciated.

 --
 View this message in 
 context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Newbie questions

2007-03-27 Thread feelexit

make new file, header.thtml  in hte component folder.

and in ur layout,  ?php echo $this-renderElement('header'); ?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Re: Newbie questions

2007-03-27 Thread MrTufty

If you're not sure how to manage the layout structure yet, the last
thing you need is medium/advanced tutorials.

Cake is very simple to learn the basics of, and extremely powerful
once you've gotten your head around the conventions.

To be able to help, you'll need to say which version you're presently
using: 1.1 is currently the stable release, but I use the 1.2 dev
release because I want the very latest features and I know enough to
be able to figure out what's going wrong when something does (which
isn't all that often :))

In any case, feelexit's advice is slightly inaccurate.

Under /app/views/layouts/, if you don't already have one, create a
file called either default.thtml (for 1.1) or default.ctp (for 1.2).
This is your basic layout file, whatever you put in this file will be
output every time. There's more advanced things you can do with
layouts, but for the moment I'd say don't worry about it, until you
get the basics down.

In this file you can indeed use the command feelexit mentions - but
his post was slightly wrong in one respect.

The command you want is ?php echo $this-
renderElement('name_of_element'); ?

That doesn't help you right now though because you have no elements
yet.

You need to create them, under /app/views/elements/ - the filenames
should all be something like name_of_element.thtml (for 1.1) or
name_of_element.ctp (for 1.2). The name_of_element part is what you
put in the renderElement command.

For more dynamic content you may want to look into requestAction and
components, but this is something I've barely scratched the surface of
myself yet, so I can't give you any help there.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---