Re: open $html link in new window
Thnq Andreas, Will try this and give feedback. Forrestgump On Jun 17, 12:39 pm, Andreas Derksen wrote: > Hi, > this should work: > > link('View', "/invoices/view/".$invoice['Invoice']['id'], > array('target' => '_blank')); ?> > > greets > Andreas > > forrestgump schrieb: > > > Okim not quite able to wrap my head around this one. > > I have a link that looks like so > > link('View', "/invoices/view/".$invoice['Invoice'] > > ['id']); ?> > > > so basically i can open the required invoice from a payments.ctp in an > > invoices/view.ctp ...but it redirect the windowi was hoping for a > > way to pop up in a new window... > > > can someone help me with this one i tried using onclick...but that did > > not work. > > > Thanks in advance, > > Forrestump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
open $html link in new window
Okim not quite able to wrap my head around this one. I have a link that looks like so link('View', "/invoices/view/".$invoice['Invoice'] ['id']); ?> so basically i can open the required invoice from a payments.ctp in an invoices/view.ctp ...but it redirect the windowi was hoping for a way to pop up in a new window... can someone help me with this one i tried using onclick...but that did not work. Thanks in advance, Forrestump --~--~-~--~~~---~--~~ 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: copying cakeapp from windows to linux
Thnx jsteini did just tht...and is working alrightalso turned out the core.php files was troubling.:) On May 24, 5:06 pm, jstein wrote: > On May 24, 1:29 pm, forrestgump wrote: > > > i should also mention i downloaded and installed the latest version of > > cakephp (CakePHP 1.2.3.8166) , and it seems to be working fine on my > > ubuntu box. > > When you have a working installation of Cake, try to copy the content > of your "app" folder from the Windows box to the app folder of the new > installation. > > If that still doesn't work, try to look at the server's error log to > get more information. > > You could also try to overwrite app/webroot/.htaccess and app/webroot/ > index.php with fresh versions from the Cake distribution. > > Regards > > Jonathan --~--~-~--~~~---~--~~ 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: copying cakeapp from windows to linux
i should also mention i downloaded and installed the latest version of cakephp (CakePHP 1.2.3.8166) , and it seems to be working fine on my ubuntu box. Can somone help me with the shifting app from windows to ubuntu thing, i donot want to have tot code the whole thing again...it is very laborious. Thank you in advance, Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
copying cakeapp from windows to linux
hey guys, I developed a laborious cake app on windows xampp...the application is called "invoice" i now wish to move it onto ubuntu xampp...i have installed xampp and tested it, it is working fine...i copy pasted the invoice folder to the ubuntu xamppand the visited locahost/invoice on my browser to only get this error -- Server error! The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. If you think this is a server error, please contact the webmaster. Error 500 localhost Sunday, 24-May-2009 16:47:25 IST Apache/2.2.11 (Unix) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.2.9 mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 -- Now im guessing tht merely copy pasting will not work here...can anyone tell me where im going wrong. Regards, Thanks in advance, Forrestgump --~--~-~--~~~---~--~~ 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: protecting access to js folder
sorry i forgot to mention...i donot want the files to show up when the user punches in the URL /webroot/js On May 22, 11:01 pm, mark_story wrote: > How do you want to protect it? Since they are static files I would > suggest you look into the HTTP Basic auth provided by your webserver. > > -Mark > > On May 22, 9:25 am, forrestgump wrote: > > > hey guys, > > I was wondering if there was anyway to restrict access to the js > > folder in app/webroot/js or app/webroot itself as a matter. > > > will appreciate any enlightenment on the issue > > > thanks, > > forrestgump --~--~-~--~~~---~--~~ 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 to abort save?
Just follow the links provided by Teh Treag . Basically u need to define the validation function in your Model to make sure the field it not empty . forrestgump On May 22, 12:06 pm, cakephp101 wrote: > how? i'm sorry i just learned cakephp few weeks ago. > > On May 22, 2:52 pm, "Dr. Loboto" wrote: > > > You should use validation for it. > > > On May 22, 12:15 pm, cakephp101 wrote: > > > > yes, i mean fields in a table. i'm doing a timesheet for a payroll. > > > the start sched, end sched, time in and time out of the employee are > > > the input. that means i have 4 fields. i have 5 rows of those 4 > > > fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day. > > > when i only put input in 4 of the rows and 1 form is empty, it will > > > still save the empty fields with a null value in my database. i'm > > > saving it through saveAll. how can i abort the save for the fields > > > that are empty? i think it should be done in beforeSave but i don't > > > know how. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
protecting access to js folder
hey guys, I was wondering if there was anyway to restrict access to the js folder in app/webroot/js or app/webroot itself as a matter. will appreciate any enlightenment on the issue thanks, forrestgump --~--~-~--~~~---~--~~ 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: Missing table for missing model
Has no one a solution? :( On Apr 29, 9:10 pm, forrestgump wrote: > Hey Faifas, > Yes i havewhat is even more amusing is that...i put back the > Seasons table, but there is no Mode,View or controller for it(i > deleted them)and the app seems to be running... > > Cheers2u2, > Forrestgump > > On Apr 29, 7:42 pm, Aivaras wrote: > > > Hey, > > > did you remove associations in your other models? > > > Cheers, > > Faifas > > > On Wed, Apr 29, 2009 at 17:32, forrestgump wrote: > > > > hey guys, > > > Iam working on a cakephp app and i ran into this problem, though > > > minor it is driving me crazy > > > I had created a complete MVC structure for a "Seasons" module, then i > > > voted against it and deleted everything related to it..the > > > model,views,controller and the table too... > > > > but, my app now keeps giving me an error > > > > Missing Database Table > > > Error: Database table seasons for model Season was not found. > > > > Notice: If you want to customize this error message, create app\views > > > \errors\missing_table.ctp > > > > Can someone help me resolve thisI tried deleting the necessary > > > files in > > > ...\app\tmp\cache\models > > > ...\app\tmp\cache\persistent > > > but still no change > > > > Will really appreciate all the help u have to offer.. > > > > Regards, > > > Forrestgump --~--~-~--~~~---~--~~ 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: Missing table for missing model
Hey Faifas, Yes i havewhat is even more amusing is that...i put back the Seasons table, but there is no Mode,View or controller for it(i deleted them)and the app seems to be running... Cheers2u2, Forrestgump On Apr 29, 7:42 pm, Aivaras wrote: > Hey, > > did you remove associations in your other models? > > Cheers, > Faifas > > On Wed, Apr 29, 2009 at 17:32, forrestgump wrote: > > > hey guys, > > Iam working on a cakephp app and i ran into this problem, though > > minor it is driving me crazy > > I had created a complete MVC structure for a "Seasons" module, then i > > voted against it and deleted everything related to it..the > > model,views,controller and the table too... > > > but, my app now keeps giving me an error > > > Missing Database Table > > Error: Database table seasons for model Season was not found. > > > Notice: If you want to customize this error message, create app\views > > \errors\missing_table.ctp > > > Can someone help me resolve thisI tried deleting the necessary > > files in > > ...\app\tmp\cache\models > > ...\app\tmp\cache\persistent > > but still no change > > > Will really appreciate all the help u have to offer.. > > > Regards, > > Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Missing table for missing model
hey guys, Iam working on a cakephp app and i ran into this problem, though minor it is driving me crazy I had created a complete MVC structure for a "Seasons" module, then i voted against it and deleted everything related to it..the model,views,controller and the table too... but, my app now keeps giving me an error Missing Database Table Error: Database table seasons for model Season was not found. Notice: If you want to customize this error message, create app\views \errors\missing_table.ctp Can someone help me resolve thisI tried deleting the necessary files in ...\app\tmp\cache\models ...\app\tmp\cache\persistent but still no change Will really appreciate all the help u have to offer.. Regards, Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
naming conventions help
hey guys, I ran into a problem with the model and table naming conventions I have the following: 1)model: department.php :- 2)contoller: deparments_conrtoller.php :- 3)View folder: departments and index.php:- TEST!!! here is the problem when i view the page (appname)/deparments i get TEST!!! as expected.i created a table called "departments" with fields id,departmentand i commented the line var $useTable = false; in deparment model.now i get an error which says: Not Found Error: The requested address '/departments' was not found on this server. Can someone tell me what iam doing wrong im guessing it is in my naming conventions...can someone correct me? will appreciate any help. Regards, Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
sorting/ordering with foreign key
Hey Guys, Consider the following example I have 2 tables table1: invnos fields: id,invno table2: invoices fields: id,invno_id now i wish to write a query that will order my find in the invoices table according to the invno in the invnos table can someone help me out with it...the best i could write is... $this->Invoice->find('all',array(),array(),'order' => 'invno_id DESC') but it seems to be ordering by the invno_id that i stored in the invoices table thanx in advance, Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
isUnique case-sensitivity off ??
Hey guys, Need help with this... i have validation rules defined as thus: var $validate = array( 'city' => array( 'notempty'=>array( 'rule' => 'alphaNumeric', 'message' => 'Error: Empty City Field', 'allowEmpty' => false ), 'unique'=>array( 'rule' => 'isUnique', 'message' => 'Error: City Already Exists', ) ) ); they work well, but i noticed that the isUnique rule is case-sensitive ie i can have 2 entries like so: "Newyork" and alse "newyork". I was wondering if there is any way to turn off the case-sensitivity --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to display validation error messages
Hey guys, Needed help with this one...seems as though it was never answered anywhere in the group so i think it will help a lot of people- I have a validation criteria in my Model defined as below: class District extends AppModel { var $validate = array( 'district' => array( 'rule' => 'alphaNumeric', 'message' => 'Error: Empty District Field', 'allowEmpty' => false ) ); } Now when the user inputs an empty district field, the save does not take place as expected. what I would like to do is to somehow print the 'message' --- 'Error: Empty District Field', that i supplied in the array above. I was expecting Cake to do it automatically but it seems iam wrong. Will appreciate any help given. Thanx again, Forrestgump --~--~-~--~~~---~--~~ 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: Interlinked tables
lol.thnx a ton :) On Jan 20, 7:50 pm, WebbedIT wrote: > Not sure to be honest, it probably doesn't need to be :o) > > I eventually came to the solution after properly* reading the > following blog posts > > http://teknoid.wordpress.com/?s=force+join > > Glad I could help, makes my weeks of head bangin that bit more worth > it to help others! > > Paul. > > *I had previously overlooked them as I thought it only helped with > HABTM associations --~--~-~--~~~---~--~~ 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: Interlinked tables
Hey Paul, Thanks for the solution, I would have never figured this out.could u explain what u are doing in $this->Invoice->bindModel( > array( > 'belongsTo' => array( > 'Mandal'=>array(), > 'District'=>array('foreignKey'=>false, 'conditions'=>array > ('Mandal.district_id = District.id')) > ) > ), > false > ); in a little more detail.i understand u are creating a new relation, but why is 'Mandal'=>array() ??? THANQ ONCE AGAIN..:) On Jan 20, 2:27 pm, WebbedIT wrote: > Forrestgump, > > CakePHP does not join tables on deep belongsTo associations, even if > you increase recursive. This effects you as the relationship from > your Invoice to District models is as follows: > > Invoice belongsTo Mandal -> Mandal belongsTo District > > It took me over a week to solve this solution as I was wanting to use > paginate and wanted to order the results by data from a table 2 > belongsTo relations away. The answer is to force a join from Invoice > to District as follows: > > $this->Invoice->unbindModel( > array( > 'belongsTo' => array('Mandal'), > ), > false > ); > $this->Invoice->Mandal->unbindModel( > array( > 'belongsTo' => array('District') > ), > false > ); > $this->Invoice->bindModel( > array( > 'belongsTo' => array( > 'Mandal'=>array(), > 'District'=>array('foreignKey'=>false, 'conditions'=>array > ('Mandal.district_id = District.id')) > ) > ), > false > ); > > Essentially you are unbinding any existing associations to the models > in question, then creating a new association. By setting foreignKey > to false you can then set your own custom condition which will allow > you to join Invoice direct to District. > > Because I was using paginate which runs more than one query, I added a > false parameter to each bindModel() and unbindModel() so the binds > would not reset after the first query. If just running a find() then > you can leave these as the default true. > > Also if you are not wanting to use paginate and sort columns, you can > look at using the containable behaviour which will also pull the data > out for you, but stores the data in a different array format to the > above option. > > Regards, > > Paul. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Interlinked tables
Hey guys, I need help with a problem i ran into... I have three tables - Table1:districts collumns: id,district Table2:madnals collumns: id,district_id,mandal Table3:invoices collumns: id,mandal_id,invno with grigri's help from a previous post of mine i was able to populate a dropdown list with the districts names while accessing the Mandals model. What I'am trying to do now is create a view.ctp that will display following data in a tabular format- mandal | district | invno I wish to do this accessing my Invoice model. The code in my Invoice model is so: class Invoice extends AppModel { var $belongsTo = array( 'Mandal' => array('className' => 'Mandal', 'conditions' => '', 'order' => '', 'foreignKey' => 'mandal_id')); } The invoices_controller code is so: class InvoicesController extends AppController { var $uses = array('District','Mandal'); function view() { $this->set('invoices', $this->Invoice->find('all'),$this->paginate ()); } } I print the data into the view.ctp using a loop and following variables: Invoice District Mandal the Mandal name appears as expected, but i cant get the district name to appear, instead the district_id itself appears as a number. Invoice | District | Mandal 112 Bhongir (correct) (id appears(correct) not name) Can someone please help me with a solution to this problem? I used roundabout methods for now, but my code is getting way to complex. I know the solution has to do something with the model.can someone please help? I would greatly appreciate it. :) Forrestgump --~--~-~--~~~---~--~~ 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: delay or wait?
Thanks a Bunch!!! again Grigri...tht helped :) On Jan 16, 4:37 pm, grigri wrote: > All databse queries are executed synchronously - i.e. once you call > `find()`, the next line of code will not execute until the find has > been completed, the data fetched and formatted. > > If the returned data is not there, then there must be a problem with > your query. Using the sql query log (debug=2), check the sql and > results. Execute exactly the same sql directly in your database (mysql > console, phpminiadmin, phpPgAdmin, ...) and ensure that the results > are correct. > > hth > grigri > > On Jan 16, 10:45 am, forrestgump wrote: > > > Was wondering if there is a delay function i could use in my > > controller , to force cake to wait for a find() function to execute... > > This is the situation iam in > > > $temp=$this->Invno->find('all',array('conditions'=>''. > > $conditions,'fields'=>array('id'))); > > $this->data['invno_id']=0; > > $this->data['invno_id']=$temp[0]['Invno']['id']; > > > Now i wish to execute this statement only after $this->data > > ['invno_id'] had been set > > $this->Invoice->save($this->data) > > > but for some reason there is an observed delay and the program just > > halts > > > i did this to check if there is a delay-- > > $temp=$this->Invno->find('all',array('conditions'=>''. > > $conditions,'fields'=>array('id'))); > > $this->data['invno_id']=0; > > $this->data['invno_id']=$temp[0]['Invno']['id']; > > > if($this->data['invno_id']!=0) > > { > > $this->Invoice->save($this->data);} > > > else > > { > > $this->Session->setFlash('There is a delay in getting the invno_id'); > > $this->redirect('/invoices',null,true); > > > } > > > I keep getting the message "There is a delay in getting the invno_id". > > Can someone help me with a workaround? > > > Will appreciate any help... > > > forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
delay or wait?
Was wondering if there is a delay function i could use in my controller , to force cake to wait for a find() function to execute... This is the situation iam in $temp=$this->Invno->find('all',array('conditions'=>''. $conditions,'fields'=>array('id'))); $this->data['invno_id']=0; $this->data['invno_id']=$temp[0]['Invno']['id']; Now i wish to execute this statement only after $this->data ['invno_id'] had been set $this->Invoice->save($this->data) but for some reason there is an observed delay and the program just halts i did this to check if there is a delay-- $temp=$this->Invno->find('all',array('conditions'=>''. $conditions,'fields'=>array('id'))); $this->data['invno_id']=0; $this->data['invno_id']=$temp[0]['Invno']['id']; if($this->data['invno_id']!=0) { $this->Invoice->save($this->data); } else { $this->Session->setFlash('There is a delay in getting the invno_id'); $this->redirect('/invoices',null,true); } I keep getting the message "There is a delay in getting the invno_id". Can someone help me with a workaround? Will appreciate any help... forrestgump --~--~-~--~~~---~--~~ 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: quick table functions
manual? i looked through the api, but couldnt understandthanks though i found my old code and everything worked out fine Don't Judge people without understanding the situation they are in On Jan 14, 9:04 pm, Smelly_Eddie wrote: > I think in the same amount of time you could have searched the cake > manual on any one of those keywords and found your answer. > > Don't be lazy. > > On Jan 13, 7:38 am, forrestgump wrote: > > > Hey, > > Does anyone know how to sort a table based on any collumn a user has > > selected and also paginate that table. I did it once before, im in a > > bit of a hurry so i cant look right now. > > > Thanks, > > Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
quick table functions
Hey, Does anyone know how to sort a table based on any collumn a user has selected and also paginate that table. I did it once before, im in a bit of a hurry so i cant look right now. Thanks, Forrestgump --~--~-~--~~~---~--~~ 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: Simple Drop Down List
Oh wow $displayField i would have never figured this out thanks a lot grigri...:).a lil more advicewhere did u come by this one? On Jan 12, 5:37 pm, grigri wrote: > In your District model, add this line: > > class District extends AppModel { > var $displayField = 'district'; > // ... > > } > > Now use find('list') and it will work fine. > > To avoid unnecessary code, you can just do this: > > [controller] > $this->set('districts', $this->District->find('list')); > > [view] > echo $form->input('district_id'); > > From this the `districts` variable will be used automatically to get > populate the dropdown. It's all in the naming! > > hth > grigri > > On Jan 12, 12:10 pm, forrestgump wrote: > > > Hello, > > Been a while since i posted herei ran into a problem and needed > > some help...I have two tables as follows: > > > table1: > > name:districts > > fields:id,district > > > table2: > > name:mandals > > fields:id,mandal,district_id > > > as you might have guessed i have associated the two tables with the > > help of foreign key "district_id". I manually entered the values and > > with the help of the values into the tables as: > > > table1: > > id:1 > > district:Nizamabad > > > table2: > > id:1 > > mandal:Bhongir > > district_id:1 > > > with the help of the belongsTo relationship as defined below > > > var $belongsTo = array('District' => > > array('className' => 'District', > > 'conditions' => '', > > 'order' => '', > > 'foreignKey' => 'district_id' > > ) > > ); > > i was able to properly display the name of the district in a simple > > table in a view by using the code below > > > > > > Sno. > > District > > Mandal > > Action > > > > > > > > > > > > > > > > > > > > link('Edit', > > "/mandals/edit/".$mandal['Mandal'] > > ['id']); ?> > > > > > > > > > I wish to now create a form which contains the following fields and > > save the data into table2(mandals): > > Mandal Name: > > Districts: > > > I want the Districts field to be a dropdown list which is populated > > with the name of the districts, but i want the corresponding id of the > > district to be stored in table2 district_id field when the save button > > is clicked. > > > Will appreciate any help that can be offered ive been trying to figure > > something out since 3 days...i tried using: > > $this->set('districtslist', $this->District->find('list')); > > along with echo $form->select('district_id',$districtslist,null,array > > (),'select one'); > > > but i end up populating the select list with the id's of the > > districts. by using > > $this->set('districtslist', $this->District->find('all')); > > the select list gets populated with the data of all the fields from > > both the tables. > > > Please Help!! > > > Thanks in advance, > > forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Simple Drop Down List
Hello, Been a while since i posted herei ran into a problem and needed some help...I have two tables as follows: table1: name:districts fields:id,district table2: name:mandals fields:id,mandal,district_id as you might have guessed i have associated the two tables with the help of foreign key "district_id". I manually entered the values and with the help of the values into the tables as: table1: id:1 district:Nizamabad table2: id:1 mandal:Bhongir district_id:1 with the help of the belongsTo relationship as defined below var $belongsTo = array('District' => array('className' => 'District', 'conditions' => '', 'order' => '', 'foreignKey' => 'district_id' ) ); i was able to properly display the name of the district in a simple table in a view by using the code below Sno. District Mandal Action link('Edit', "/mandals/edit/".$mandal['Mandal'] ['id']); ?> I wish to now create a form which contains the following fields and save the data into table2(mandals): Mandal Name: Districts: I want the Districts field to be a dropdown list which is populated with the name of the districts, but i want the corresponding id of the district to be stored in table2 district_id field when the save button is clicked. Will appreciate any help that can be offered ive been trying to figure something out since 3 days...i tried using: $this->set('districtslist', $this->District->find('list')); along with echo $form->select('district_id',$districtslist,null,array (),'select one'); but i end up populating the select list with the id's of the districts. by using $this->set('districtslist', $this->District->find('all')); the select list gets populated with the data of all the fields from both the tables. Please Help!! Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)
what do u know ...got insert working after all, after a friend of mine showed me my stupidityhere is the update: UP: create_table: users: username: type: varchar length: 100 index: true password: type: varchar length: 100 query: users: INSERT INTO users (username,password) values('admin','admin') DOWN: drop_table: users slick :) On Oct 1, 10:01 am, forrestgump <[EMAIL PROTECTED]> wrote: > Hey, > So ive been messing around with cake schema for 2 days and i learnt y > i dont like it. > > 1)it doesnt let u insert data > 2) it does not let you rollback > 3)there is no way u can save ur queries and run them up anytime u feel > like with a simple command > 4)all of the above makes team-development a pain in the a** > > I would recommend migrationsand i would still like someone to tell > me the correct way to insert data using yaml > > Forrestgumphttp://techcrate.wordpress.com/2008/09/29/hello-world/ > > On Oct 1, 8:01 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > > > Hi Mark, > > > Schema seems to want to schemify all models using the same connection, > > the one it automatically defaults to or the one that was specified, > > ignoring the $useDbConfig setting in the model itself. Opened a ticket > > for it:https://trac.cakephp.org/ticket/5502 > > > Chrs, > > Dav > > > On 30 Sep 2008, at 23:22, mark_story wrote: > > > > David, > > > > So you have different models using different connections, and when > > > specifying a -connection > > > the shell is attempting to schem-ify models not using that connection? > > > > If that is the case please open a ticket, with some examples on how to > > > reproduce it. > > > > -Mark > > > > On Sep 30, 1:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > > >> Speaking of which... > > > >> I have multiple connections in my database.conf. Running a 'cake > > >> schema generate' always quits with "Error: Missing database table 'x' > > >> for model 'y'". Even doing 'schema -connection alt -name Model > > >> generate' quits with the same message. Depending on which '- > > >> connection' I specify it quits on different models, so it seems it > > >> always tries to generate schemas for all models, ignoring my flags. > > > >> Am I misusing the schema shell or should I open a ticket? > > > >> Chrs, > > >> Dav > > > >> On 30 Sep 2008, at 05:03, mark_story wrote: > > > >>> In 1.2 there is a builtin Schema shell (console app) that can manage > > >>> things like ALTER statements that need to be run on a db between > > >>> runs. > > >>> To my knowledge it doesn't insert records. From a prompt cd into > > >>> cake/ > > >>> console and try cake schema help. That will give you a list of > > >>> commands supported by the SchemaShell. > > > >>> -Mark --~--~-~--~~~---~--~~ 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)
Hey, So ive been messing around with cake schema for 2 days and i learnt y i dont like it. 1)it doesnt let u insert data 2) it does not let you rollback 3)there is no way u can save ur queries and run them up anytime u feel like with a simple command 4)all of the above makes team-development a pain in the a** I would recommend migrationsand i would still like someone to tell me the correct way to insert data using yaml Forrestgump http://techcrate.wordpress.com/2008/09/29/hello-world/ On Oct 1, 8:01 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Hi Mark, > > Schema seems to want to schemify all models using the same connection, > the one it automatically defaults to or the one that was specified, > ignoring the $useDbConfig setting in the model itself. Opened a ticket > for it:https://trac.cakephp.org/ticket/5502 > > Chrs, > Dav > > On 30 Sep 2008, at 23:22, mark_story wrote: > > > > > David, > > > So you have different models using different connections, and when > > specifying a -connection > > the shell is attempting to schem-ify models not using that connection? > > > If that is the case please open a ticket, with some examples on how to > > reproduce it. > > > -Mark > > > On Sep 30, 1:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > >> Speaking of which... > > >> I have multiple connections in my database.conf. Running a 'cake > >> schema generate' always quits with "Error: Missing database table 'x' > >> for model 'y'". Even doing 'schema -connection alt -name Model > >> generate' quits with the same message. Depending on which '- > >> connection' I specify it quits on different models, so it seems it > >> always tries to generate schemas for all models, ignoring my flags. > > >> Am I misusing the schema shell or should I open a ticket? > > >> Chrs, > >> Dav > > >> On 30 Sep 2008, at 05:03, mark_story wrote: > > >>> In 1.2 there is a builtin Schema shell (console app) that can manage > >>> things like ALTER statements that need to be run on a db between > >>> runs. > >>> To my knowledge it doesn't insert records. From a prompt cd into > >>> cake/ > >>> console and try cake schema help. That will give you a list of > >>> commands supported by the SchemaShell. > > >>> -Mark --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cakephp migrations
Just in case someone needs a lil help. http://techcrate.wordpress.com/2008/09/29/hello-world/ --~--~-~--~~~---~--~~ 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)
just in case someone is interested http://techcrate.wordpress.com/2008/09/29/hello-world/ On Sep 30, 10:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Speaking of which... > > I have multiple connections in my database.conf. Running a 'cake > schema generate' always quits with "Error: Missing database table 'x' > for model 'y'". Even doing 'schema -connection alt -name Model > generate' quits with the same message. Depending on which '- > connection' I specify it quits on different models, so it seems it > always tries to generate schemas for all models, ignoring my flags. > > Am I misusing the schema shell or should I open a ticket? > > Chrs, > Dav > > On 30 Sep 2008, at 05:03, mark_story wrote: > > > In 1.2 there is a builtin Schema shell (console app) that can manage > > things like ALTER statements that need to be run on a db between runs. > > To my knowledge it doesn't insert records. From a prompt cd into > > cake/ > > console and try cake schema help. That will give you a list of > > commands supported by the SchemaShell. > > > -Mark --~--~-~--~~~---~--~~ 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: help with YAML pls basic syntax...etc
Koolthnx Mark On Sep 30, 1:03 am, mark_story <[EMAIL PROTECTED]> wrote: > In 1.2 there is a builtin Schema shell (console app) that can manage > things like ALTER statements that need to be run on a db between runs. > To my knowledge it doesn't insert records. From a prompt cd into cake/ > console and try cake schema help. That will give you a list of > commands supported by the SchemaShell. > > -Mark > > On Sep 29, 1:23 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > Built in schema shells?i dont follow...can u elaborate on that? > > > On Sep 29, 6:38 pm, mark_story <[EMAIL PROTECTED]> wrote: > > > > Couldn't you use the builtin Schema shell to do your migrations? and > > > not have to muck with YAML? > > > > -Mark > > > > On Sep 29, 3:13 am, forrestgump <[EMAIL PROTECTED]> wrote: > > > > > OK i made some changed to the code as follows > > > > UP: > > > > create_table: > > > > users: > > > > username: > > > > type: varchar > > > > length: 100 > > > > index: true > > > > password: > > > > type: varchar > > > > length: 100 > > > > > query: > > > > users: INSERT INTO users SET username = 'admin' and password= > > > > 'admin' > > > > > DOWN: > > > > query: > > > > users: DELETE FROM users WHERE username = 'admin' and password= > > > > 'admin' > > > > drop_table: users > > > > > It has successfully created the users table and the collumns i > > > > require, including two additional ones i dont require(created, > > > > modified) > > > > yet no data was insertedwhere am i going wrong? > > > > > On Sep 29, 12:00 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > > > > Can someone tell me what is wrong with the following YAML code ? \ > > > > > > UP: > > > > > create_table: > > > > > users: > > > > > id: > > > > > type: integer > > > > > length: 11 > > > > > primary: true > > > > > autoincrement: true > > > > > username: > > > > > type: varchar > > > > > length: 100 > > > > > index: true > > > > > password: > > > > > type: varchar > > > > > length: 100 > > > > > > query: > > > > > users: INSERT INTO users SET username = 'admin' and password= > > > > > 'admin' > > > > > > DOWN: > > > > > drop_table: users > > > > > query: > > > > > users: DELETE FROM users WHERE username = 'admin' and password= > > > > > 'admin' > > > > > > what i want it to do is, create a table users with fields > > > > > [id,username,password] and then insert data into it > > > > > [0,admin,admin]wht YAML is doing for me is... > > > > > it create a table users with fields [id,created,modified] and another > > > > > table autoincrement with fields [id,username,password] , and nothing > > > > > gets inserted > > > > > > I would really appreciate some help ive been stuck on this since 2 > > > > > daysim writing a short tutorial on cakephp migrations that i wish > > > > > to shareand this will really help... > > > > > > Forrestgump > > > > > (yes i know very original nick name :) ) --~--~-~--~~~---~--~~ 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: help with YAML pls basic syntax...etc
Built in schema shells?i dont follow...can u elaborate on that? On Sep 29, 6:38 pm, mark_story <[EMAIL PROTECTED]> wrote: > Couldn't you use the builtin Schema shell to do your migrations? and > not have to muck with YAML? > > -Mark > > On Sep 29, 3:13 am, forrestgump <[EMAIL PROTECTED]> wrote: > > > OK i made some changed to the code as follows > > UP: > > create_table: > > users: > > username: > > type: varchar > > length: 100 > > index: true > > password: > > type: varchar > > length: 100 > > > query: > > users: INSERT INTO users SET username = 'admin' and password= > > 'admin' > > > DOWN: > > query: > > users: DELETE FROM users WHERE username = 'admin' and password= > > 'admin' > > drop_table: users > > > It has successfully created the users table and the collumns i > > require, including two additional ones i dont require(created, > > modified) > > yet no data was insertedwhere am i going wrong? > > > On Sep 29, 12:00 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > > Can someone tell me what is wrong with the following YAML code ? \ > > > > UP: > > > create_table: > > > users: > > > id: > > > type: integer > > > length: 11 > > > primary: true > > > autoincrement: true > > > username: > > > type: varchar > > > length: 100 > > > index: true > > > password: > > > type: varchar > > > length: 100 > > > > query: > > > users: INSERT INTO users SET username = 'admin' and password= > > > 'admin' > > > > DOWN: > > > drop_table: users > > > query: > > > users: DELETE FROM users WHERE username = 'admin' and password= > > > 'admin' > > > > what i want it to do is, create a table users with fields > > > [id,username,password] and then insert data into it > > > [0,admin,admin]wht YAML is doing for me is... > > > it create a table users with fields [id,created,modified] and another > > > table autoincrement with fields [id,username,password] , and nothing > > > gets inserted > > > > I would really appreciate some help ive been stuck on this since 2 > > > daysim writing a short tutorial on cakephp migrations that i wish > > > to shareand this will really help... > > > > Forrestgump > > > (yes i know very original nick name :) ) --~--~-~--~~~---~--~~ 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: page refresh?
use javascript http://grizzlyweb.com/webmaster/javascripts/refresh.asp On Sep 29, 12:37 pm, rocket <[EMAIL PROTECTED]> wrote: > sup guys > i have an upload script, that lets you upload your profile pic. > > but when you change the picture, the old picture is still stuck in the > cache, so to see the new pic the user needs to push F5... I can't > figure out how to "refresh" the page automatically. > > any ideas? --~--~-~--~~~---~--~~ 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: help with YAML pls basic syntax...etc
OK i made some changed to the code as follows UP: create_table: users: username: type: varchar length: 100 index: true password: type: varchar length: 100 query: users: INSERT INTO users SET username = 'admin' and password= 'admin' DOWN: query: users: DELETE FROM users WHERE username = 'admin' and password= 'admin' drop_table: users It has successfully created the users table and the collumns i require, including two additional ones i dont require(created, modified) yet no data was insertedwhere am i going wrong? On Sep 29, 12:00 pm, forrestgump <[EMAIL PROTECTED]> wrote: > Can someone tell me what is wrong with the following YAML code ? \ > > UP: > create_table: > users: > id: > type: integer > length: 11 > primary: true > autoincrement: true > username: > type: varchar > length: 100 > index: true > password: > type: varchar > length: 100 > > query: > users: INSERT INTO users SET username = 'admin' and password= > 'admin' > > DOWN: > drop_table: users > query: > users: DELETE FROM users WHERE username = 'admin' and password= > 'admin' > > what i want it to do is, create a table users with fields > [id,username,password] and then insert data into it > [0,admin,admin]wht YAML is doing for me is... > it create a table users with fields [id,created,modified] and another > table autoincrement with fields [id,username,password] , and nothing > gets inserted > > I would really appreciate some help ive been stuck on this since 2 > daysim writing a short tutorial on cakephp migrations that i wish > to shareand this will really help... > > Forrestgump > (yes i know very original nick name :) ) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
help with YAML pls basic syntax...etc
Can someone tell me what is wrong with the following YAML code ? \ UP: create_table: users: id: type: integer length: 11 primary: true autoincrement: true username: type: varchar length: 100 index: true password: type: varchar length: 100 query: users: INSERT INTO users SET username = 'admin' and password= 'admin' DOWN: drop_table: users query: users: DELETE FROM users WHERE username = 'admin' and password= 'admin' what i want it to do is, create a table users with fields [id,username,password] and then insert data into it [0,admin,admin]wht YAML is doing for me is... it create a table users with fields [id,created,modified] and another table autoincrement with fields [id,username,password] , and nothing gets inserted I would really appreciate some help ive been stuck on this since 2 daysim writing a short tutorial on cakephp migrations that i wish to shareand this will really help... Forrestgump (yes i know very original nick name :) ) --~--~-~--~~~---~--~~ 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: How to update a model with save method?
ORCC can u elaborate on that? forrestgump On Sep 23, 10:29 pm, ORCC <[EMAIL PROTECTED]> wrote: > Thanks for all your answers. > > I found my error: I've overridden the "exists"methodin mymodelfor > other uses. > > So, it seems that "save"methodinvokes the "existsmethodto decide > wheter call an INSERT or anUPDATE. I thought erroneuosly that > "save"methodonly checked that the id attribute was set. > > On 23 sep, 11:08, teknoid <[EMAIL PROTECTED]> wrote: > > > Is your primary key field really named 'id' ... not 'ID' or something > > along those lines? > > > That being said $this->Manufacturer->id = $id should work regardless > > of the primary key column name, since the $id property here simply > > refers to the key column and has nothing to do with the actual name. > > The actual name is stored in the $primaryKey property of themodel. > > > On Sep 23, 1:28 am, ORCC <[EMAIL PROTECTED]> wrote: > > > > Thank you for answer. > > > > On 23 sep, 00:42, teknoid <[EMAIL PROTECTED]> wrote: > > > > > $this->Manufacturer->id = $id; > > > > > you can alsosave() the data without doing a set() first, i.e. $this- > > > > > >Manufacturer->save($this->data); > > > > This doesn't work either in mymodel-controller given in the previous > > > posts. I can't figure where is the mistake, but I've have tested the > > > following: > > > > - Set $this->Manufacturer->id = $id > > > - Set $this->data['Manufacturer']['id'] = $id and invoke $this- > > > > >Manufacturer->save($this->data) > > > > With both alternatives, the mysql error of duplicate key appears and > > > the query performed is an INSERT one. > > > > Regards. --~--~-~--~~~---~--~~ 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: test a table existence
nobody to give a suggestion ? On Sep 24, 2:47 pm, forrestgump <[EMAIL PROTECTED]> wrote: > Hello, > Iam trying to figure out a way for a model to : > 1)testtheexistenceof atable. > 2)if thetabledoesnt exist i wish the model to create thetable. > > can someone help? > > Forrestgump --~--~-~--~~~---~--~~ 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: To model or not to model
Ohk...sry rafael...i did not read the entire thread On Sep 24, 5:17 pm, forrestgump <[EMAIL PROTECTED]> wrote: > I dont think i asked anything bout using queries..i just wanted to > know wht would be the best practice..but thnx for the info...will > avoid $this->Model->query() > > On Sep 24, 4:32 pm, Rafael Bandeira aka rafaelbandeira3 > > <[EMAIL PROTECTED]> wrote: > > First of all people: what Rule? It's not made of rules, it's a pattern > > to follow - but follow as you want. > > Second, no, it doesn't "break the Rule" it only makes your code uglier > > and hard to read - see above - but the thing is, > > why to use a hand made query when you can easily/prettier/"readablier" > > use Model built-in methods to accomplish the same? > > > About performing custom find methods, with default/mandatory/pre- > > defined params you should read: > > > > http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define... > > > http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-cus... > > > About the rules: > > Even being annoying, executing hand made queries on the controller > > still leaves all the data transaction and structuration on the Model > > side, > > and it lets the pattern intended to be followed intact, but it's not > > the best practice. If even following the links presented - and links > > cited inside them, you > > still not find the solution for a more complex and featured query, try > > to implement it inside a model method to make your controller cleaner: > > > $this->Model->find("where id=xyz") > > becomes > > $this->Model->find('axis', array('id' => 'xyz')); // following those > > links > > or > > $this->Model->getByAxis($axis); > > > But in the specific case you presented, you could easily use Model > > methods overload by calling $this->Model->findById($id), $this->Model- > > > >findBy($fieldValue); > > > Still thinks that executing queries is needed? > > > rafaelbandeira3http://rafaelbandeira3.wordpress.com > > > > but i heared if you direct query in controller will violate the MVC > > > rule > > > > i.e if you use $this->Model->query("select * from models"); > > > > the above query will violate the MVC rule. > > > > i heared the queries shouldnotbe written in controller it should be > > > inmodeli.e in urmodel.php > > > > even i am alsonotabsolute on this part > > > > On Sep 23, 2:33 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > > > Hey guys, > > > > Considering the fact that CakePhp follows the MVC architecture, id > > > > like to know...y we dont make function calls such as $this->find("where > > > > id=xyz") from function blocks typed out in Models rather > > > > > than controllersim sure there is a logical reason to it...but > > > > someone asked me this question and i couldnotgive her a good enuf > > > > answerdoes making function calls to queries like find(), save() > > > > work better in models or controllers?.and is it good practice to > > > > pass conditions in your function call while using it in a controller? > > > > eg find("where id=1") ; > > > > > Does using $this->find() in controller violate the MVC architecture in > > > > any manner? > > > > > Can someone please clarify these question for us? > > > > > Thanks in advance, > > > > forrestgump --~--~-~--~~~---~--~~ 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: To model or not to model
I dont think i asked anything bout using queries..i just wanted to know wht would be the best practice..but thnx for the info...will avoid $this->Model->query() On Sep 24, 4:32 pm, Rafael Bandeira aka rafaelbandeira3 <[EMAIL PROTECTED]> wrote: > First of all people: what Rule? It's not made of rules, it's a pattern > to follow - but follow as you want. > Second, no, it doesn't "break the Rule" it only makes your code uglier > and hard to read - see above - but the thing is, > why to use a hand made query when you can easily/prettier/"readablier" > use Model built-in methods to accomplish the same? > > About performing custom find methods, with default/mandatory/pre- > defined params you should read: > > > http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define... > > http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-cus... > > About the rules: > Even being annoying, executing hand made queries on the controller > still leaves all the data transaction and structuration on the Model > side, > and it lets the pattern intended to be followed intact, but it's not > the best practice. If even following the links presented - and links > cited inside them, you > still not find the solution for a more complex and featured query, try > to implement it inside a model method to make your controller cleaner: > > $this->Model->find("where id=xyz") > becomes > $this->Model->find('axis', array('id' => 'xyz')); // following those > links > or > $this->Model->getByAxis($axis); > > But in the specific case you presented, you could easily use Model > methods overload by calling $this->Model->findById($id), $this->Model- > > >findBy($fieldValue); > > Still thinks that executing queries is needed? > > rafaelbandeira3http://rafaelbandeira3.wordpress.com > > > but i heared if you direct query in controller will violate the MVC > > rule > > > i.e if you use $this->Model->query("select * from models"); > > > the above query will violate the MVC rule. > > > i heared the queries shouldnotbe written in controller it should be > > inmodeli.e in urmodel.php > > > even i am alsonotabsolute on this part > > > On Sep 23, 2:33 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > > Hey guys, > > > Considering the fact that CakePhp follows the MVC architecture, id > > > like to know...y we dont make function calls such as $this->find("where > > > id=xyz") from function blocks typed out in Models rather > > > > than controllersim sure there is a logical reason to it...but > > > someone asked me this question and i couldnotgive her a good enuf > > > answerdoes making function calls to queries like find(), save() > > > work better in models or controllers?.and is it good practice to > > > pass conditions in your function call while using it in a controller? > > > eg find("where id=1") ; > > > > Does using $this->find() in controller violate the MVC architecture in > > > any manner? > > > > Can someone please clarify these question for us? > > > > Thanks in advance, > > > forrestgump --~--~-~--~~~---~--~~ 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: will this voilates MVC Rule??
Hope this helps: http://groups.google.com/group/cake-php/browse_thread/thread/b3233665ad126fa7/79b31d15345cdfd1?lnk=gst&q=to+model+or+not+to+model#79b31d15345cdfd1 On Sep 24, 2:17 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On Wed, Sep 24, 2008 at 12:14 PM, techiguy <[EMAIL PROTECTED]> wrote: > > > $this->User->query("insert into users(id,name) values ($id,$name)"); > > IMO - The ideal way would be to first figure out if you can get by > with using the standard model functions and avoid writing a query. > However if you do need to write a query prefer creating a method in > the model and writing it there. > > Follow the thumbrule of Fat Models and Thin Controllers > > HTH > > Tarique > > -- > = > Cheesecake-Photoblog:http://cheesecake-photoblog.org > PHP for E-Biz:http://sanisoft.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 -~--~~~~--~~--~--~---
test a table existence
Hello, Iam trying to figure out a way for a model to : 1)test the existence of a table. 2)if the table doesnt exist i wish the model to create the table. can someone help? Forrestgump --~--~-~--~~~---~--~~ 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: To model or not to model
Thanks for the info guys...really appreciate it @RichardAtHome.whoops i forgot to mention the model inbetween"typo"...thnx for pointing tht out Forrestgump On Sep 23, 2:54 pm, techiguy <[EMAIL PROTECTED]> wrote: > hi forrestgump, > > using $this->find() in controller doesn't voilate the MVC architecture > even if you use $this->find('all') > > but i heared if you direct query in controller will violate the MVC > rule > > i.e if you use $this->Model->query("select * from models"); > > the above query will violate the MVC rule. > > i heared the queries should not be written in controller it should be > in model i.e in ur model.php > > even i am also not absolute on this part > > On Sep 23, 2:33 pm, forrestgump <[EMAIL PROTECTED]> wrote: > > > Hey guys, > > Considering the fact that CakePhp follows the MVC architecture, id > > like to know...y we dont make function calls such as $this->find("where > > id=xyz") from function blocks typed out in Models rather > > > than controllersim sure there is a logical reason to it...but > > someone asked me this question and i could not give her a good enuf > > answerdoes making function calls to queries like find(), save() > > work better in models or controllers?.and is it good practice to > > pass conditions in your function call while using it in a controller? > > eg find("where id=1") ; > > > Does using $this->find() in controller violate the MVC architecture in > > any manner? > > > Can someone please clarify these question for us? > > > Thanks in advance, > > forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cakephp application templates
Hey, I was wondering if anyones got any good sites for application templates for cakephp...like templates having pre-programmed login/ logout/sessions maintainancemenu creation role based management etc... Thanks, Forrestgump --~--~-~--~~~---~--~~ 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: How to update a model with save method?
I had a similar problem ORCC...check if the table you are inserting your data into has the primary key properly set...it appears you are using TYPE INTmake sure that it is the primary and is on "auto_increment" u usuallyy get duplicate entry errors when its not on auto_increment... forrestgump On Sep 23, 2:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I noticed something similar a few weeks ago, just out of the blue. > I am not entirely sure what I did to fix it. > > It was either: > -Going to the tried and tested first create(), then save($data). > -Or my favorite enemy the cache needing to visit the trash-can. > > /Martin > > On Sep 23, 7:28 am, ORCC <[EMAIL PROTECTED]> wrote: > > > Thank you for answer. > > > On 23 sep, 00:42, teknoid <[EMAIL PROTECTED]> wrote: > > > > $this->Manufacturer->id = $id; > > > > you can also save() the data without doing a set() first, i.e. $this- > > > > >Manufacturer->save($this->data); > > > This doesn't work either in my model-controller given in the previous > > posts. I can't figure where is the mistake, but I've have tested the > > following: > > > - Set $this->Manufacturer->id = $id > > - Set $this->data['Manufacturer']['id'] = $id and invoke $this- > > > >Manufacturer->save($this->data) > > > With both alternatives, the mysql error of duplicate key appears and > > the query performed is an INSERT one. > > > Regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
To model or not to model
Hey guys, Considering the fact that CakePhp follows the MVC architecture, id like to know...y we dont make function calls such as $this- >find("where id=xyz") from function blocks typed out in Models rather than controllersim sure there is a logical reason to it...but someone asked me this question and i could not give her a good enuf answerdoes making function calls to queries like find(), save() work better in models or controllers?.and is it good practice to pass conditions in your function call while using it in a controller? eg find("where id=1") ; Does using $this->find() in controller violate the MVC architecture in any manner? Can someone please clarify these question for us? Thanks in advance, forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ok dont bother answering that
ok i can know y...message will appear momentarily it says --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
where is my post appearing
hey where is my post appearing ?...i dont see it on the discussion list --~--~-~--~~~---~--~~ 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: Missing Database Table
Luiz Poleto Yea i checked my tables and all they were all perfect i tried the delete the cache solution by bonitarunner, tht did the trickman cake is wierd Thanks a lot guys.saved me a lot of time. On Sep 10, 8:07 pm, "Luiz Poleto" <[EMAIL PROTECTED]> wrote: > Gump, > Is this message correct? > > "Error: Database table itemss for model Items was not found." > > Look at table name the message show: itemss. If that is the message Cake has > shown, then something is not properly configured, like the model class, for > example. > > Regards, > Luiz Poleto > > 2008/9/10 bonitarunner <[EMAIL PROTECTED]> > > > > > Gump...Exact same thing happened to me! Very frustrating. I am > > absolute beginner (following same todo example) but here is what I did > > to get it to work. > > > 1) Made another database called apress (not cake), then made items > > table in phpAdmin, put same fields as in example. Finally, changed > > database.php settings to match to apress database. > > 2) turned off caching app\config\core.php this line > this> Configure::write('Cache.disable', true); > need to do this but I did anyway> > > 3) stopped wamp and restarted > > 4) refreshed todo/items in browser and works perfectly now. No code > > changes. > > > I also downloaded authors code from book site (exactly the same as > > mine earlier with your same error). He uses PHP shorthand so make > > sure your and have > > > Rough startbut it works now. I hope it helps you. > > > On Sep 9, 3:39 am, forrestgump <[EMAIL PROTECTED]> wrote: > > > Hey guys, > > > I'm new to cakephp and can't wait to get it fired up.i was > > > creating a test app...and i followed the following steps: > > > > 1) created a database cake > > > 2) placed my cake folder into my www folder and renamed it to "todo" > > > 3) created a table "items" in database "cake" > > > 4) configured my database.php respectively. > > > 5) created an items_controller.php in \www\todo\app\controllers with > > > the following code: > > > > > class ItemsController extends AppController > > > { > > > var $name = 'Items'; > > > var $scaffold; > > > } > > > ?> > > > 6) create an item.php in C:\wamp\www\todo\app\models with the > > > following code: > > > > > class Item extends AppModel > > > { > > > var $name = 'Item'; > > > } > > > ?> > > > 7) i visitedhttp://localhost/todo/itemstosee a nice message in red > > > saying: > > > "Missing Database Table" > > > also i had highlighted with a red background an error saying: > > > "Error: Database table itemss for model Items was not found." > > > > I have configured and set cakephp properly when i visit localhost/todo > > > i receive confirmation that cakephp is able to connect to database , > > > tmp folder is writable and i have all the css rendered. > > > > can someone please help me with this > > > > Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Missing Database Table
Hey guys, I'm new to cakephp and can't wait to get it fired up.i was creating a test app...and i followed the following steps: 1) created a database cake 2) placed my cake folder into my www folder and renamed it to "todo" 3) created a table "items" in database "cake" 4) configured my database.php respectively. 5) created an items_controller.php in \www\todo\app\controllers with the following code: 6) create an item.php in C:\wamp\www\todo\app\models with the following code: 7) i visited http://localhost/todo/items to see a nice message in red saying: "Missing Database Table" also i had highlighted with a red background an error saying: "Error: Database table itemss for model Items was not found." I have configured and set cakephp properly when i visit localhost/todo i receive confirmation that cakephp is able to connect to database , tmp folder is writable and i have all the css rendered. can someone please help me with this Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---