Re: What do you develop in (ide, text editor, etc.)?
I'm using Coda for projects (could not recommend this program enough), and Xcode for quick edits (and free). Sorry to weigh into a windows discussion with my mac suggestions :) Cheers, Aidan On Mar 2, 6:22 pm, "Liebermann, Anja Carolin" wrote: > I'm using Eclipse with PDT (Europa) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AW: 2 foreign keys to same model?
Hi I also have this situation: User who created an item and those who are officially responsible for the item. Both coming from the same user table. What I did is ( no genius solution, but it works): E.g. when adding an item: $responsible = $this->Vertrag->User->find('list'); In the database I have the field "responsible" which saves the user id. It works but isn't an elegant solution, becuase I don't user the full Cake power and have to do the rest manually. Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag von sjunwan...@gmail.com Gesendet: Sonntag, 1. März 2009 11:12 An: CakePHP Betreff: 2 foreign keys to same model? Hi, using cake1.2, I came across a problem while setting up my database. I have a question on how to set this database up by cake's convention. I have the following 2 tables: users assets each user has many assets, but any users can allow other users to access their assets so I figure the following, a third table is needed: a table that has attributes: owner, allowed they both point to users_id, how do I make this table model in cakephp? Is there another way to do this? Because i know users_id means foreign key to table users, but how do you have 2 foreign to the same table? in short users has many assets, any users can access other user's assets as long as their id are on the allowed attribute of the owner id. both columns points to the users table thank you --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AW: customizing error messages from form helper
I guess you could do it via the validation rules in the model. Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag von horatio Gesendet: Sonntag, 1. März 2009 21:29 An: cake-php@googlegroups.com Betreff: Re: customizing error messages from form helper thanks corie. is there any way you know of to do this globally so i dont have to repeat the code so often? corie wrote: > > > You can change the class 'error-message' to whatever you want by > setting it in the options array of your $form->input call: > > $form->input('field', array('error' => array('class' => 'custom-error- > class'))); > > Or you could take the automatic error out of the input div and put it > on its own where you have more control: > > input('field', array('error' => false));?> class="error-message'>error('field', array ('class' > => 'nested-div'));?> > > -Corie > > On Feb 28, 11:15 pm, horatio wrote: >> two questions-- >> >> the default class returned from error() within the html helper is >> error-message. how do i override this in my controller? >> >> more importantly, how can i inject some html content inside the error >> div after a failed form validation? >> >> right now its: >> >> error message here >> >> i would like it to hypothetically be: >> >> error message >> here >> >> is this possible sanely? >> >> -- >> View this message in >> context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/customizing-error-messages-from-form-helper-tp22269823p22277541.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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
What do you develop in (ide, text editor, etc.)?
I'm using Eclipse with PDT (Europa) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Need to select 5 records from one table per category_id
I have a that associates a category_id, and I need to select 5 rows per category_id (we'll assume 1,2,3,4,5,6,7) so I need 5 from each category_id... How can I pull this off in CakePHP? The only way I can think is to do individual queries to each table but that is not only going to put a big load on the database, it's just an ugly approach in my opinion Thanks in advance. :) --~--~-~--~~~---~--~~ 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: Validate HABTM
Hi, thank for the answer. I read the blog entry before but it didn't seem to be the most elegant way because in teknoid's example the Post model is only validated if the validation of the Tag model was ok. With the other model associations I got the validation of both models working by calling saveAll(). Isn't that possible with HABTM? Regards Guenther brian schrieb: > Have a look here > > http://teknoid.wordpress.com/?s=validate+habtm > > On Fri, Feb 27, 2009 at 9:30 AM, Günther Theilen wrote: >> Hi, >> >> maybe I'm a bit dull but I can't figure out what I'm doing wrong here. >> Maybe someone can help: >> >> I've got two models: Foo HABTM Bar. >> >> In foo_controller, add method I do this: >> >> $bar = $this->Foo->Bar->find('list'); >> $this->set(compact('bar)); >> >> In the foo/add view I have: >> $form->input('Bar', array('multiple' => 'checkbox')) >> >> Which works as I expected. >> >> Now I want to validate the checkboxes. >> >> In models/bar.php I added >> var $validate = array('Bar' => array('rule' => 'testRule')); >> >> function testRule() { >> debug ("test"); >> die(); >> } >> >> >> In foo_controller, add method I tried this: >> $this->Foo->save($this->data) >> and this: >> $this->Foo->saveAll($this->data) >> and this: >> $this->Foo->saveAll($this->data, array('validate' => 'first')) >> >> All my other validation rules in the Foo-model work perfectly but the >> rule in Bar doesn't seem to be triggered. >> >> Where is my mistake? >> Any hints? >> >> Regards >> Guenther >> >> >> >> >> > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error handling in production
I have two questions for error handling in a production environment. a) How can I log warnings & notices b) What's the best way to display custom error pages This is what I know so far, I can define app_error.php and create my custom error handlers there. This works fine for development, but once I switch to production these errors are replaced by error500. I can define an appError in app_controller.php, but this doesn't catch notices, and I see no obvious mechanism for calling my custom error handlers in app_error.php. I can overwrite __construct in app_error.php to do something like: But I've been told this is an exceptionally bad idea by the gurus in #cakephp. So, I ask, what does everyone else do? Thanks, Aidan --~--~-~--~~~---~--~~ 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: Class dispatcher not found
> Any warning/notices before fatal error? No nothing at all, this is a fresh install. All I can think of at this point is that App::import() is failing in the bootstrap to import the Dispatcher for some reason and then the app/webroot/index.php file is trying to create the Dispatcher and failing. --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
NetBeans 6.5 On Feb 28, 11:14 pm, adam wrote: > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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: Class dispatcher not found
Any warning/notices before fatal error? On Feb 27, 10:36 am, bwilt wrote: > On a clients machine they are installing cakephp 1.2 8004 in a sub- > directory of their main site. app/tmp has been setup correctly with > 777 (cache has been cleared) and mod rewrite is enabled. > > I'm not sure what the apache2 configuration has been setup with and > its using PHP5.2. > > When loading the site it produces the following error :- > Fatal error: Class 'Dispatcher' not found in /var/www// > htdocs//app/webroot/index.php on line 87 > > Has anyone struck anything similar to this ? I haven't been able to > replicate this on my local server. > > Any ideas welcome. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: What do you develop in (ide, text editor, etc.)?
And I thought I was the only one. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Samuel DeVore Sent: Sunday, March 01, 2009 4:36 PM To: cake-php@googlegroups.com Subject: Re: What do you develop in (ide, text editor, etc.)? a tutu and go go boots On Sun, Mar 1, 2009 at 12:34 PM, Tomás Laureano Peralta Tormey wrote: > Currently using NetBeans 6.5. The hints from this bakery article [1] > were really useful. > Hopefully, better support for CakePHP could be available in the near > future (if this issue [2] get enough votes). > > [1]: > http://bakery.cakephp.org/articles/view/model-based-code-insight-and-c > ompletion-in-netbeans > [2]: http://www.netbeans.org/issues/show_bug.cgi?id=140918 > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
WhoDidIt behavior
I just posted a new behavior here: http://blog.4webby.com/ and here http://bakery.cakephp.org/articles/view/whodidit-behavior-automagic-created_by-and-modified_by-fields enjoy! Dan --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I used Zend Studio, then Aptana at work, but I'm now sticking with TextMate ;o) --~--~-~--~~~---~--~~ 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: Security component breaks my ajax requests
Thanks that worked. But now im trying to blackhole a non ajax request, and this doesnt seem to work either. if (!$this->RequestHandler->isAjax()) { $this->Security->blackHole($this, 'You are not authorized to process this request!'); } How exactly can I tell if the blackhole works, if I just get a white page? --~--~-~--~~~---~--~~ 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: customizing error messages from form helper
I guess you could extend the formHelper and array_merge 'error' => 'false' into the options and then a $this->error() call after it. You could also throw in the conditional if ($this->isFieldError('field')). -Corie On Mar 1, 3:29 pm, horatio wrote: > thanks corie. > > is there any way you know of to do this globally so i dont have to repeat > the code so often? > > > > corie wrote: > > > You can change the class 'error-message' to whatever you want by > > setting it in the options array of your $form->input call: > > > $form->input('field', array('error' => array('class' => 'custom-error- > > class'))); > > > Or you could take the automatic error out of the input div and put it > > on its own where you have more control: > > > input('field', array('error' => false));?> > > error message here > > >> i would like it to hypothetically be: > > >> error message > >> here > > >> is this possible sanely? > > >> -- > >> View this message in > >> context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... > >> Sent from the CakePHP mailing list archive at Nabble.com. > > -- > View this message in > context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... > 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What do you develop in (ide, text editor, etc.)?
a tutu and go go boots On Sun, Mar 1, 2009 at 12:34 PM, Tomás Laureano Peralta Tormey wrote: > Currently using NetBeans 6.5. The hints from this bakery article [1] were > really useful. > Hopefully, better support for CakePHP could be available in the near future > (if this issue [2] get enough votes). > > [1]: > http://bakery.cakephp.org/articles/view/model-based-code-insight-and-completion-in-netbeans > [2]: http://www.netbeans.org/issues/show_bug.cgi?id=140918 > > > > --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
Currently using NetBeans 6.5. The hints from this bakery article [1] were really useful. Hopefully, better support for CakePHP could be available in the near future (if this issue [2] get enough votes). [1]: http://bakery.cakephp.org/articles/view/model-based-code-insight-and-completion-in-netbeans [2]: http://www.netbeans.org/issues/show_bug.cgi?id=140918 --~--~-~--~~~---~--~~ 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: customizing error messages from form helper
thanks corie. is there any way you know of to do this globally so i dont have to repeat the code so often? corie wrote: > > > You can change the class 'error-message' to whatever you want by > setting it in the options array of your $form->input call: > > $form->input('field', array('error' => array('class' => 'custom-error- > class'))); > > Or you could take the automatic error out of the input div and put it > on its own where you have more control: > > input('field', array('error' => false));?> > error message here >> >> i would like it to hypothetically be: >> >> error message >> here >> >> is this possible sanely? >> >> -- >> View this message in >> context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/customizing-error-messages-from-form-helper-tp22269823p22277541.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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
error logging in a shell application
Hi everyone I'm trying to figure out how I can make cake log errors that occur in a console application to the error.log and debug.log files I can't seem to find a way to do that no matter what I set the debug level (Configure::write('debug',)) to. Can anyone help me? --~--~-~--~~~---~--~~ 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: 2 foreign keys to same model?
On Sun, Mar 1, 2009 at 12:20 PM, mscdex wrote: > > On Mar 1, 5:12 am, "sjunwan...@gmail.com" > wrote: >> I have the following 2 tables: >> >> users >> assets >> >> each user has many assets, but any users can allow other users to >> access their assets > > You could set up a HasAndBelongsToMany relationship between the two > models. You would still need to create a third table for this kind of > relationship though. I think the OP wants to know how to get around having 2 user_id fields in the join table. Have a look through here: http://groups.google.com/group/cake-php/search?group=cake-php&q=self+habtm I think it should be something along these lines: in User model var $hasAndBelongsToMany = array( 'UserAsset' => array( 'className' => 'User', 'joinTable' => 'user_assets', 'foreignKey' => 'user_id', 'associationForeignKey' => 'access_user_id' ) ); --~--~-~--~~~---~--~~ 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: Trouble With Saving Data In View
On Mar 1, 7:29 pm, NineBlindEyes wrote: > Didn't work. I still do not understand what would make cake decide to > add rows anytime you save data and read data in a controller. Probably if you log $this->here and $this->referer(); you'll find you're making requests to 'view' articles that don't exist. e.g. through missing css, js or images. incidentally you can just use updateAll http://book.cakephp.org/revisions/results/query:updateAll http://api.cakephp.org/search/updateAll hth, AD --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I've been using Aptana studio and have been deploying to the Aptana Cloud. Synching to the cloud is pretty cool and has saved me some time. On Mar 1, 3:53 am, Kappa wrote: > Does the code completion works well with netbeans? > I'm currently using Eclipse, and it's completion is not great.. for i > period i used > to work with Zend IDE ..and it was definitively great..but not free. > > Does anybody is using Aptana with cakePHP ? > > bye, > Andrea > > On Feb 28, 11:34 pm, Gonzalo Servat wrote: > > > On Sat, Feb 28, 2009 at 8:06 PM, Mauricio Morales > > wrote: > > > > I just downloaded Netbeans for PHP 6.5 and it's great. I've been > > > using Eclipse for a long but I think you can enjoy Netbeans (open > > > source and works in linux, mac, windows). > > > >http://www.netbeans.org/features/php/ > > > I second this. NetBeans for PHP 6.5 is excellent! I've stopped using Eclipse > > myself. > > > - Gonzalo --~--~-~--~~~---~--~~ 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: Trouble With Saving Data In View
Didn't work. I still do not understand what would make cake decide to add rows anytime you save data and read data in a controller. On Feb 18, 10:11 pm, brian wrote: > This should work > > functionview($id = null) { > if (!$id) { > $this->Session->setFlash(__('Invalid Item.', true)); > $this->redirect(array('action'=>'index')); > } > > $this->Item->recursive = 2; > $item = $this->Item->read(null, $id) > $this->Item->saveField('views', $item['Item']['views'] > + 1, false); > $this->set(compact('item')); > } > > > > On Wed, Feb 18, 2009 at 8:34 PM, NineBlindEyes > wrote: > > > Ok so here is my problem. I have to have a record of how many times a > > user views a page. I simply want to add 1 to theviewevery time the > >viewpage for the item is loaded. It seems to be updating the views > > correctly, but it also adds to new rows in the database. > > > Here is my code: > > > functionview($id = null) { > > if (!$id) { > > $this->Session->setFlash(__('Invalid Item.', true)); > > $this->redirect(array('action'=>'index')); > > } > > > //Add 1 toview > > $this->Item->recursive = -1; > > $item = $this->Item->read(null, $id); > > $viewnum = $item['Item']['views']+1; > > $this->data['Item'] = array('id'=>$id,'views'=>$viewnum); > > > //Save newview#s > > $this->Item->save($this->data,false,array('views')); > > > $this->Item->recursive = 2; > > $this->set('item', $this->Item->read(null, $id)); > > } --~--~-~--~~~---~--~~ 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: HtmlHelper and Umlauts
On Feb 28, 6:45 pm, Kuje wrote: > Hello, > > I have an issue with the htmlHelper: > If I want to insert an Image with an alternative text I use > > image('path/to/image.jpg', array('alt' => 'My alt > text'); ?> > > This works fine as long as the alt text does not include any umlaut. > With an '&' in it it works fine: it is translated to '&'. But a > German umlaut 'ü' is not translated but alt text is empty (which seems > to be a problem of htmlspecialchars with UTF-8. > > Any idea of a solution for this problem? What problem. What does "German umlaut 'ü' is not translated" mean? echo $html->link('x', '/', array('alt' => 'Ü')); ... x --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I've been using textmate for a long time, but going to give netbeans a try. Eclipse had many performance issues for me in the past. -Mark On Mar 1, 1:13 pm, "dr. Hannibal Lecter" wrote: > NetBeans it is. Everything else is either too simple or to bloated. > NetBeans developers seem to know how to dance on that fine line of > usability and simplicity. > > On Mar 1, 1:21 pm, Terr wrote: > > > I'm using Notepad++ and Eclipse PDT, but without code completion for > > Cake's way of model loading it doesn't matter too much which you pick. > > > But yesterday I stumbled across this video (http://www.pseudocoder.com/ > > archives/2009/02/25/programming-cakephp-app-with-komodo-ide/) that > > demonstrates the CakePHP addon for Komode Edit (free) / IDE (paid) > > that does just that: understanding Cake's dynamic models and providing > > code completion. > > > I haven't got it working yet, but as soon as I do it's time for me to > > wave goodbye to all other editors. > > > On Feb 28, 9:14 pm, adam wrote: > > > > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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: HtmlHelper and Umlauts
I had to go digging through the core code for this one. image('image.jpg', array('alt' => 'ë', 'escape' => false));?> Seems to work. -Corie On Feb 28, 12:45 pm, Kuje wrote: > Hello, > > I have an issue with the htmlHelper: > If I want to insert an Image with an alternative text I use > > image('path/to/image.jpg', array('alt' => 'My alt > text'); ?> > > This works fine as long as the alt text does not include any umlaut. > With an '&' in it it works fine: it is translated to '&'. But a > German umlaut 'ü' is not translated but alt text is empty (which seems > to be a problem of htmlspecialchars with UTF-8. > > Any idea of a solution for this problem? --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
NetBeans it is. Everything else is either too simple or to bloated. NetBeans developers seem to know how to dance on that fine line of usability and simplicity. On Mar 1, 1:21 pm, Terr wrote: > I'm using Notepad++ and Eclipse PDT, but without code completion for > Cake's way of model loading it doesn't matter too much which you pick. > > But yesterday I stumbled across this video (http://www.pseudocoder.com/ > archives/2009/02/25/programming-cakephp-app-with-komodo-ide/) that > demonstrates the CakePHP addon for Komode Edit (free) / IDE (paid) > that does just that: understanding Cake's dynamic models and providing > code completion. > > I haven't got it working yet, but as soon as I do it's time for me to > wave goodbye to all other editors. > > On Feb 28, 9:14 pm, adam wrote: > > > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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: Is it possible to create sub-controllers - directorys?
You don't need the extra folder, this is solvable by simple routing. Put your "GroupNewsController" in /controllers/ group_news_controller.php And add this line in /config/routes.php: Router::connect('/group/news/:action/*', array('controller' => 'group_news')); Hope that helps! On Mar 1, 5:20 pm, "r.ausser...@googlemail.com" wrote: > Hello, > > is it possible to create something like this:www.domain.com/group/news/list > > with a path of this: /controllers/group/news_controller.php > > and the fitting view? > > thx ;) --~--~-~--~~~---~--~~ 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: ACL and Auth with additional checking
The final piece of the puzzle. The only thing remaining was displaying the list of papers and volumes that a user had access to, instead of all the papers/volumes. Auth->user('id'); $nodes = $this->Acl->Aro->findByForeignKeyAndModel($user_id, 'User'); foreach ($nodes['Aco'] as $node) { if ($node['model'] === 'Paper') { $papers[] = $node['foreign_key']; } // Get children from volumes if ($node['model'] === 'Volume') { $children = $this->Acl->Aco->children($node['id']); foreach ($children as $child) { $papers[] = $child['Aco']['foreign_key']; } } } $conditions = array('Paper.id' => $papers); if ($this->Auth->user('group_id') == 4) { $conditions = null; } $this->set('papers', $this->paginate($conditions)); } ?> The same applies to the volumes controller, but a little simpler as you don't need the hierarchy. There must be an easier way to retrieve a set of Model records given an ARO and a parent ACO, but I couldn't find it. If anyone has any tips/suggestions, let me know. HTH, Aidan On Mar 2, 12:13 am, Aidan Lister wrote: > For the archives, this is a step-by-step on how I solved the problem: > > Rather than controllers/Papers/view/n which becomes unwieldy given you > have to create an ACO for each action, I instead created an ACO for > each row in my two models. Thanks to markstory for the suggestion. > > I created the following ACO heirachy: > Papers// > > This allowed me to give editors access to a volume, which > automatically gives access to the papers inside. This is the beauty of > ACLs. > > I created the ACO tree like so (using acltool, a custom cake shell > component): > > // $ cake acltool aco_models > function aco_models() > { > $this->out('Starting models sync'); > $Paper = ClassRegistry::init('Paper'); > $Volume = ClassRegistry::init('Volume'); > > // Create the root node > $root_alias = 'papers'; > $this->Aco->create(); > $this->Aco->save(array('parent_id' => null, 'model' => null, > 'alias' => $root_alias)); > $aco_root = $this->Aco->id; > > // Iterate all the volumes > $volumes = $Volume->findAll(); > foreach ($volumes as $volume) { > // Create a node for the volume > $this->out(sprintf('Created Aco node: %s/%s', $root_alias, > $volume['Volume']['number'])); > $this->Aco->create(); > $row = array('parent_id' => $aco_root, 'foreign_key' => > $volume['Volume']['id'], 'model' => 'Volume', 'alias' => $volume > ['Volume']['number']); > $this->Aco->save($row); > $parent_id = $this->Aco->id; > > // Iterate all the papers > $papers = $Paper->find('all', array('conditions' => array > ('volume_id' => $volume['Volume']['id']), 'recursive' => -1)); > foreach ($papers as $paper) { > // Create a node for the paper > $this->out(sprintf('Created Aco node: %s/%s/%s', > $root_alias, $volume['Volume']['number'], $paper['Paper']['slug'])); > $this->Acl->Aco->create(); > $row = array('parent_id' => $parent_id, 'foreign_key' > => $paper['Paper']['id'], 'model' => 'Paper', 'alias' => $paper > ['Paper']['slug']); > $this->Acl->Aco->save($row); > } > } > } > ?> > > Once all the ACOs are created, I gave access to my editors and authors > like so: > > // $ cake acltool vol_perms > function vol_perms() > { > // Row level access for volumes > $this->out('Creating row-level permissions for volumes'); > $Volume = ClassRegistry::init('Volume'); > $volumes = $Volume->findAll(); > foreach ($volumes as $vol) { > $this->out(sprintf('- Entering volume number %s', $vol > ['Volume']['number'])); > $Volume->id = $vol['Volume']['id']; > foreach ($vol['User'] as $user) { > $this->out(sprintf('-- Granting access to %s', $user > ['name'])); > $User->id = $user['id']; > $this->Acl->allow($User, $Volume); > } > }} > > ?> > > Next we need to inform our models about our chosen ACO structure: > > // volume.php > function parentNode() > { > return null; > } > > // paper.php > function parentNode() > { > if (!$this->id && empty($this->data)) { > return null; > } > $data = $this->data; > if (empty($this->data)) { > $data = $this->read(); > } > if (empty($data['Paper']['volume_id'])) { > return null; > } else { > return array('Volume' => array('id' => $data['Paper'] > ['volume_id'])); > } > } > ?> > > Next, in our con
Re: 2 foreign keys to same model?
On Mar 1, 5:12 am, "sjunwan...@gmail.com" wrote: > I have the following 2 tables: > > users > assets > > each user has many assets, but any users can allow other users to > access their assets You could set up a HasAndBelongsToMany relationship between the two models. You would still need to create a third table for this kind of relationship though. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Is it possible to create sub-controllers - directorys?
Hello, is it possible to create something like this: www.domain.com/group/news/list with a path of this: /controllers/group/news_controller.php and the fitting view? thx ;) --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I'm using Notepad++ and Eclipse PDT, but without code completion for Cake's way of model loading it doesn't matter too much which you pick. But yesterday I stumbled across this video (http://www.pseudocoder.com/ archives/2009/02/25/programming-cakephp-app-with-komodo-ide/) that demonstrates the CakePHP addon for Komode Edit (free) / IDE (paid) that does just that: understanding Cake's dynamic models and providing code completion. I haven't got it working yet, but as soon as I do it's time for me to wave goodbye to all other editors. On Feb 28, 9:14 pm, adam wrote: > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Sub-controller/ directorys
Hello, I am new to cake PHP is it possible to create something like this: http://www.domain.de/group/news/:action/:id so the app path would be: /controllers/group/news_controller thx for help ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What do you develop in (ide, text editor, etc.)?
I've been using Notepad++ and Eclipse PDT, but they're essentially all the same: no code completion for Cake's way of loading models. But yesterday I stumbled across this video (http://www.pseudocoder.com/ archives/2009/02/25/programming-cakephp-app-with-komodo-ide/) that demonstrates just that in Komodo Edit (free) / IDE (paid). With a plugin it should recognize CakePHP dynamic class loading and complete all your relations and such. I haven't got it working yet, but as soon as I do it's time to wave goodbye to all other editors :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
2 foreign keys to same model?
Hi, using cake1.2, I came across a problem while setting up my database. I have a question on how to set this database up by cake's convention. I have the following 2 tables: users assets each user has many assets, but any users can allow other users to access their assets so I figure the following, a third table is needed: a table that has attributes: owner, allowed they both point to users_id, how do I make this table model in cakephp? Is there another way to do this? Because i know users_id means foreign key to table users, but how do you have 2 foreign to the same table? in short users has many assets, any users can access other user's assets as long as their id are on the allowed attribute of the owner id. both columns points to the users table thank you --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
Textmate. On Feb 28, 9:51 pm, Jorge Horacio Cué Cantú wrote: > I switched to Eclipse from Netbeans 6.5 because Netbeans does not handle > well accents in Fedora 10. > > If I could solve this only issue, I would back to Netbeans immediately. > > 2009/2/28 jitka (poLK) > > > > > I switched from Eclipse 3.4 and PDT2 to Netbeans 6.5 this week as well. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
2 foreign keys to same model?
Hi, cake1.2 here, I have a question on how to set this database up by cake's convention. I have the following 2 tables: users assets each user has many assets, but users can allow other users to access their assets so I figure the following, a third table is needed: a table that has attributes: owner, allowed they both point to users_id, how do I make this table model in cakephp? Is there another way to do this? Because i know users_id means foreign key to table users, but how do you have 2 foreign to the same table? thank you --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with various content structure
Hi. I need some help with the structure of my project: I have a table of "places" and a table of "guides". Each "guide" belongs to a "place". So far, so ok. The problem is that there are three types of "guides" which are stored in three tables. For example: table "type1": id, title, text1, text2, text3, text4, text5 table "type2": id, title, text6, text 7 table "type3": id, title, text8, text9, text10 That's why I cannot solve it this way: table "guides": id, title, description, type_id Because the IDs of the guides repeat. Now I tried to store the "type" in the table "guides": id, title, description, type, type_id But how can I find() the right information for my "guide" now? Kinda like this? $this->set('fields', $this->Guide->$type->find(all, array('conditions' => '$type.id = $type_id'))); Thank you for any help! Fox --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Bug Report] Bug in PaginatorHelper
Version: 1.2.1.8004 File: libs/view/helpers/paginator.php on line 163 Function: sortDir() if 'order' is set as a string. e.g. my pagination option is set as follows: $this->paginate['Product'] = array( 'limit' => 18, 'recursive' => 0, 'fields' => array('Product.id', 'Product.title'), 'order' => 'Product.id DESC' ); then when i call $paginator->sortDir() in my view, it returns asc. because sortDir() does not parse 'order' option of string type. solution: i'm new to php, so i dont know if it is a proper way function sortDir($model = null, $options = array()) { .. if (isset($options['direction'])) { $dir = strtolower($options['direction']); } elseif (isset($options['order']) && is_array($options['order'])) { $dir = strtolower(current($options['order'])); } elseif (isset($options['order']) && is_string($options['order'])) { if (preg_match('/(\w+)$/', $options['order'], $result) && isset ($result[1])) { $dir = strtolower($result[1]); } } .. } --~--~-~--~~~---~--~~ 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: Validate rule: multiple (CookBook -> 4.1.4.17 Multiple)
Well, first of all, your syntax is wrong. If you had read Abrar's example... Your code: var $validate = array( 'Role' => array( 'rule' => array('multiple', array('min' => 1)), 'message' => 'Please select at least one role' ) ); If you read the book pages (or Abrar's example), you'd see that it should be the following: var $validate = array( 'fieldname' => array( 'rulename' => array( // rulename can be anything you choose. 'rule' => 'ruletype', // ruletype should be the rule you're using, i.e. isUnique, notempty, email, multiple, etc. Use an array if the rule has options (such as multiple). 'message' => 'errormessage' ) ) ); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$paginator->sortDir() outputs wrong dir?
this is pagination option in my controller: $this->paginate['Product'] = array( 'limit' => 18, 'recursive' => 0, 'fields' => array('Product.id', 'Product.title', 'Product.price'), 'sort' => 'Product.id DESC' ); in my view, $paginator->sortDir() outputs asc... but if i specify /sort:id/direction:desc in the url, it outputs right desc is this a bug or something else? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HtmlHelper and Umlauts
Hello, I have an issue with the htmlHelper: If I want to insert an Image with an alternative text I use image('path/to/image.jpg', array('alt' => 'My alt text'); ?> This works fine as long as the alt text does not include any umlaut. With an '&' in it it works fine: it is translated to '&'. But a German umlaut 'ü' is not translated but alt text is empty (which seems to be a problem of htmlspecialchars with UTF-8. Any idea of a solution for this problem? --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I've been using HTML-Kit for ever!! I have to say though, over this last year it's started to show its age (2002) but still, for quick XHTML/CSS design, it works a treat. Recently I changed over to Eclipse PDT, so far I'm very impressed, although like others have said, the code completion isn't great. Perhaps I'll take a look at this Netbeans though. --~--~-~--~~~---~--~~ 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: customizing error messages from form helper
You can change the class 'error-message' to whatever you want by setting it in the options array of your $form->input call: $form->input('field', array('error' => array('class' => 'custom-error- class'))); Or you could take the automatic error out of the input div and put it on its own where you have more control: input('field', array('error' => false));?> error message here > > i would like it to hypothetically be: > > error message > here > > is this possible sanely? > > -- > View this message in > context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... > 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Media View not downloading unless I set headers
Okay, after a short distraction regarding pagination, I went in and checked both the Cake and Apache logs. The Cake error.log shows no errors. (\app\tmp\logs) There were also no errors in the apache\logs\error.log so I checked out the access.log. The response was... 127.0.0.1 - - [01/Mar/2009:17:14:07 +0100] "GET /books/view/1 HTTP/ 1.1" 200 13472 127.0.0.1 - - [01/Mar/2009:17:14:09 +0100] "GET /books/download/ test.epub HTTP/1.1" 200 3104 The Apache Docs say, regarding the "200", that; "This is the status code that the server sends back to the client. This information is very valuable, because it reveals whether the request resulted in a successful response (codes beginning in 2), a redirection (codes beginning in 3), an error caused by the client (codes beginning in 4), or an error in the server (codes beginning in 5). The full list of possible status codes can be found in the HTTP specification (RFC2616 section 10)." Does this mean that $this->set($params); in the "Media View" is not forcing the download? Any ideas on where I am going wrong on this? On Feb 26, 3:04 am, brian wrote: > Have you checked your error log? A white screen typically means a fatal error. > > On Wed, Feb 25, 2009 at 5:49 PM, Mike Cook wrote: > > > I am unable to get the Media View to force the download to start, no > > error is given other than it just lands on a blank page. Here's the > > download function in my controller; > > > function download ($id = null) { > > list($file_name, $file_ext) = split('[.]', $id); > > $this->view = 'Media'; > > $params = array( > > 'id' => $file_name . '.' . $file_ext, > > 'name' => $file_name, > > 'download' => true, > > 'extension' => 'epub', > > 'path' => 'app' . DS . 'files' . DS, > > 'mimeType', array('epub' => 'application/epub+zip' > > )); > > $this->set($params); > > } > > > Like I say, no download (I tried with an without the 'app'.DS on the > > path) but if I send the headers like in this post then it works; > > >http://groups.google.com/group/cake-php/browse_thread/thread/cf567fbb... > > > So, I replace $this->set($params) with; > > > if(!empty($id)){ > > $file = $params['path'] . $params['id']; > > $data = file_get_contents($file); > > $size = filesize($file); > > if( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER > > ['HTTP_USER_AGENT'], 'MSIE') ) { > > header('Content-Type:application/force-download'); > > } else { > > header('Content-Type:application/epub+zip'); > > header('Content-Length:' . $size); > > header('Content-disposition:attachment;filename="' . $params > > ['id'] . '"'); > > echo $data; > > } > > } else { > > $this->redirect(); > > exit(); > > } > > > I guess that Media View was implemented so we don't have to send the > > headers ourselves - or am I am wrong? > > > Does anyone have any ideas why the default Model View method is not > > working? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Form question
Hi there, I'm pretty new to CakePHP and I think this is probably a very simple problem, but I'm not sure where I am going wrong. I am working on the add view for one of my models - Model1. The model belongsTo another model (Model2), which in turn belongsTo a third model (Model3). On the add view for Model1 I'm displaying a drop-down to select its Model2, like this: echo $form->input(model2_id'); However, I also want to display a automagically populated drop-down for Model3. I've tried a few things, like: echo $form->input(Model2.model3_id'); echo $form->input(Model3.id'); The first attempt displays the correct label ('Model3') and a textbox, however I'd like a drop-down listing all Model3 records. I set the type of the input to 'select', which then produced an empty HTML select. Anyone able to point me in the right direction? Thanks, Toby --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I really like Netbeans too - before that I was using Zend Studio, but it was horribly clunky and slow. Netbeans could still be improved by it's getting there. From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Gonzalo Servat Sent: 28 February 2009 22:35 To: cake-php@googlegroups.com Subject: Re: What do you develop in (ide, text editor, etc.)? On Sat, Feb 28, 2009 at 8:06 PM, Mauricio Morales wrote: I just downloaded Netbeans for PHP 6.5 and it's great. I've been using Eclipse for a long but I think you can enjoy Netbeans (open source and works in linux, mac, windows). http://www.netbeans.org/features/php/ I second this. NetBeans for PHP 6.5 is excellent! I've stopped using Eclipse myself. - Gonzalo --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
TextMate On Mar 1, 7:39 am, Marcel wrote: > At the moment I'm still using Eclipse. But it's too slow and the code > completion is not very useful with CakePHP. A normal Texteditor would do > it's job as well. > > I'll give Netbeans a try and then probably switch to notepad++ or > something similar (what do you need more than a small file explorer and > tabs? ;) ). > > cheers > > Marcel --~--~-~--~~~---~--~~ 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: ACL and Auth with additional checking
For the archives, this is a step-by-step on how I solved the problem: Rather than controllers/Papers/view/n which becomes unwieldy given you have to create an ACO for each action, I instead created an ACO for each row in my two models. Thanks to markstory for the suggestion. I created the following ACO heirachy: Papers// This allowed me to give editors access to a volume, which automatically gives access to the papers inside. This is the beauty of ACLs. I created the ACO tree like so (using acltool, a custom cake shell component): out('Starting models sync'); $Paper = ClassRegistry::init('Paper'); $Volume = ClassRegistry::init('Volume'); // Create the root node $root_alias = 'papers'; $this->Aco->create(); $this->Aco->save(array('parent_id' => null, 'model' => null, 'alias' => $root_alias)); $aco_root = $this->Aco->id; // Iterate all the volumes $volumes = $Volume->findAll(); foreach ($volumes as $volume) { // Create a node for the volume $this->out(sprintf('Created Aco node: %s/%s', $root_alias, $volume['Volume']['number'])); $this->Aco->create(); $row = array('parent_id' => $aco_root, 'foreign_key' => $volume['Volume']['id'], 'model' => 'Volume', 'alias' => $volume ['Volume']['number']); $this->Aco->save($row); $parent_id = $this->Aco->id; // Iterate all the papers $papers = $Paper->find('all', array('conditions' => array ('volume_id' => $volume['Volume']['id']), 'recursive' => -1)); foreach ($papers as $paper) { // Create a node for the paper $this->out(sprintf('Created Aco node: %s/%s/%s', $root_alias, $volume['Volume']['number'], $paper['Paper']['slug'])); $this->Acl->Aco->create(); $row = array('parent_id' => $parent_id, 'foreign_key' => $paper['Paper']['id'], 'model' => 'Paper', 'alias' => $paper ['Paper']['slug']); $this->Acl->Aco->save($row); } } } ?> Once all the ACOs are created, I gave access to my editors and authors like so: out('Creating row-level permissions for volumes'); $Volume = ClassRegistry::init('Volume'); $volumes = $Volume->findAll(); foreach ($volumes as $vol) { $this->out(sprintf('- Entering volume number %s', $vol ['Volume']['number'])); $Volume->id = $vol['Volume']['id']; foreach ($vol['User'] as $user) { $this->out(sprintf('-- Granting access to %s', $user ['name'])); $User->id = $user['id']; $this->Acl->allow($User, $Volume); } } } ?> Next we need to inform our models about our chosen ACO structure: id && empty($this->data)) { return null; } $data = $this->data; if (empty($this->data)) { $data = $this->read(); } if (empty($data['Paper']['volume_id'])) { return null; } else { return array('Volume' => array('id' => $data['Paper'] ['volume_id'])); } } ?> Next, in our controllers that we wish to handle the row-level access we do the following: In beforeFilter, we check that they're not an admin, then we apply our Acl check. This relies on the fact that a) access is blocked to users by the 'controllers' Aco tree and b) access is granted to editors/ volumes to this controller by the 'controllers' Aco tree. Both of these constraints are enforced by Auth (with $this->Auth->authorize = 'actions'). params['pass'][0]) && $this->Auth->user ('group_id') < 4) { $aco = $this->Acl->Aco->findByModelAndForeignKey('Paper', $this->params['pass'][0]); $aro = $this->Acl->Aro->findByModelAndForeignKey('User', $this->Auth->user('id')); if (!$this->Acl->check($aro['Aro'], $aco['Aco'])) { $this->Session->setFlash($this->Auth->authError); $this->redirect(array('su' => true, 'controller' => 'papers', 'action' => 'index')); } } ?> And that's it. If anyone has any improvements or suggestions I'd love to here them. Cheers, Aidan Lister On Mar 1, 4:36 pm, Aidan Lister wrote: > Hello, > > I need to do some additional row level ACL access control for two of > my models. > > My system has the following groups: admins, editors, authors and > users. > > I'm restricting access to my controller actions using the Auth > component, via $this->Auth->authorize = 'actions'. > > At the moment, my authors have access to "controllers/Papers/view", I > need to be able to limit their access to "controllers/Papers/view/n". > Whether I use a custom query to check access to "n" or an ACL, I don't > mind, both are feasible so whichever is easier. > > Similarly, I need to control access to "controllers/Volumes/view/n" > for editors. > > Does anyone have any suggestions for achieving this? > > Thanks
Re: Tree misbehaviour
Damn, It was a 8 OSI-Layer error. :=) . There is no errors. On Feb 28, 10:54 pm, Mauricio Morales wrote: > Hi folks, > > I've got the same problem.. It's really strange because all of my code > was working in the last Beta version. > > This is my DB table: > > CREATE TABLE intracategories ( > id SERIAL PRIMARY KEY, > parent_id INT, > lft INT, > rght INT, > name VARCHAR(255), > tags VARCHAR(255), > ispublic SMALLINT, > description TEXT, > slug VARCHAR(255), > deleted INT DEFAULT 0, > deleted_date TIMESTAMP, > created TIMESTAMP, > modified TIMESTAMP, > cretedby INT, > modifiedby INT > ); > > And this is my model: > class Intracategory extends AppModel { > > var $name = 'Intracategory'; > var $actsAs = array('Tree'); > > } > > When I try to save categories with a parent it fails (it sends to me > to the form again), but if I save categories without parent always > works. There is no SQL errors when I use debug on 2. > > :S > > Somebody else with this problem in 1.2.1.8004 ? > > On Feb 25, 3:42 pm, Jon Bennett wrote: > > > Hi Mark, > > > > Can anybody see anything wrong with the file or class names below? > > > They look ok to me, just checking, you are using the Tree behaviour > > aren't you? You've got: > > > var $actsAs = array('Tree'); in your model? > > > j > > > -- > > > jon bennett > > w:http://www.jben.net/ > > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
At the moment I'm still using Eclipse. But it's too slow and the code completion is not very useful with CakePHP. A normal Texteditor would do it's job as well. I'll give Netbeans a try and then probably switch to notepad++ or something similar (what do you need more than a small file explorer and tabs? ;) ). cheers Marcel --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
Gedit :) On Feb 28, 9:14 pm, adam wrote: > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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: Complex model relationship problems
The problem is completely different. I need to use $this->SpacesUser- >find() get the Spaces which belong to a certain User (it's a HABTM relationship), using $this->find() won't help. However, Cake confuses itself and looks for the column parent_id in the table called spaces_users although the model Space was set to act as a Tree. That is the problem I'm trying to solve, sorry for confusing you :) I simply want a nested tree (the array has "children") with the spaces that are associated with a certain user through the SpacesUser model. On Mar 1, 4:26 am, mscdex wrote: > On Feb 28, 6:10 pm, Dan Soendergaard wrote: > > > No, the function is in my model so calling $this->Space->find(); > > results in Undefined property: Space::$Space. > > Sorry, I had forgotten it was a model function and not in your > controller. It should be $this->find() in the code I posted above, > instead. --~--~-~--~~~---~--~~ 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: Editing $this->data within model's custom validation method
works for me, are you sure the custom validation in executed? a nicer place for data manipulation is to put it in beforeSave ... On 1 Mrz., 11:35, Turgs wrote: > Hello > > In cake 1.2, I have a custom validation method. > > Within this method, if a certain condition is met, I want to force the > value of $this->data['Site']['name'] to 'test' simply by > >data['Site']['name'] = 'test'; ?>. > > My problem is the value of $this->data['Site']['name'] doesn't change. > Is it possible to change the value like this? > > Thanks > Turgs --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
I am using dreamweaver for coding! I've tried netBeans 7.0 for php and I love some of the features I am missing from DW, but I still can't move from DW to NB... What I love in DW is the great support for ftp and cvs options that lack in NB... or it is not that good (Specially ftp) + some other features... In NB I love code refactoring and my own code/snippets templates (that were already in homesite but somehow removed from DW) and what I miss in NB is better support for js and css.. DW has great support + I miss in both support for cake :) On Feb 28, 9:14 pm, adam wrote: > I'm using Eclipse with PDT, but Dreamweaver for making layouts. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Editing $this->data within model's custom validation method
Hello In cake 1.2, I have a custom validation method. Within this method, if a certain condition is met, I want to force the value of $this->data['Site']['name'] to 'test' simply by data['Site']['name'] = 'test'; ?>. My problem is the value of $this->data['Site']['name'] doesn't change. Is it possible to change the value like this? Thanks Turgs --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
Tried using Netbeans et al but not got into it big time yet, so still use Notepadd++ which is an excellent text editor. --~--~-~--~~~---~--~~ 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: What do you develop in (ide, text editor, etc.)?
Does the code completion works well with netbeans? I'm currently using Eclipse, and it's completion is not great.. for i period i used to work with Zend IDE ..and it was definitively great..but not free. Does anybody is using Aptana with cakePHP ? bye, Andrea On Feb 28, 11:34 pm, Gonzalo Servat wrote: > On Sat, Feb 28, 2009 at 8:06 PM, Mauricio Morales wrote: > > > > > I just downloaded Netbeans for PHP 6.5 and it's great. I've been > > using Eclipse for a long but I think you can enjoy Netbeans (open > > source and works in linux, mac, windows). > > >http://www.netbeans.org/features/php/ > > I second this. NetBeans for PHP 6.5 is excellent! I've stopped using Eclipse > myself. > > - Gonzalo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---