You can set Model::primaryKey to whatever field you need ;)

steveh wrote:
> Folks,
>
> I'm a bit new to CakePHP (Java guy from the way back time)and all was
> going well and I have been very happy with the framework until.... I
> am trying to simply html->link a column record in a table to a view.
> Pretty basic stuff and I have done it a dozen times, with test dbs
> that have always had an index key of id. The problem is, my new db has
> a primary key index called refindKey not id. In the Cake PHP docs and
> a books I have looked at it appears that Cake is enamored with id as
> an index. I don't exactly control the db (it's generated by a Kapow
> robot). All works correctly until the sql fires and it wants to
> append .id to the query string. Here is an extract from the tail of
> the query error dump. Nowhere in the code do I mention id for anything
> so Cake id auto-assuming something.
>
> .........WHERE `Zldinput`.`id` =
> '035c2e44642d08032236ec49460b5bc556d19c8'
>
> All of this is pretty standard stuff exept refindKey has replaced id
>
> zldinputsController.php
> ...
> function view($refindkey = null) {
>               $this->Zldinput->refindkey = $refindkey;
>               $this->set('zldinput', $this->Zldinput->read());
>       }
>
> and a index.ctp with the html->link
> .....
> <?php echo $html->link($zldinput['Zldinput']['refindKey'],"/zldinputs/
> view/".$zldinput['Zldinput']['refindKey']); ?>
>               </td>  ......
>
> The view action provides the correct URL whe the table element is
> selected so the correct parameter is passed.
>
> http://localhost/zipleads/zldinputs/view/01d30e978211a2564f85a9615adb8f018d34847
>
> where the big hairy integer is the refindKey
>
> Am I missing something very basic here. How do I get around the id db
> key issue. I can't believe that Cake would have a mandatory
> requirement of a index named id per what I have read.
>
> Any help and pointers to the deeper inner workings would be greatly
> appreciated.
>
> Cheers, Steve
>
>
> >
>
>   


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

Reply via email to