Re: Capture webcam stream from client and upload it as a flash video to server
b logica is right. I have been using CakePHP and AMFPHP together a lot with no problems at all. So using that to build the server-logic for your application will work a treat. Personally I find it a LOT better than any xml, web- service connection for building Flash-applications. I also agree with b logica on that your main technical areas to work out are related to the Red5 which is something completely seperate. I hear from some old colleges from the University here that Red5 works great in their projects. What you want is to find good ways of integrating Red5 with your Cake/Flash application. On Jan 16, 3:07 am, rufus <[EMAIL PROTECTED]> wrote: > Hi. > Is it possible to get this in CakePHP? I think to use Red5 > (osflash.org/red5) as a flash server, CakePHP, AMFPHP. I'd like to > build something like Youtube Quick Upload. > Has anyone got anything similar using these tools? > Regards > rufus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: model insert or save?
$this->create(); $order_product_result = $this->save($order_product); On Jan 16, 3:44 am, "何帅" <[EMAIL PROTECTED]> wrote: > class OrderProduct extends AppModel { >var $name = 'OrderProduct'; >var $useTable = 'orders_products'; >var $primaryKey = 'orders_products_id'; > >function generate_order_product_record($contents, $order_id) >{ > foreach ($contents as $product){ > ///var_dump($product); > $order_product['OrderProduct']['orders_id'] = $order_id; > $order_product['OrderProduct']['products_id'] = > $product['id']; > $order_product['OrderProduct']['products_model'] = > $product['model']; > $order_product['OrderProduct']['products_name'] = > $product['name']; > $order_product['OrderProduct']['products_price'] = > $product['price']; > $order_product['OrderProduct']['final_price'] = > $product['price']; > $order_product['OrderProduct']['products_tax'] = 0.00; > $order_product['OrderProduct']['products_quantity'] = > $product['quantity']; > var_dump($order_product); > $order_product_result = $this->save($order_product); > var_dump($this->getLastInsertId()); > } >} > > } > > $contents = array( > 1 => > array > 'id' => int 8891 > 'name' => string 'testtetet' (length=9) > 'model' => string 'mv0blu1024mp092' (length=15) > 'image' => string 'ux_mv0blu1024mp092_ux_' (length=22) > 'price' => float 1 > 'quantity' => int 5 > 'weight' => float 0.3 > 2 => > array > 'id' => int 5614 > 'name' => string '1GB MICRO SD MEMORY CARD TransFlash TF' (length=39) > 'model' => string 'a07030700ux0005' (length=15) > 'image' => string 'ux_a07030700ux0005_ux_' (length=22) > 'price' => float 15.99 > 'quantity' => int 1 > 'weight' => float 0.04 > ) > > $this->OrderProduct->generate_order_product_record($contents, '123') > > why first sql statement is insert,second is update,i want to all is insert. > ple ase help me! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: no script tag but javascript is working
On Jan 15, 2008 9:56 PM, Julien <[EMAIL PROTECTED]> wrote: > > Hi, I'm very new to cake. > > I'm currently doing the blog tutorial (http://manual.cakephp.org/ > appendix/blog_tutorial). And I've noticed that in the index view there > is no
Re: Auth in 1.2
Oooohh, that's something I forgot to put in my tutorial! The session messages for Auth aren't written to Message.flash, it's to Message.auth... This is what you'd need in your Layout file: if ($session->check('Message.flash')): $session->flash(); endif; if ($session->check('Message.auth')): $session->flash('auth'); endif; Happy Baking! -- Kevin Lloyd 3HN Designs http://www.3HNDesigns.com/ (214) 473-4207 On Jan 15, 2008 7:51 PM, martinp <[EMAIL PROTECTED]> wrote: > > Thanks all. I stripped it all away (as suggested) and started from > scratch and got it working. The problem with error messages seemed to > be twofold. Firstly that logoutRedirect was actually causing a > redirection on login, overriding loginRedirect. Strange. > > Also, I was incorrectly using loginError, assuming that once you set > that variable it would automatically render on an error. It seems you > have to manually call it using something like $this->Session- > >setFlash($this->Auth->loginError); > > Thanks again. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: links problem
On Jan 15, 2008 10:08 PM, Wam Banger <[EMAIL PROTECTED]> wrote: > i would like the parameters to be hidden from the url (instead of haivng > localhost/controller/action/param1/param2/etc, i would just have > localhost/controller/action) and the parameters would be implemented as a > hidden text. > > I wanted to know if in the controller I would be able to tell which link a > user clicked on? Or is this just a javascript issue? Well, if the controller is going to do anything it'll need params passed to it. Do you mean you want to pass the params as the value of a hidden form input? Off the top of my head ... have some javascript grab all links of a certain class (or whatever), parse out the bits you want to hide, add a form with a hidden field with that value, replace the link's href value with the shortened URL, and add an onclick handler to the link that submits the relevant form and returns false on the link click. All seems a bit odd to me. What will your users think when they see that all the links point to the same path when they hover over them? ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Stopping Contact Form Injection?
Use the V1.2 email component it has so far proved to be email header injection safe and it does so automagically. That said, if i am not mistaken PHPMailier also has a method for sanitizing headers HTH Tarique On Jan 16, 2008 8:59 AM, squidliberty <[EMAIL PROTECTED]> wrote: > > I have reason to believe that my contact form is being used to send > bulk spam via an injection exploit. I'm using the PHPMailer component > outlined at > http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer. > > Can anyone tell me whether or not a simple cleanArray() is sufficient > sanitization for posted data? My headers are all hard-coded, so > everything submitted is going into the email body. > > Any advice would be appreciated! > > > -- = 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 "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Stopping Contact Form Injection?
One trick is not cakePHP related, but you can check to be certain the request came from a page or domain that hosts the form. I've done that in the past and had no problems. You can also pass to the form a key that you validate prior to sending the mail. Again, non-cakePHP related, but definitely will stop spammers. - Keith On Jan 15, 10:29 pm, squidliberty <[EMAIL PROTECTED]> wrote: > I have reason to believe that my contact form is being used to send > bulk spam via an injection exploit. I'm using the PHPMailer component > outlined > athttp://bakery.cakephp.org/articles/view/sending-email-with-phpmailer. > > Can anyone tell me whether or not a simple cleanArray() is sufficient > sanitization for posted data? My headers are all hard-coded, so > everything submitted is going into the email body. > > Any advice would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Stopping Contact Form Injection?
I have reason to believe that my contact form is being used to send bulk spam via an injection exploit. I'm using the PHPMailer component outlined at http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer. Can anyone tell me whether or not a simple cleanArray() is sufficient sanitization for posted data? My headers are all hard-coded, so everything submitted is going into the email body. Any advice would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
no script tag but javascript is working
Hi, I'm very new to cake. I'm currently doing the blog tutorial (http://manual.cakephp.org/ appendix/blog_tutorial). And I've noticed that in the index view there is no
Re: displaying data in view
in controller $this->set('Phones, $Phones); in view ... 2008/1/16, bob <[EMAIL PROTECTED]>: > > I have a model PhoneNumbers. In my controller, I have this code: > > $Phones = $this->PhoneNumber->findAllByUserId($username); > > In my view, I would like each phone number to be displayed in a > textbox (one phone number per textbox). > > How would I do this if I used $this->data['phones'] = $Phones > > Thanks > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
model insert or save?
class OrderProduct extends AppModel { var $name = 'OrderProduct'; var $useTable = 'orders_products'; var $primaryKey = 'orders_products_id'; function generate_order_product_record($contents, $order_id) { foreach ($contents as $product){ ///var_dump($product); $order_product['OrderProduct']['orders_id'] = $order_id; $order_product['OrderProduct']['products_id'] = $product['id']; $order_product['OrderProduct']['products_model'] = $product['model']; $order_product['OrderProduct']['products_name'] = $product['name']; $order_product['OrderProduct']['products_price'] = $product['price']; $order_product['OrderProduct']['final_price'] = $product['price']; $order_product['OrderProduct']['products_tax'] = 0.00; $order_product['OrderProduct']['products_quantity'] = $product['quantity']; var_dump($order_product); $order_product_result = $this->save($order_product); var_dump($this->getLastInsertId()); } } } $contents = array( 1 => array 'id' => int 8891 'name' => string 'testtetet' (length=9) 'model' => string 'mv0blu1024mp092' (length=15) 'image' => string 'ux_mv0blu1024mp092_ux_' (length=22) 'price' => float 1 'quantity' => int 5 'weight' => float 0.3 2 => array 'id' => int 5614 'name' => string '1GB MICRO SD MEMORY CARD TransFlash TF' (length=39) 'model' => string 'a07030700ux0005' (length=15) 'image' => string 'ux_a07030700ux0005_ux_' (length=22) 'price' => float 15.99 'quantity' => int 1 'weight' => float 0.04 ) $this->OrderProduct->generate_order_product_record($contents, '123') why first sql statement is insert,second is update,i want to all is insert. please help me! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: links problem2
test On Jan 15, 2008 7:08 PM, Wam Banger <[EMAIL PROTECTED]> wrote: > i would like the parameters to be hidden from the url (instead of haivng > localhost/controller/action/param1/param2/etc, i would just have > localhost/controller/action) and the parameters would be implemented as a > hidden text. > > I wanted to know if in the controller I would be able to tell which link a > user clicked on? Or is this just a javascript issue? > > Thanks > > On Jan 15, 2008 5:48 PM, b logica <[EMAIL PROTECTED]> wrote: > > > > > On Jan 15, 2008 8:04 PM, bob <[EMAIL PROTECTED]> wrote: > > > > > > in my view i have many links. how do i tell from my controller which > > > link a user clicked on? > > > > > > i do not want to use the URL (ie localhost/blah/ > > > this_link_was_clicked_on). > > > > > > Anybody know how I could achieve this using hidden parameters? > > > > > > > Assuming each link points to a unique resource/path, couldn't you > > establish this there? Or is this a javascript question? > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: links problem
i would like the parameters to be hidden from the url (instead of haivng localhost/controller/action/param1/param2/etc, i would just have localhost/controller/action) and the parameters would be implemented as a hidden text. I wanted to know if in the controller I would be able to tell which link a user clicked on? Or is this just a javascript issue? Thanks On Jan 15, 2008 5:48 PM, b logica <[EMAIL PROTECTED]> wrote: > > On Jan 15, 2008 8:04 PM, bob <[EMAIL PROTECTED]> wrote: > > > > in my view i have many links. how do i tell from my controller which > > link a user clicked on? > > > > i do not want to use the URL (ie localhost/blah/ > > this_link_was_clicked_on). > > > > Anybody know how I could achieve this using hidden parameters? > > > > Assuming each link points to a unique resource/path, couldn't you > establish this there? Or is this a javascript question? > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
displaying data in view
I have a model PhoneNumbers. In my controller, I have this code: $Phones = $this->PhoneNumber->findAllByUserId($username); In my view, I would like each phone number to be displayed in a textbox (one phone number per textbox). How would I do this if I used $this->data['phones'] = $Phones Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Capture webcam stream from client and upload it as a flash video to server
On Jan 15, 2008 9:07 PM, rufus <[EMAIL PROTECTED]> wrote: > > Hi. > Is it possible to get this in CakePHP? I think to use Red5 > (osflash.org/red5) as a flash server, CakePHP, AMFPHP. I'd like to > build something like Youtube Quick Upload. > Has anyone got anything similar using these tools? > Regards > rufus > I suggest you get your flash server and client capture working before trying to integrate it into a Cake app. Neither of those things has anything specifically to do with Cake. Correct me if i'm wrong, of course. I may have missed that chapter in the Cake manual. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: javascript declarations
On Jan 15, 2008 9:29 PM, hydra12 <[EMAIL PROTECTED]> wrote: > > Try this instead: > > if(isset($javascript)) > { > echo ($javascript->link('prototype.js')); > echo ($javascript->link('scriptaculous.js')); > } > ?> > > This is the normal way to write an if statement in php. I don't know > if the other way will work or not. > That's not the problem. See: http://www.php.net/manual/en/control-structures.alternative-syntax.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: javascript declarations
Try this instead: link('prototype.js')); echo ($javascript->link('scriptaculous.js')); } ?> This is the normal way to write an if statement in php. I don't know if the other way will work or not. hydra12 On Jan 15, 7:59 pm, "b logica" <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 6:21 PM, top123 <[EMAIL PROTECTED]> wrote: > > > > > I'm try this way for access my javascripts file : > > > > > if(isset($javascript)): > > echo ($javascript->link('prototype.js')); > > echo ($javascript->link('scriptaculous.js')); > > . > > endif; > > ?> > > > > but I got something error to include the javascript file to my CAKE, > > my FireBug (Mozzila) said "unterminated.something", > > As a guess, the "unterminated.something" suggests that you're > missing a quote somewhere in your JS. > > You'd probably do better to paste the exact error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Capture webcam stream from client and upload it as a flash video to server
Hi. Is it possible to get this in CakePHP? I think to use Red5 (osflash.org/red5) as a flash server, CakePHP, AMFPHP. I'd like to build something like Youtube Quick Upload. Has anyone got anything similar using these tools? Regards rufus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
Thank you answer form me, i try insert "$this->cacheQueries = false; " select sql statement before, the results remain the same,the code below. '$type = "ORD" $today = date("Ym"); $sql = "select curType,curId from orders_sequence where curDate='$today' and type='$type'"; $row_1 = $this->findBySql($sql); $sql = "update orders_sequence set curId = curId + 1 where curDate='$today' and type='$type'"; $this->execute($sql); $this->cacheQueries = false; $sql = "select curType,curId from orders_sequence where curDate='$today' and type='$type'"; $row_2 = $this->findBySql($sql); 2008/1/16, Takuo Shiono <[EMAIL PROTECTED]>: > > Hi, > > I think this is the effect of cache in Model class. > Please insert the line below before execute query. This disable cache > functionalities in Model class. > > $this->cacheQueries = false; > > Best Wishes, > > Takuo Shiono > > On Jan 15, 5:46pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > '$type = "ORD" > > $today = date("Ym"); > > $sql = "select curType,curId from orders_sequence where > > curDate='$today' and type='$type'"; > > $row_1 = $this->findBySql($sql); > > > > $sql = "update orders_sequence set curId = curId + 1 where > > curDate='$today' and type='$type'"; > > $this->execute($sql); > > > > $sql = "select curType,curId from orders_sequence where > > curDate='$today' and type='$type'"; > > $row_2 = $this->findBySql($sql); > > > > $row1 == $row2 ? why ?? please help me,thanks > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best practice for multiple checkboxes/radios/selects
On Jan 15, 2008 12:33 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a table of data and need to allow the user to choose certain > records to authorise by either checking a checkbox or radio, select > etc but I am struggling with the best way to show this data given that > Cake form element expects a single model and field. I'm using 1.2 and > have hunted high and low for an example, helper or tutorial... > > Getting the data back and processing it isn't a problem it's just > working out the right way to reference the model/field name in the > $form->select or whatever call... > I'm working on the same thing right now. See these links: http://bakery.cakephp.org/articles/view/create-multiple-checkboxes-instead-of-a-multiple-select-in-your-views http://www.monkeydispenser.com/2007/07/03/using-checkboxes-in-cakephp/ I haven't gotten it to work yet, though, because i'm struggling with multiple checkboxes and a tableless model. Expect a cry for help to the list any time now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
fread errors with 1.2 beta and php 4.3.2
I thought I'd try updating my cake code to 1.2 beta from alpha before rolling out my new application, however I ran into a major snag. Now when I load my site I get a lot of fread/fwrite/fclose errors, similar to the following... Warning: fread(): 18 is not a valid stream resource in /web/cake/libs/ file.php on line 170 Warning: fclose(): 18 is not a valid stream resource in /web/cake/libs/ file.php on line 266 A fresh install yields the same errors. I'm running PHP 4.3.2, which according to the temp docs is the bare requirement, but I wouldn't be suprised if I'm the first to actually test this. It looks like the cake/lib/file.php got a major overhaul with some more OO-like code that's probably freaking out my old version of PHP. Can anyone confirm this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Postgres and Build 1.2.0.6311
On Jan 14, 2008 9:43 PM, pixelaté <[EMAIL PROTECTED]> wrote: > > Hey, first up; I think Cake is an awesome framework. It makes website > development extremely easy! Thanks for the product and keep up the > good work! > > I was using the an earlier build of cake and everything was working > relatively well - I did have an issue where I have to restart apache > every 6 hours because the server stops responding but I've been > ignoring that hoping that future releases will fix it. > > Anyways, I decided up upgrade and had mammoth problems with postgres. > > Long story short, I had a problem with postgres updates and deletes. I > found cryptic bug messages on using test prefixes and other things > which I have no idea what they mean. Instead I just went and upgraded > my dbo_source.php and dbo_postgres.php from the svn repository. That > seemed to fix most of my issues. > Ian, thanks for the heads-up. I've got the same build but hadn't yet done any saving (was just getting to that). I'll hit the SVN server. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: javascript declarations
On Jan 14, 2008 6:21 PM, top123 <[EMAIL PROTECTED]> wrote: > > > I'm try this way for access my javascripts file : > > if(isset($javascript)): > echo ($javascript->link('prototype.js')); > echo ($javascript->link('scriptaculous.js')); > . > endif; > ?> > > but I got something error to include the javascript file to my CAKE, > my FireBug (Mozzila) said "unterminated.something", As a guess, the "unterminated.something" suggests that you're missing a quote somewhere in your JS. You'd probably do better to paste the exact error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth in 1.2
Thanks all. I stripped it all away (as suggested) and started from scratch and got it working. The problem with error messages seemed to be twofold. Firstly that logoutRedirect was actually causing a redirection on login, overriding loginRedirect. Strange. Also, I was incorrectly using loginError, assuming that once you set that variable it would automatically render on an error. It seems you have to manually call it using something like $this->Session- >setFlash($this->Auth->loginError); Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: best way to do calculated fields in afterFind
On Jan 15, 2008 2:47 PM, Tim W <[EMAIL PROTECTED]> wrote: > > Hi all, > > Is this the best way to create a calculated field in a model object? > It works perfectly, but having to merge an array doesn't seem ideal, > and it's not OO at all. > > function afterFind($results) > { > for ($i=0; $i < count($results); $i++) { > $lens = $results[$i]['Lens']; > $description = $lens['wide_zoom'] . '-' . > $lens['long_zoom']; > $lens = array_merge($lens, array('description' => > $description)); > $results[$i]['Lens'] = $lens; > } > > return $results; > } > You can avoid creating the tmp var and merging by adding a new key to the array directly: $results[$i]['Lens']['description'] = $results[$i]['Lens']['wide_zoom'] . '-' . $results[$i]['Lens']['long_zoom']; Or concatenate the two fields with SQL as a third column. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Basic association question, extending models...
I am just trying to get some clarity on associations. I've done a little object orientated programming before and in cake it seems a little different in regard to extending objects. In my case I have a table for people, clients and suppliers. Obviously people contains basic info like name, address, phone etc. Client would contain company name, discount rate etc. Supplier would contain other supplier related info. In the past I would build a model so that the 'client' extends the 'person' class. In cake I understand you use 'belongsTo'. So I would setup my client model with a belongsTo association (to person). So when I load up the client I can access all their 'person' (table) information as well? The only different being rather than getting the address of a client this way $data['client']['address'], I get it $data['person'] ['address']. Is this correct and is this the best method for 'extending' classes (using the belongsTo association). Thanks for any advice I may have missed here. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Installation/htaccess problems
Hi all, Having some difficulty getting off the ground here with the cake blog tutorial, wondering if maybe someone might have an idea. I have installed cakephp at http://localhost/~reuben/cakeblog/ I modified the root .htaccess file and added 'RewriteBase /~reuben/ cakeblog/' and was then able to load the default root page just fine. But going to any directory underneath the cakeblog root (for example, http://mission/~reuben/cakeblog/posts as per the blog tutorial), I am getting a 404. Looking at the httpd log, each of these requests is being rewritten to '/Library/WebServer/Documents/Users' .. (using a Mac here, and the default document root is set to /Library/WebServer/ Documents) Not having problems with anything else in ~reuben/ so I am presuming this is an issue with that htaccess file Thanks for any advice! Reuben --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
version is 1.1.19.6305, in cake/libs/model/dbo/dbo_mysql.php 133 line,echo exec sql statement, find """$sql = "select curType,curId from orders_sequence where curDate='$today' and type='$type'"; $row_2 = $this->findBySql($sql); "" no run. it 's sql cache?? run same sql statement,return same value? On Jan 15, 8:52 pm, "Olexandr Melnyk" <[EMAIL PROTECTED]> wrote: > Is curId a either a primary or a unique key? > > On 1/15/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > '$type = "ORD" > > $today = date("Ym"); > > $sql = "select curType,curId from orders_sequence where > > curDate='$today' and type='$type'"; > > $row_1 = $this->findBySql($sql); > > > $sql = "update orders_sequence set curId = curId + 1 where > > curDate='$today' and type='$type'"; > > $this->execute($sql); > > > $sql = "select curType,curId from orders_sequence where > > curDate='$today' and type='$type'"; > > $row_2 = $this->findBySql($sql); > > > $row1 == $row2 ? why ?? please help me,thanks > > -- > Sincerely yours, > Olexandr Melnykhttp://omelnyk.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: FPDF and FPDI with CakePHP
Hello Gianluca, I am also using FPDF with cakePHP. I think the problem is that the program output the white spaces in the layout template before FPDF outputs HTTP headers for pdf file. Please try: $this->layout = null; If this does not work, there is another solution. You do not need to use view. You create a component for generating pdf. (PdfComponent) // app/controllers/components/pdf.php class PdfComponent extends Object { function generate() { $pdf = new PdfGenerator(); /// code for generating pdf $pdf->Output(); // This function output HTTP protocol headers. } } The controller use this component and do not use view. TestController extends AppConteroller { var $components = array('Pdf'); function generate() { $this->Pdf->generate(); exit; // Do not show the content of view. } } This works fine for me. Best Wishes, Takuo Shiono --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: safe mode error
I'm on a shared host too. in configure.php $path = rtrim($path, DS); if ( $path=='/usr/local/lib/php') continue;//for SAFE MODE Restriction if ( $path=='.' || in_array(realpath($path), $used)) { continue; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session db - format
Problem is that the string doesn't come in a format unserialize likes. You're given "Config|%CONFIGSTRING%User|%USERSTRING%". You can unserialize %CONFIGSTRING% and %USERSTRING%, but you need to extract them first. Is there a preferred way of doing this? On Jan 14, 12:38 am, AZEL <[EMAIL PROTECTED]> wrote: > u need unserilaize it. > > $array = unserialize('a:3:{s:9:"userAgent";s: > 32:"c8cea9c1eac13b66616ef07d94528a70";s: > 4:"time";i:1199123052;s:4:"rand";i:1343036056;}Message|a:0:{}ref|s: > 12:"/users/index";ref1|s:13:"/users/login/";User|a:4:{s:2:"id";s: > 1:"2";s:8:"username";s:2:"af";s:5:"email";s:22:"[EMAIL PROTECTED]";s: > 10:"last_login";s:19:"2007-08-18 02:37:00";}UserProfile|a:10:{s: > 9:"firstname";s:9:"Alexander";s:8:"lastname";s:4:"sd";s:3:"lkr";s: > 1:"A";s:3:"zip";s:5:"86156";s:4:"city";s:8:"Essen";s: > 10:"country_id";s: > 1:"1";s:4:"tel1";s:14:"016 17";s:4:"tel2";s:0:"";s:3:"www";s: > 17:"test.de";s:6:"public";s:1:"1";}'); > > use like that > $array['userAgent'] // c8cea9c1eac13b66616ef07d94528a70 > or > $array['time'] // 1199123052 > > On Jan 13, 7:29 pm, cronet <[EMAIL PROTECTED]> wrote: > > > Hi, > > > it's more a general question, not directly cake related. > > > If I store a Session in my db, the "data" field looks like: > > > Config|a:3:{s:9:"userAgent";s:32:"c8cea9c1eac13b66616ef07d94528a70";s: > > 4:"time";i:1199123052;s:4:"rand";i:1343036056;}Message|a:0:{}ref|s: > > 12:"/users/index";ref1|s:13:"/users/login/";User|a:4:{s:2:"id";s: > > 1:"2";s:8:"username";s:2:"af";s:5:"email";s:22:"[EMAIL PROTECTED]";s: > > 10:"last_login";s:19:"2007-08-18 02:37:00";}UserProfile|a:10:{s: > > 9:"firstname";s:9:"Alexander";s:8:"lastname";s:4:"sd";s:3:"lkr";s: > > 1:"A";s:3:"zip";s:5:"86156";s:4:"city";s:8:"Essen";s:10:"country_id";s: > > 1:"1";s:4:"tel1";s:14:"016 17";s:4:"tel2";s:0:"";s:3:"www";s: > > 17:"test.de";s:6:"public";s:1:"1";} > > > I would like to know, how this is format called ?! Need to debug a > > website which has stored some data which looks exactly this way. I > > don't know how to extract data without complicated find and strip > > actions. Perhaps there's smarter way I don't know! > > > Regards, > > Alexander --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
Hi, I think this is the effect of cache in Model class. Please insert the line below before execute query. This disable cache functionalities in Model class. $this->cacheQueries = false; Best Wishes, Takuo Shiono [EMAIL PROTECTED] wrote: > '$type = "ORD" > $today = date("Ym"); > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_1 = $this->findBySql($sql); > > > $sql = "update orders_sequence set curId = curId + 1 where > curDate='$today' and type='$type'"; > $this->execute($sql); > > > > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_2 = $this->findBySql($sql); > > > $row1 == $row2 ? why ?? please help me,thanks > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
Hi, I think this is the effect of cache in Model class. Please insert the line below before execute query. This disable cache functionalities in Model class. $this->cacheQueries = false; Best Wishes, Takuo Shiono On Jan 15, 5:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > '$type = "ORD" > $today = date("Ym"); > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_1 = $this->findBySql($sql); > > $sql = "update orders_sequence set curId = curId + 1 where > curDate='$today' and type='$type'"; > $this->execute($sql); > > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_2 = $this->findBySql($sql); > > $row1 == $row2 ? why ?? please help me,thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: links problem
On Jan 15, 2008 8:04 PM, bob <[EMAIL PROTECTED]> wrote: > > in my view i have many links. how do i tell from my controller which > link a user clicked on? > > i do not want to use the URL (ie localhost/blah/ > this_link_was_clicked_on). > > Anybody know how I could achieve this using hidden parameters? > Assuming each link points to a unique resource/path, couldn't you establish this there? Or is this a javascript question? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
links problem
in my view i have many links. how do i tell from my controller which link a user clicked on? i do not want to use the URL (ie localhost/blah/ this_link_was_clicked_on). Anybody know how I could achieve this using hidden parameters? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: saveAll Validates
anyone? On Jan 14, 6:08 pm, releod <[EMAIL PROTECTED]> wrote: > Hello, I am wondering how to perform proper validation on asaveAllin > the latest CakePHP 1.2 > > I can only ever get the validations from the parent model, I cannot > seem to find any validations for the associated model when debugging > the model object. > > I would love to see some examples of how to get this working, or even > a single example.. > > I do assumesaveAllhas the ability to perform validations on the > associated models right? Any insight to this would be really helpful! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Inserting multiple records into the same model from one form
I want to insert multiple records into a single model using a single form. So let's say you want a form that collects 30 names and then inserts 30 records into a "people" model/table. In standard code I would uniquely name all form elements and then use a loop to dump them in to the table. How can I do this in Cake? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: modified_by , created_by ...
No "Cake Approved" method at least. I have my own solution to this, I made the my auth component a global and have a function to access the current logged in user data from anywhere (view, helper, or model). I know many would frown on this, but it has made developement very easy for me. I care about that more than MVC compliance. It is still PHP we are using so I'll use it's constructs when they best suite me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cake Baking 'blob' column type
I'm working through the IBM documentation and found that when they instruct to bake the view which contains a column type of blob in the model bake just ignores it. I can CERTAINLY understand why, and have no idea why you'd want blob over text or longtext for a description, but I just wanted to make sure that: - Cake bake view is supposed to ignore blob column types and let you manually add it to the view later. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: modified_by , created_by ...
Thanks ! The link gives a nice pragmatic solution (although not fully MVC-compliant:) So, there's no way to access a controller in the model, right ? Spark On Jan 15, 2008 4:36 PM, rtconner <[EMAIL PROTECTED]> wrote: > > This blog post might be worth your time. > http://www.ad7six.com/MiBlog/TrackWhoMakesDBChanges > > > On Jan 15, 12:21 pm, "DJ Spark" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Every model in my project does have a 'created_by' and 'modified_by' > > field, storing some user ID. > > Currently, I'm using a controller beforeFilter to populate a > > temporary Model with the $this->Auth->user() , only if $this->data is > > full of something, and a beforeSave in the Model, to associate that > > temporary fields to the model being saved. > > Actually, I don't quite like this approach, but couldn't think of > > something better, since a Model can't access the Auth component. Or > > could it ? > > Is there a better way to write it ? > > > > thanks > > Spark > > > > -- > > [livesets]http://djspark.com.br/ > > [web]http://sydi.net > > [filmes]http://melhoresfilmes.com.br > > > -- [livesets] http://djspark.com.br/ [web] http://sydi.net [filmes] http://melhoresfilmes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
best way to do calculated fields in afterFind
Hi all, Is this the best way to create a calculated field in a model object? It works perfectly, but having to merge an array doesn't seem ideal, and it's not OO at all. function afterFind($results) { for ($i=0; $i < count($results); $i++) { $lens = $results[$i]['Lens']; $description = $lens['wide_zoom'] . '-' . $lens['long_zoom']; $lens = array_merge($lens, array('description' => $description)); $results[$i]['Lens'] = $lens; } return $results; } Many thanks Tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: modified_by , created_by ...
This blog post might be worth your time. http://www.ad7six.com/MiBlog/TrackWhoMakesDBChanges On Jan 15, 12:21 pm, "DJ Spark" <[EMAIL PROTECTED]> wrote: > Hi, > > Every model in my project does have a 'created_by' and 'modified_by' > field, storing some user ID. > Currently, I'm using a controller beforeFilter to populate a > temporary Model with the $this->Auth->user() , only if $this->data is > full of something, and a beforeSave in the Model, to associate that > temporary fields to the model being saved. > Actually, I don't quite like this approach, but couldn't think of > something better, since a Model can't access the Auth component. Or > could it ? > Is there a better way to write it ? > > thanks > Spark > > -- > [livesets]http://djspark.com.br/ > [web]http://sydi.net > [filmes]http://melhoresfilmes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
modified_by , created_by ...
Hi, Every model in my project does have a 'created_by' and 'modified_by' field, storing some user ID. Currently, I'm using a controller beforeFilter to populate a temporary Model with the $this->Auth->user() , only if $this->data is full of something, and a beforeSave in the Model, to associate that temporary fields to the model being saved. Actually, I don't quite like this approach, but couldn't think of something better, since a Model can't access the Auth component. Or could it ? Is there a better way to write it ? thanks Spark -- [livesets] http://djspark.com.br/ [web] http://sydi.net [filmes] http://melhoresfilmes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: FPDF and FPDI with CakePHP
I would look for trailing or leading spaces or returns in your helpers, views, components, models or other files. This is very often the culprit Sam D On Jan 15, 2008 9:58 AM, Gianluca Gentile <[EMAIL PROTECTED]> wrote: > > Hello, > I followed this how-to: > > http://bakery.cakephp.org/articles/view/pdf-helper-using-fpdf > > and this post: > > http://groups.google.com/group/cake-php/browse_thread/thread/db72d5a02d700417/f04bb413117f6027?lnk=gst&q=fpdf#f04bb413117f6027 > > with my customization for work with FPDI. > > In vendors directory are present: > > (D) - FPDI > => (D) - decoders > => (D) - font > => (F) - fpdf_tpl.php > => (F) - fpdf.php > => (F) - fpdi_pdf_parser.php > => (F) - fpdi.php > => (F) - pdf_context.php > => (F) - pdf_parser.php > => (F) - wrapper_functions.php > > (D) = direcoty - (F) = file > > My app/view/helpers/fpdi.php: > > vendor('fpdi/fpdi'); > > if (!defined('PARAGRAPH_STRING')) define('PARAGRAPH_STRING', '~~~'); > > class fpdiHelper extends FPDI { > > var $helpers = array(); > > function setup ($orientation='P',$unit='mm',$format='A4') { > $this->FPDI($orientation, $unit, $format); > } > > function fpdfOutput ($name = 'page.pdf', $destination = 'D') { > return $this->Output($name, $destination); > } > } > ?> > > My app/views/layouts/pdf.thtml: > > echo $content_for_layout; > ?> > > My app/views/sale_document/viewdocument.thtml: > > $pagecount = $fpdi->setSourceFile("proforma.pdf"); > $tplidx = $fpdi->ImportPage(1); > $fpdi->AddPage(); > $fpdi->SetFont('Arial','B',16); > $fpdi->Cell(40,10,$data); > $fpdi->fpdfOutput(); > ?> > > My app/controllers/sale_documents_controller.php: > > > function viewdocument($type=1,$id_comanda) { > $this->layout = 'pdf'; > switch ($type) { > default: > $this->set('data','Comanda ID '.$id_comanda); > break; > } > $this->render(); > } > > ?> > > My problem is that the output of this url: > > http://127.0.0.1/cake/sale_documents/viewdocument/4/2 > > is "FPDF error: Some data has already been output to browser, can't > send PDF file" > > Why??? > > Thanks, > Gianluca > > p.s.: sorry for my english! :( > > > > -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
FPDF and FPDI with CakePHP
Hello, I followed this how-to: http://bakery.cakephp.org/articles/view/pdf-helper-using-fpdf and this post: http://groups.google.com/group/cake-php/browse_thread/thread/db72d5a02d700417/f04bb413117f6027?lnk=gst&q=fpdf#f04bb413117f6027 with my customization for work with FPDI. In vendors directory are present: (D) - FPDI => (D) - decoders => (D) - font => (F) - fpdf_tpl.php => (F) - fpdf.php => (F) - fpdi_pdf_parser.php => (F) - fpdi.php => (F) - pdf_context.php => (F) - pdf_parser.php => (F) - wrapper_functions.php (D) = direcoty - (F) = file My app/view/helpers/fpdi.php: FPDI($orientation, $unit, $format); } function fpdfOutput ($name = 'page.pdf', $destination = 'D') { return $this->Output($name, $destination); } } ?> My app/views/layouts/pdf.thtml: My app/views/sale_document/viewdocument.thtml: setSourceFile("proforma.pdf"); $tplidx = $fpdi->ImportPage(1); $fpdi->AddPage(); $fpdi->SetFont('Arial','B',16); $fpdi->Cell(40,10,$data); $fpdi->fpdfOutput(); ?> My app/controllers/sale_documents_controller.php: layout = 'pdf'; switch ($type) { default: $this->set('data','Comanda ID '.$id_comanda); break; } $this->render(); } ?> My problem is that the output of this url: http://127.0.0.1/cake/sale_documents/viewdocument/4/2 is "FPDF error: Some data has already been output to browser, can't send PDF file" Why??? Thanks, Gianluca p.s.: sorry for my english! :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $title_for_layout
Hi, If you want to use $description_for_layout as same as $title_for_layout, you have to extends View class(cake/libs/view/view.php). You can find the mechanism of $title_for_layout in View::renderLayout(). However I do not want to modify the file in cake directory. I often extends AppController for this purpose. 1. copy cake/app_controller.php to app/app_controller.php 2. add a variable named $pageDescription in AppController 3. override beforeRender() and put the line below: $this->set('description_for_layout', $this->pageDescription); This works fine for me. If you override beforeRender() in other controllers which extends AppController, do not forget call the AppController's beforeRender(). Best Wishes, Takuo Shiono vdvm wrote: > Hi, > > In a controller you can use $this->pageTitle wich corresponds with > $title_for_layout in your layout. > I would like to create $description_for_layout and use it as $this- >> pageDescription in my controller. > How can i create this? > > Thank you! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: endless loop in model associations -> segmenation fault.
I think there's something strange going on in the 1.1.19 release. If you try a newer version it should work, atleast it did for me. https://trac.cakephp.org/browser/branches/1.1.x.x Thanks to AD7six @ #cakephp On 15 Jan, 16:31, keymaster <[EMAIL PROTECTED]> wrote: > I'm having exactly the same problem. > > An app which has worked no problem since cake 1.1.11 up to and > including 1.1.18, is all of a sudden stuck in infinite loop due to > model associations in 1.1.9. > > For what it's worth, the venerable BakeSale stable version is also seg > faulting in 1.1.19 due to model associations, but works fine in 1.1.18 > and before. > > Anybody know any more about this? > > On Jan 15, 9:57 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I've now tried the cake_1.2.0.6311-beta release and my model > > associations works fine there as well as in 1.1.18. > > Is there a problem with 1.1.19? It seems like the associations is > > overwritten in Model::__constructLinkedModel() method when it > > instantiate the associated model and therefore I end up in an endless > > loop which results in segmentation fault. > > > On 14 Jan, 09:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > Hi, I've been trying to upgrade from 1.1.18 to 1.1.19. It seems like I > > > have an endless loop in my model associations that I didn't have > > > before (1.1.18). Someone in #cakephp told me about this but I don't > > > understand why it was changed (couldn't find it in the changelog > > > either) and why it is happening. Could someone explain the problem to > > > me? The loop is in the VisitorStatistic and StatisticSource models. > > > Here's a bin of the problem.http://bin.cakephp.org/view/1456051979. > > > > Best regards > > > Tobias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Best practice for multiple checkboxes/radios/selects
Hi, I have a table of data and need to allow the user to choose certain records to authorise by either checking a checkbox or radio, select etc but I am struggling with the best way to show this data given that Cake form element expects a single model and field. I'm using 1.2 and have hunted high and low for an example, helper or tutorial... Getting the data back and processing it isn't a problem it's just working out the right way to reference the model/field name in the $form->select or whatever call... Cheers George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
no finderQuery data (cake 1.2 beta)
Hi guys I'm currently towards the end of a major app build and have today upgraded cake to the beta release, mainly to fix a pagination issue with the nightly I was using. Anyhow, I now have a far more serious problem in that my finderQuery data is being lost somewhere. In previous Cake, with debug on I could see the initial SELECT query, followed by a series of SELECT's based on my finderQuery to pull the association for each record found in the first query, ie "SELECT ... WHERE Model.id IN (xx)". With the beta, I instead see a single query for the finderQuery which will grab data for all of the rows found in the first query, ie: "SELECT ... WHERE Model.id IN (xx,xx,xx,xx,xx)". This is all fine and dandy obviously, we all like to see speed improvements and less queries. The only problem is that the data never makes it to my model - the associations are always blank - even though I can see the query being executed. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth in 1.2
Hey martin: Auth took me months to get working, even with Chris' tutorials. Try this, this may help. It's basic, no ACL (just controller), and there's code to download. http://www.webdevelopment2.com/cakephp-auth-component-tutorial-2/ As Chris said, get it working, then make it better. -- Kevin Lloyd 3HN Designs http://www.3HNDesigns.com/ (214) 473-4207 On Jan 15, 2008 9:10 AM, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > On Jan 15, 2008 7:05 AM, martinp <[EMAIL PROTECTED]> wrote: > > > > I've tried commenting out my userScope variable and removing > > if(isset($this->Auth)), but still no joy. As all I get is the login > > page with no error messages perhaps it is your first suggestion of a > > config setting? > > Martin, > > Like I mentioned before I would try removing 'Acl' from the list of > components and make sure it worked just fine with only the 'Auth' > component. > > Hope that helps. > > -- > Chris Hartjes > Internet Loudmouth > Motto for 2008: "Moving from herding elephants to handling snakes..." > @TheKeyBoard: http://www.littlehart.net/atthekeyboard > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Mult language cakephp 1.2
Hello Friends. He/she would like to know somebody has some material, tutorial of mult language of the cakephp 1.2, I am needing if they could help I will be thankful. att. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: deep hasMany's - trying to avoid a custom query..
> Why is it giving me the "AND `ModelName`.`project_id` = > `Project`.`id`" for all the related models though? They're not > associated like that.. Support for foreignKey => false was added in 6258 : https://trac.cakephp.org/changeset/6258 Before that, foreignKey => false just used the default, which is what is happening in your code. If you can't upgrade, the only way I can think of is to handle beforeFind() and add the joins manually to $queryData['joins']. Also, you don't seem to have the 'group by' clause in there either. Not sure what version that was added in. On Jan 15, 4:41 pm, kristofer <[EMAIL PROTECTED]> wrote: > I'm getting closer.. > > SELECT SUM(`Hour`.`time`), `Project`.`id` > FROM `projects` AS `Project` > LEFT JOIN `milestones` AS `Milestone` > ON (`Milestone`.`project_id` = `Project`.`id`) > LEFT JOIN `tasks` AS `Task` > ON (`Task`.`milestone_id`=`Milestone`.`id` AND `Task`.`project_id` > = `Project`.`id`) > LEFT JOIN `hours` AS `Hour` > ON (`Hour`.`task_id`=`Task`.`id` AND `Hour`.`project_id` = > `Project`.`id`) > WHERE `Project`.`id` = 1 LIMIT 1 > > Why is it giving me the "AND `ModelName`.`project_id` = > `Project`.`id`" for all the related models though? They're not > associated like that.. > > On Jan 15, 11:28 am, grigri <[EMAIL PROTECTED]> wrote: > > > That will probably be : > > > return $result[0]['SUM(`Hour`.`time`)']; > > > at the end > > > On Jan 15, 4:25 pm, grigri <[EMAIL PROTECTED]> wrote: > > > > First off, it really depends on your cake version. I'm assuming you're > > > on 1.2 beta or above: > > > > Try something like this: > > > > function getHours($id = null) { > > > $this->recursive = 0; > > > if ($id === null) { > > > $id = $this->id; > > > } > > > > $this->unbindModel(array('belongsTo' => array('Client', 'User'))); > > > $this->bindModel(array('hasOne' => array( > > > 'Milestone' => array(), > > > 'Task' => array('foreignKey' => false, 'conditions' => > > > 'Task.milestone_id=Milestone.id', > > > 'Hour' => array('foreignKey' => false, 'conditions' => > > > 'Hour.task_id=Task.id', > > > ; > > > $conditions = array('Project.id' => $id, '1=1 GROUP BY Project.id'); > > > $fields = array('SUM(`Hour`.`time`)'); > > > > $result = $this->find('first', compact('fields', 'conditions')); > > > > return $result['SUM(`Hour`.`time`)']; > > > > } > > > > On Jan 15, 3:31 pm, kristofer <[EMAIL PROTECTED]> wrote: > > > > > The main model is a Project. A Project hasMany Milestone. A Milestone > > > > hasMany Task. A Task hasMany Hour. > > > > > I'm hoping to use Model::find() to build this query (or something like > > > > it..): > > > > > > > > SELECT `Project`.`id`, > > > > SUM(`Hour`.`time`) > > > > > FROM `projects` AS `Project` > > > > > LEFT JOIN `milestones` AS `Milestone` > > > > ON `Milestone`.`project_id` = `Project`.`id` > > > > > LEFT JOIN `tasks` AS `Task` > > > > ON `Task`.`milestone_id` = `Milestone`.`id` > > > > > LEFT JOIN `hours` AS `Hour` > > > > ON `Hour`.`task_id` = `Task`.`id` > > > > > WHERE 1 = 1 > > > > GROUP BY `Project`.`id`; > > > > > > > > > Here's the function in the Project model I'm using to try building the > > > > query.. if I comment out the $fields[] = 'SUM(..)' line it pulls all > > > > the model data recursively.. but it does it with a separate query per > > > > table instead of using joins. > > > > > > > > > function getHours($id = null) { > > > > $this->recursive = 3; > > > > if($id == null) > > > > $id = $this->id; > > > > > $this->unbindModel(array('belongsTo' => array('Client', > > > > 'User'))); > > > > $fields = null; > > > > $conditions = array('`Project`.`id`' => $id); > > > > $fields[] = 'SUM(`Hour`.`time`)'; > > > > $result = $this->find($conditions, $fields); > > > > > return $result['Project']['SUM(`Hour`.`time`)']; > > > > } > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: deep hasMany's - trying to avoid a custom query..
I'm getting closer.. SELECT SUM(`Hour`.`time`), `Project`.`id` FROM `projects` AS `Project` LEFT JOIN `milestones` AS `Milestone` ON (`Milestone`.`project_id` = `Project`.`id`) LEFT JOIN `tasks` AS `Task` ON (`Task`.`milestone_id`=`Milestone`.`id` AND `Task`.`project_id` = `Project`.`id`) LEFT JOIN `hours` AS `Hour` ON (`Hour`.`task_id`=`Task`.`id` AND `Hour`.`project_id` = `Project`.`id`) WHERE `Project`.`id` = 1 LIMIT 1 Why is it giving me the "AND `ModelName`.`project_id` = `Project`.`id`" for all the related models though? They're not associated like that.. On Jan 15, 11:28 am, grigri <[EMAIL PROTECTED]> wrote: > That will probably be : > > return $result[0]['SUM(`Hour`.`time`)']; > > at the end > > On Jan 15, 4:25 pm, grigri <[EMAIL PROTECTED]> wrote: > > > First off, it really depends on your cake version. I'm assuming you're > > on 1.2 beta or above: > > > Try something like this: > > > function getHours($id = null) { > > $this->recursive = 0; > > if ($id === null) { > > $id = $this->id; > > } > > > $this->unbindModel(array('belongsTo' => array('Client', 'User'))); > > $this->bindModel(array('hasOne' => array( > > 'Milestone' => array(), > > 'Task' => array('foreignKey' => false, 'conditions' => > > 'Task.milestone_id=Milestone.id', > > 'Hour' => array('foreignKey' => false, 'conditions' => > > 'Hour.task_id=Task.id', > > ; > > $conditions = array('Project.id' => $id, '1=1 GROUP BY Project.id'); > > $fields = array('SUM(`Hour`.`time`)'); > > > $result = $this->find('first', compact('fields', 'conditions')); > > > return $result['SUM(`Hour`.`time`)']; > > > } > > > On Jan 15, 3:31 pm, kristofer <[EMAIL PROTECTED]> wrote: > > > > The main model is a Project. A Project hasMany Milestone. A Milestone > > > hasMany Task. A Task hasMany Hour. > > > > I'm hoping to use Model::find() to build this query (or something like > > > it..): > > > > > > SELECT `Project`.`id`, > > > SUM(`Hour`.`time`) > > > > FROM `projects` AS `Project` > > > > LEFT JOIN `milestones` AS `Milestone` > > > ON `Milestone`.`project_id` = `Project`.`id` > > > > LEFT JOIN `tasks` AS `Task` > > > ON `Task`.`milestone_id` = `Milestone`.`id` > > > > LEFT JOIN `hours` AS `Hour` > > > ON `Hour`.`task_id` = `Task`.`id` > > > > WHERE 1 = 1 > > > GROUP BY `Project`.`id`; > > > > > > > Here's the function in the Project model I'm using to try building the > > > query.. if I comment out the $fields[] = 'SUM(..)' line it pulls all > > > the model data recursively.. but it does it with a separate query per > > > table instead of using joins. > > > > > > > function getHours($id = null) { > > > $this->recursive = 3; > > > if($id == null) > > > $id = $this->id; > > > > $this->unbindModel(array('belongsTo' => array('Client', > > > 'User'))); > > > $fields = null; > > > $conditions = array('`Project`.`id`' => $id); > > > $fields[] = 'SUM(`Hour`.`time`)'; > > > $result = $this->find($conditions, $fields); > > > > return $result['Project']['SUM(`Hour`.`time`)']; > > > } > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: deep hasMany's - trying to avoid a custom query..
That will probably be : return $result[0]['SUM(`Hour`.`time`)']; at the end On Jan 15, 4:25 pm, grigri <[EMAIL PROTECTED]> wrote: > First off, it really depends on your cake version. I'm assuming you're > on 1.2 beta or above: > > Try something like this: > > function getHours($id = null) { > $this->recursive = 0; > if ($id === null) { > $id = $this->id; > } > > $this->unbindModel(array('belongsTo' => array('Client', 'User'))); > $this->bindModel(array('hasOne' => array( > 'Milestone' => array(), > 'Task' => array('foreignKey' => false, 'conditions' => > 'Task.milestone_id=Milestone.id', > 'Hour' => array('foreignKey' => false, 'conditions' => > 'Hour.task_id=Task.id', > ; > $conditions = array('Project.id' => $id, '1=1 GROUP BY Project.id'); > $fields = array('SUM(`Hour`.`time`)'); > > $result = $this->find('first', compact('fields', 'conditions')); > > return $result['SUM(`Hour`.`time`)']; > > } > > On Jan 15, 3:31 pm, kristofer <[EMAIL PROTECTED]> wrote: > > > The main model is a Project. A Project hasMany Milestone. A Milestone > > hasMany Task. A Task hasMany Hour. > > > I'm hoping to use Model::find() to build this query (or something like > > it..): > > > > SELECT `Project`.`id`, > > SUM(`Hour`.`time`) > > > FROM `projects` AS `Project` > > > LEFT JOIN `milestones` AS `Milestone` > > ON `Milestone`.`project_id` = `Project`.`id` > > > LEFT JOIN `tasks` AS `Task` > > ON `Task`.`milestone_id` = `Milestone`.`id` > > > LEFT JOIN `hours` AS `Hour` > > ON `Hour`.`task_id` = `Task`.`id` > > > WHERE 1 = 1 > > GROUP BY `Project`.`id`; > > > > > Here's the function in the Project model I'm using to try building the > > query.. if I comment out the $fields[] = 'SUM(..)' line it pulls all > > the model data recursively.. but it does it with a separate query per > > table instead of using joins. > > > > > function getHours($id = null) { > > $this->recursive = 3; > > if($id == null) > > $id = $this->id; > > > $this->unbindModel(array('belongsTo' => array('Client', > > 'User'))); > > $fields = null; > > $conditions = array('`Project`.`id`' => $id); > > $fields[] = 'SUM(`Hour`.`time`)'; > > $result = $this->find($conditions, $fields); > > > return $result['Project']['SUM(`Hour`.`time`)']; > > } > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Postgres and Build 1.2.0.6311
In addition to the integers as strings not allowing nulls, I just ran into another Postgres issue... Trying to create the ACL tables with: cake schema run create DbAcl outputs SQL in the form of "id" integer serial NOT NULL, which causes a SQL syntax error. The type should just be SERIAL. On Jan 15, 1:31 am, Charlie Chilton <[EMAIL PROTECTED]> wrote: > The update and delete issue has been fixed in the latest SVN (along > with a sequences fix too), > > I only noticed the integer-as-string thing you mentioned late in the > day yesterday, I don't know whether this has had a Ticket or fix yet > (my SVN copy is a few days old). > > I should have some time to investigate today and create a ticket for > the devs if theres not one already there. > > Charlie > > On Jan 15, 2:43 am, "pixelaté" <[EMAIL PROTECTED]> wrote: > > > > > Hey, first up; I think Cake is an awesome framework. It makes website > > development extremely easy! Thanks for the product and keep up the > > good work! > > > I was using the an earlier build of cake and everything was working > > relatively well - I did have an issue where I have to restart apache > > every 6 hours because the server stops responding but I've been > > ignoring that hoping that future releases will fix it. > > > Anyways, I decided up upgrade and had mammoth problems with postgres. > > > Long story short, I had a problem with postgres updates and deletes. I > > found cryptic bug messages on using test prefixes and other things > > which I have no idea what they mean. Instead I just went and upgraded > > my dbo_source.php and dbo_postgres.php from the svn repository. That > > seemed to fix most of my issues. > > > The other issue I ended up having was cake wasn't addressing data > > types. It was treating all of my database fields as strings. > > > Trying to enter in an empty number resulted in an error as cake was > > trying to enter in an empty string rather than a null. Very > > frustrating. > > > I gave up and reverted to the old version and it's running again. I > > hope this will be fixed soon :( > > > Just thought I'd throw my experiences in. > > > Cheers, > > > Ian- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: deep hasMany's - trying to avoid a custom query..
First off, it really depends on your cake version. I'm assuming you're on 1.2 beta or above: Try something like this: function getHours($id = null) { $this->recursive = 0; if ($id === null) { $id = $this->id; } $this->unbindModel(array('belongsTo' => array('Client', 'User'))); $this->bindModel(array('hasOne' => array( 'Milestone' => array(), 'Task' => array('foreignKey' => false, 'conditions' => 'Task.milestone_id=Milestone.id', 'Hour' => array('foreignKey' => false, 'conditions' => 'Hour.task_id=Task.id', ; $conditions = array('Project.id' => $id, '1=1 GROUP BY Project.id'); $fields = array('SUM(`Hour`.`time`)'); $result = $this->find('first', compact('fields', 'conditions')); return $result['SUM(`Hour`.`time`)']; } On Jan 15, 3:31 pm, kristofer <[EMAIL PROTECTED]> wrote: > The main model is a Project. A Project hasMany Milestone. A Milestone > hasMany Task. A Task hasMany Hour. > > I'm hoping to use Model::find() to build this query (or something like > it..): > > SELECT `Project`.`id`, > SUM(`Hour`.`time`) > > FROM `projects` AS `Project` > > LEFT JOIN `milestones` AS `Milestone` > ON `Milestone`.`project_id` = `Project`.`id` > > LEFT JOIN `tasks` AS `Task` > ON `Task`.`milestone_id` = `Milestone`.`id` > > LEFT JOIN `hours` AS `Hour` > ON `Hour`.`task_id` = `Task`.`id` > > WHERE 1 = 1 > GROUP BY `Project`.`id`; > > > Here's the function in the Project model I'm using to try building the > query.. if I comment out the $fields[] = 'SUM(..)' line it pulls all > the model data recursively.. but it does it with a separate query per > table instead of using joins. > > > function getHours($id = null) { > $this->recursive = 3; > if($id == null) > $id = $this->id; > > $this->unbindModel(array('belongsTo' => array('Client', > 'User'))); > $fields = null; > $conditions = array('`Project`.`id`' => $id); > $fields[] = 'SUM(`Hour`.`time`)'; > $result = $this->find($conditions, $fields); > > return $result['Project']['SUM(`Hour`.`time`)']; > } > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: endless loop in model associations -> segmenation fault.
I'm having exactly the same problem. An app which has worked no problem since cake 1.1.11 up to and including 1.1.18, is all of a sudden stuck in infinite loop due to model associations in 1.1.9. For what it's worth, the venerable BakeSale stable version is also seg faulting in 1.1.19 due to model associations, but works fine in 1.1.18 and before. Anybody know any more about this? On Jan 15, 9:57 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've now tried the cake_1.2.0.6311-beta release and my model > associations works fine there as well as in 1.1.18. > Is there a problem with 1.1.19? It seems like the associations is > overwritten in Model::__constructLinkedModel() method when it > instantiate the associated model and therefore I end up in an endless > loop which results in segmentation fault. > > On 14 Jan, 09:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Hi, I've been trying to upgrade from 1.1.18 to 1.1.19. It seems like I > > have an endless loop in my model associations that I didn't have > > before (1.1.18). Someone in #cakephp told me about this but I don't > > understand why it was changed (couldn't find it in the changelog > > either) and why it is happening. Could someone explain the problem to > > me? The loop is in the VisitorStatistic and StatisticSource models. > > Here's a bin of the problem.http://bin.cakephp.org/view/1456051979. > > > Best regards > > Tobias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
deep hasMany's - trying to avoid a custom query..
The main model is a Project. A Project hasMany Milestone. A Milestone hasMany Task. A Task hasMany Hour. I'm hoping to use Model::find() to build this query (or something like it..): SELECT `Project`.`id`, SUM(`Hour`.`time`) FROM `projects` AS `Project` LEFT JOIN `milestones` AS `Milestone` ON `Milestone`.`project_id` = `Project`.`id` LEFT JOIN `tasks` AS `Task` ON `Task`.`milestone_id` = `Milestone`.`id` LEFT JOIN `hours` AS `Hour` ON `Hour`.`task_id` = `Task`.`id` WHERE 1 = 1 GROUP BY `Project`.`id`; Here's the function in the Project model I'm using to try building the query.. if I comment out the $fields[] = 'SUM(..)' line it pulls all the model data recursively.. but it does it with a separate query per table instead of using joins. function getHours($id = null) { $this->recursive = 3; if($id == null) $id = $this->id; $this->unbindModel(array('belongsTo' => array('Client', 'User'))); $fields = null; $conditions = array('`Project`.`id`' => $id); $fields[] = 'SUM(`Hour`.`time`)'; $result = $this->find($conditions, $fields); return $result['Project']['SUM(`Hour`.`time`)']; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.1.19 Model Associations Bug - endless loop ??
Oops, meant to reply to following thread, http://groups.google.com/group/cake-php/browse_thread/thread/4fe253582dc85aed/5a51ff85d99061aa#5a51ff85d99061aa but started this new one instead. Please continue under the original thread - I will propagate this post there. On Jan 15, 5:29 pm, keymaster <[EMAIL PROTECTED]> wrote: > I'm having exactly the same problem. > > An app which has worked no problem since cake 1.1.11 up to and > including 1.1.18, is all of a sudden stuck in infinite loop due to > model associations in 1.1.9. > > For what it's worth, the venerable BakeSale stable version is also seg > faulting in 1.1.19 due to model associations, but works fine in 1.1.18 > and before. > > Anybody know any more about this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.1.19 Model Associations Bug - endless loop ??
I'm having exactly the same problem. An app which has worked no problem since cake 1.1.11 up to and including 1.1.18, is all of a sudden stuck in infinite loop due to model associations in 1.1.9. For what it's worth, the venerable BakeSale stable version is also seg faulting in 1.1.19 due to model associations, but works fine in 1.1.18 and before. Anybody know any more about this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth in 1.2
On Jan 15, 2008 7:05 AM, martinp <[EMAIL PROTECTED]> wrote: > > I've tried commenting out my userScope variable and removing > if(isset($this->Auth)), but still no joy. As all I get is the login > page with no error messages perhaps it is your first suggestion of a > config setting? Martin, Like I mentioned before I would try removing 'Acl' from the list of components and make sure it worked just fine with only the 'Auth' component. Hope that helps. -- Chris Hartjes Internet Loudmouth Motto for 2008: "Moving from herding elephants to handling snakes..." @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: swfupload cakephp 302 error
I also implemented swfupload and had problems with the session being lost. Instead of hacking the cake core I went ahead and included a unique hashed key with the post. After it was posted, the site would check the key. If it was valid it would let it go through. For instance, in the swfupload javascript you could do something like this: upload_url: "/foo/edit/56/56/" Then in your edit method: function edit($param1, $param2, $key) { if ($key == sha1('putYourUniqueSeedHere')) { //upload file } } I'm sure there are better ways to do this, but I just didn't want to change the cakephp core. On Jan 14, 5:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote: > I had issues with implementing SwfUpload, and it was due to cake's > security handling of sessions. This was because the swf was sending a > different user agent and cake detected this as session hijacking. > > I might assume that this is happening to you and the redirect (302) > error you're having is due to cake not recognising some session > variable (because it's using a new session) and then redirecting to a > login form? > > My solution was to hack the cake core, but I think they have since > changed the core so you can easily disable this code in your > beforeFilter(). > > This should work - but it's untested so let me know if it does. > > function beforeFilter(){ > Configure::write('Session.checkAgent', false); > > } > > Hope that helps. > > Cheers, > Adam > > On Jan 15, 7:00 am, booboobenny <[EMAIL PROTECTED]> wrote: > > > swfupload does not need ajax, its pure flash. The flash movie does a > > post submission there is no page reload. > > > The flash movie is getting back a 302 from apache, in the log i see: > > > "POST /foo/upload/ HTTP/1.1" 302 673 "-" "Adobe Flash Player 9" > > > Note the actual URL of the page is /foo/edit/56/56 > > > Its very strange that I can set the header manually on local machine > > but not on mediatemple. They do have a funky way of running php5. > > > Well if i figure this out Ill post, this would seem to be a common > > occurance with this. > > > On Jan 14, 1:21 pm, rloaderro <[EMAIL PROTECTED]> wrote: > > > > On Jan 14, 8:47 am, booboobenny <[EMAIL PROTECTED]> wrote: > > > > > I am hoping someone here can help me out with this one. > > > > > I am using swfupload and cake, I implemented using the articles on the > > > > bakery as a starting point. > > > > > I have a controller /foo and in that controller I have a method > > > > upload. So the upload url is: > > > > > /foo/upload > > > > > When the form submits I get a 302 error. Does anyone know a way to > > > > submit the form (i would prefer to avoid ajax) to /foo/upload and not > > > > get a 302 error. > > > > I think the SwfUpload is meant specifically for use with AJAX. The > > > problem with AJAX and file uploads is that you normally need to submit > > > the form in order to send file data to the server. Since the page > > > reloads with a form submit the only previous solution was to submit > > > the form to a hidden iframe and parse the server response when the > > > iframe loads. Flash is actually a great interface for uploading files > > > since it doesn't require a form submit and can even provide feedback > > > in so far as upload progress, etc.. I don't think using SwfUpload > > > without AJAX would provide any benefits over using a conventional form > > > file input - if it even is possible. > > > > Anyway, I implemented a similar thing using Mootools and > > > Swiff.Uploader and I can tell you that using the controller->log > > > function is invaluable for debugging. My implementation is a little > > > different than the one on the bakery, but if it helps, my controller > > > looks like: > > > >http://pastebin.com/f457cfcf > > > > And the component looks like: > > > >http://pastebin.com/f2a167234 > > > > You might notice my implementation is for single files only - however > > > I have tested it on a number of server setups - with PHP in safemode, > > > root-jailing, etc.. - and it has worked for me so it might be useful > > > for you? Good luck! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: safe mode error
Sorry to bring this back up, but the error still shows at random moments. eid skrev: > My cake frontpage is throwing me an error: > "Warning (2): realpath() [function.realpath]: SAFE MODE Restriction in > effect. The script whose uid is 1235 is not allowed to access /usr/ > local/lib/php owned by uid 0 [CORE/cake/libs/configure.php, line 458]" > When I used the pre-beta version this error never showed, I'm only > seeing it now I've upgraded to the beta. > The thing is, it doesn't show on every page load.Visit www.sachse.nu > to see for yourselves, try refreshing and it should show eventually. > What can I do to remove it? I'm on a shared host, so I have no control > over safe mode. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.1.19 Model Save behaviour changed?
Hi In 1.1.18 if I passed a blank id into a model save it would insert a new row, ignoring the id. In 1.1.19 it doesn't ignore the value, but attempts to set the id of the table to a blank value, resulting in an sql error. Is this an intentional change to the code? Should I now be using the fieldlist parameter of Model save? Cheers James --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Ajax update of JpGraph in CakePHP
Thanks for your hints, I now found the solution. The browser cached the file, so I attached a random number at the end of the src tag: " /> I also put a tag around the img tag and update the div in the ajax call, not the image itself. In the Ajax call it is important to call a new page, where you have just the tag in: $options = array('url' => 'page_with_only_img_tag, 'update' => 'myimage'); echo $ajax->observeField('selecttag',$options); If you try to update directly the implemented , it does not work. Make shure to put the layout of this page to ajax by adding the line $this->layout='ajax'; in the controller. Greets Tom > -Original Message- > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Saturday, January 12, 2008 10:31 PM > To: Cake PHP > Subject: Re: Ajax update of JpGraph in CakePHP > > > I think this is a browser issue, I've found that, if you change an > image that has already been downloaded, the browser will use the > cached image instead of re-downloading the updated image from the > server. What I've done to get around this is to create a temporary > image with a random name, then the browser doesn't have a cached image > and is forced to download it. I'm not all that familiar with JpGraphs > but I bet if you save the resulting graph as an image with a random > name, it will fix your problems. > > Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth in 1.2
Thanks for your response Chris. I've got the most recent download of Cakephp (Beta: 1.2.0.6311), so that shouldn't be the problem. However, do you know what setting specifically had to be changed in the config file? The code I've used is mostly from http://lemoncake.wordpress.com/2007/07/19/using-authcomponent-and-acl-in-cakephp-12/ They used if(isset($this->Auth)) and the $publicControllers construct. I've tried commenting out my userScope variable and removing if(isset($this->Auth)), but still no joy. As all I get is the login page with no error messages perhaps it is your first suggestion of a config setting? Thanks for your help. On Jan 15, 4:26 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 9:18 PM, martinp <[EMAIL PROTECTED]> wrote: > > > > > Hello > > > I appreciate there's a lot of discussion and a few tutorials on Auth > > in 1.2, but for some reason I can't get it to work at all - even at a > > basic level. I'm probably doing something noobtastically wrong, so I > > apologise in advance for my stupidity if so, but I wonder if someone > > wouldn't mind giving me some pointers on this. > > Hey Martin, I've put some of my comments inline here, hopefully they can help. > > > I've set up my login page, my users controller and app_controller, but > > when I attempt to login, nothing happens. Nothing. No error message, > > no redirection, no cakephp error, just nothing. > > Do you keep getting redirected to the login form? This kept happening > to me...until I updated my app/core/config.php file to the newest > version. I was running quite a few revisions behind and once I > updated stuff, it went just fine. > > > Here's my login.ctp: > > echo $form->create('User', array('controller' => 'users', 'action' > > => > > 'login'))."\n"; > > echo $form->input('email')."\n"; > > echo $form->input('password')."\n"; > > echo $form->checkbox('remember_me')."\n"; > > echo $form->label('remember_me', 'Stay logged in?')."\n"; > > echo $form->end('Login')."\n"; > > Login form looks okay to me. > > > > > My app_controller.php: > > var $helpers = array('Html','Javascript','Form'); > > var $components = array('Acl','Auth','Cookie','Security'); > > var $publicControllers = array('pages'); > > > function beforeFilter() { > > if (isset($this->Auth)) { > > $this->Auth->fields = array('username' => 'email', > > 'password' => > > 'password'); > > $this->Auth->loginAction = array('controller' => > > 'users', 'action' > > => 'login'); > > $this->Auth->loginRedirect = array('controller' => > > 'users', > > 'action' => 'index'); > > $this->Auth->logoutRedirect = '/'; > > $this->Auth->userModel = 'User'; > > $this->Auth->userScope = array('User.status' => > > 'Activated'); > > $this->Auth->loginError = 'Invalid email / password > > combination. > > Please try again'; > > I've never used isset($this->Auth) before, and that might be causing > part of the problem. Is there an example out there that uses this, as > I've never seen that. Not saying that it's wrong, just that I haven't > seen it before. > > Otherwise, things look okay to me here. One thing that sticks out is > to make sure that the status field for your model is, in fact, set to > 'Activated'. Silly, I know, but worth looking at. > > > if (in_array(low($this->params['controller']), > > $this- > > >publicControllers)) { > > $this->Auth->allow(); > > } > > Hrm, that's a neat little construct. Haven't seen that before either. > Again, I'd love to see the link to that example. > > > } > > } > > > I know I've got to implement ACL, but surely I should be getting error > > messages for incorrect passwords even now? Grateful for anyone's > > input! > > I'd suggest that you remove ACL from the equation for now and make > sure that you can get Auth working first. Remember the motto: make > it work, then make it work better. > > -- > Chris Hartjes > Internet Loudmouth > Motto for 2008: "Moving from herding elephants to handling snakes..." > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
$title_for_layout
Hi, In a controller you can use $this->pageTitle wich corresponds with $title_for_layout in your layout. I would like to create $description_for_layout and use it as $this- >pageDescription in my controller. How can i create this? Thank you! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How combine CakePHP + ExtJS?
@foxmask - can you post your code someplace where I can look at it? On Jan 12, 7:47 am, foxmask <[EMAIL PROTECTED]> wrote: > on my side i get the grid and the string : > {"total":2, "users":[{"username":"foxmask", "title":"", > "realname":""}, {"username":"Invité", "title":"", "realname":""}]} > > display just after the grid . > > On Jan 11, 11:15 pm, hydra12 <[EMAIL PROTECTED]> wrote: > > > OK, the forms tutorial is up now. You can find it > > here:http://www.ntatd.org/mark/?p=31. Have a great weekend! > > > On Jan 11, 8:38 am, hydra12 <[EMAIL PROTECTED]> wrote: > > > > That's what it's supposed to do. getAllUsers just returns a json > > > string with data from the database. Now call myroot/users/index. It > > > should show a datagrid with all the json data in it. The way it works > > > is this: index is pretty much blank, but it loads myScript.js (or > > > whatever you named it). myScript.js calls getAllUsers on line 17: > > > > proxy: new Ext.data.HttpProxy({url: 'http://'+host+'/ext/users/ > > > getAllUsers'}), > > > > When you call index, it should call getAllUsers and load the data > > > returned into your store. When you render your datagrid, it pulls > > > data from the store and puts it in the grid. The fact that you are > > > getting the json string when you call getAllUsers directly means > > > you're on the right track. Let me know if I can help. > > > > BTW, I'm about 1/2 way done on a forms tutorial . . . > > > > hydra12 > > > > On Jan 11, 8:13 am, inma <[EMAIL PROTECTED]> wrote: > > > > > Thank you Hidra12! > > > > > I read your datagrid tutorial for ext-2.0. > > > > > I'm using ext-2.0 and CakePHP 1.2 Beta, too. > > > > > But when I call to myroot//users/getAllUsers, it shows that: > > > > > {"total":8, "users":[{"id":6, "username":"archangel", > > > > "fullname":"Worthington, Warren"}, {"id":2, "username":"cyclops", > > > > "fullname":"Summers, Scott"}, {"id":8, "username":"gambit", > > > > "fullname":"LeBeau, Remy"}, {"id":1, "username":"hydra12", > > > > "fullname":"Buckner, Mark"}, {"id":5, "username":"iceman", > > > > "fullname":"Drake, Bobby"}, {"id":3, "username":"nightcrawler", > > > > "fullname":"Wagner, Kurt"}, {"id":7, "username":"storm", > > > > "fullname":"Munroe, Ororo"}, {"id":4, "username":"wolverine", > > > > "fullname":"Logan"}]} > > > > > On 10 ene, 21:37, hydra12 <[EMAIL PROTECTED]> wrote: > > > > > > OK, I did some searching and found this > > > > > thread:http://groups.google.com/group/cake-php/browse_thread/thread/32d4c152... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
Is curId a either a primary or a unique key? On 1/15/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > '$type = "ORD" > $today = date("Ym"); > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_1 = $this->findBySql($sql); > > > $sql = "update orders_sequence set curId = curId + 1 where > curDate='$today' and type='$type'"; > $this->execute($sql); > > > > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_2 = $this->findBySql($sql); > > > $row1 == $row2 ? why ?? please help me,thanks > > > > -- Sincerely yours, Olexandr Melnyk http://omelnyk.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql cache?
Using 1.1? https://trac.cakephp.org/ticket/1915 On Jan 15, 8:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > '$type = "ORD" > $today = date("Ym"); > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_1 = $this->findBySql($sql); > > $sql = "update orders_sequence set curId = curId + 1 where > curDate='$today' and type='$type'"; > $this->execute($sql); > > $sql = "select curType,curId from orders_sequence where > curDate='$today' and type='$type'"; > $row_2 = $this->findBySql($sql); > > $row1 == $row2 ? why ?? please help me,thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP 1.2 - Controller
Sugiro então fazer um Model 'Login' que nao use nenhuma tabela. http://api.cakephp.org/1.2/class_model.html $useTable = null; Abraços Spark 2008/1/14 pamp_php <[EMAIL PROTECTED]>: > > Bom, me expressei mal. > Na verdade o Controller irá utilizar vários MODELs. > O problema é que o nome do Controller (var $name = 'Login';) > não é o nome de nenhum model do meu banco de dados. > > > Paulo. > > > > On 14 jan, 14:13, "DJ Spark" <[EMAIL PROTECTED]> wrote: > > tente: > > $uses = null; > > ou > > $uses = array(); > > > > isso deve servir, para dizer que oControllernão vai usar nenhum Model > > > > Spark > > > > 2008/1/14 pamp_php <[EMAIL PROTECTED]>: > > > > > > > > > > > > > > > > > Estou usando oCakePHP1.2e me surgiu uma dúvida: > > > > > Define umcontrollercujo nome não está relacionado a nenhum > > > MODEL, e o Cake me enviou a seguinte mensagem: > > > > > Error: Database table logins for model Login was not found. > > > > > Na versão 1.1 ... do Cake a definição de Controllers, cujo > > > nome não estava ligado a nenhum MODEL era tranquilo, mas na versão > > >1.2, surgiu esse problema. > > > Você sabe o que devo fazer ? > > > > > Abaixo o trecho do meu código que define esseController > > > (login_controller.php): > > > > > class LoginController extends AppController { > > > > > var $name = 'Login'; // Nome doController > > > > > var $uses = array('Tray_usuario','Tray_loja', > > > 'Tray_cliente'); // Entidades envolvidas > > > > > var $helpers = array('Html', 'Form', 'HtmlPt', 'HtmlExt', > > > 'TimePt', 'Javascript', 'Ajax'); // helperCakePHP > > > > > var $components = array('Email'); > > > > > } > > > > -- > > [livesets]http://djspark.com.br/ > > [web]http://sydi.net > > [filmes]http://melhoresfilmes.com.br- Ocultar texto entre aspas - > > > > - Mostrar texto entre aspas - > > > > -- [livesets] http://djspark.com.br/ [web] http://sydi.net [filmes] http://melhoresfilmes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
Erm sorry, that last loop should be: foreach ($results as $i => $row) { $query['conditions'] = array('Person.' . $row['Rule']['key'] => $row['Rule']['operator'] . $row['Rule']['value']); $people = $this->Person->find('all', $query); $results[$i]['Person'] = array(); foreach ($people as $subRow) { $person = $subRow['Person']; unset($subRow['Person']); foreach ($subRow as $key => $value) { $person[$key] = $value; } $results[$i]['Person'][] = $person; } } On Jan 15, 12:28 pm, grigri <[EMAIL PROTECTED]> wrote: > > So, there is no public callback wedged between the query on "this" > > model and the queries for the associated models? Too bad. > > Well, non-join associations (hasMany / HABTM) are effectively separate > queries after the main query, so doing them in afterFind() wouldn't be > a problem. > > [warning: These are just ideas; nothing is tested] > > Assuming rules table contains fields : key, operator, value [eg: key > => 'shoe_size', 'operator' => '>', 'value' => 43] > > Lots of SQL calls method: > > class Rule extends AppModel { > > /* Add a dummy hasMany. This will ensure that : >-> this model has access to the Person model >-> if a Person key is set in the results array then the recursive > setting is >high enough to request the Person associations >-> You can define fields, order, whatever in the normal way > */ > var $hasMany = array( > 'Person' => array( > /* leave these as-is */ > 'foreignKey' => 'id', 'conditions' => '1=0', > /* set these appropriately */ > 'fields' => array('id', 'email', 'shoe_size'), > 'order' => 'Person.name ASC', > /* set this to always use the given recursive number, set to null > for default */ > 'recursive' => null > ); > ); > > function afterFind($results) { > if (!isset($results[0]['Person'])) { > // Don't want the association, or zero results. Either way, abort > return $results; > } > $query = array( > 'conditions' => array(), > 'recursive' => is_null($this->hasMany['Person']['recursive']) ? > ($this->recursive - 1) : $this->hasMany['Person']['recursive'], > 'fields' => $this->hasMany['Person']['fields'], > 'limit' => $this->hasMany['Person']['limit'], > 'order' => $this->hasMany['Person']['order'], > ); > foreach ($results as $i => $row) { > $query['conditions'] = array('Person.' . $row['Rule']['key'] => > $row['Rule']['operator'] . $row['Rule']['value']); > $people = $this->Person->find('all', $query); > foreach ($people as $subRow) { > $person = $subRow['Person']; > unset($subRow['Person']); > foreach ($subRow as $key => $value) { > $person[$key] = $value; > } > $results[$i]['Person'] = $person; > } > } > return $results; > > } > } > > Actually, that was longer than I thought it was going to be. I'll > leave the 'one huge SQL call' method for later, and the hybrid method > for even later. > > On Jan 15, 10:32 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > So, there is no public callback wedged between the query on "this" > > model and the queries for the associated models? Too bad. > > > I guess I will have to drop the idea of using associations and instead > > load the data in afterFind() or possible even in the controller. > > > Some more details: > > I am developing with the intent of running the application on a > > dedicated server (or number thereof) with php5 and mysql5 (pretty > > standard LAMP setup). > > > What I am doing is creating a filter (well... trying to anyway) that > > will filter a table of people (contacts) based on data stored in the > > contacts table. It would make life easy for views and controllers if I > > could just call for a filter called "people with big feet" and loading > > this filter also loads relevant contacts (WHERE Contact.shoe_size > 43 > > or something). Filter-rules can be edited until you get the ultimate > > selection of people... this will naturally be used for marketing and > > not cancer-research or anything noble like that. > > > Building this dynamic "relationship" without hasMany is not big > > problem. It would just be super-über-cool to do it that way. That is > > why I am spending precious time trying to bend Cake to my will :) > > > If you, or anyone else, has any further tips please feel free... > > If not, thanks to grigri for your info so far. it was helpful. > > > On Jan 15, 11:06 am, grigri <[EMAIL PROTECTED]> wrote: > > > > Yeah, the foreignKey => false bit is quite recent. > > > > For some reason support for beforeFind on associated models is not > > > being planned, as far as I know. > > > > This is a really big issue for code like the TranslationBehavior which > > > can't translate its associated models (do a search on this group and > > > you'll see). > > > > a quote from gwoo: > > > > > we have discussed this internally, and have determined that for now > > > > running beforeFin
Re: HasMany Associations using no foreign key
> So, there is no public callback wedged between the query on "this" > model and the queries for the associated models? Too bad. Well, non-join associations (hasMany / HABTM) are effectively separate queries after the main query, so doing them in afterFind() wouldn't be a problem. [warning: These are just ideas; nothing is tested] Assuming rules table contains fields : key, operator, value [eg: key => 'shoe_size', 'operator' => '>', 'value' => 43] Lots of SQL calls method: class Rule extends AppModel { /* Add a dummy hasMany. This will ensure that : -> this model has access to the Person model -> if a Person key is set in the results array then the recursive setting is high enough to request the Person associations -> You can define fields, order, whatever in the normal way */ var $hasMany = array( 'Person' => array( /* leave these as-is */ 'foreignKey' => 'id', 'conditions' => '1=0', /* set these appropriately */ 'fields' => array('id', 'email', 'shoe_size'), 'order' => 'Person.name ASC', /* set this to always use the given recursive number, set to null for default */ 'recursive' => null ); ); function afterFind($results) { if (!isset($results[0]['Person'])) { // Don't want the association, or zero results. Either way, abort return $results; } $query = array( 'conditions' => array(), 'recursive' => is_null($this->hasMany['Person']['recursive']) ? ($this->recursive - 1) : $this->hasMany['Person']['recursive'], 'fields' => $this->hasMany['Person']['fields'], 'limit' => $this->hasMany['Person']['limit'], 'order' => $this->hasMany['Person']['order'], ); foreach ($results as $i => $row) { $query['conditions'] = array('Person.' . $row['Rule']['key'] => $row['Rule']['operator'] . $row['Rule']['value']); $people = $this->Person->find('all', $query); foreach ($people as $subRow) { $person = $subRow['Person']; unset($subRow['Person']); foreach ($subRow as $key => $value) { $person[$key] = $value; } $results[$i]['Person'] = $person; } } return $results; } } Actually, that was longer than I thought it was going to be. I'll leave the 'one huge SQL call' method for later, and the hybrid method for even later. On Jan 15, 10:32 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > So, there is no public callback wedged between the query on "this" > model and the queries for the associated models? Too bad. > > I guess I will have to drop the idea of using associations and instead > load the data in afterFind() or possible even in the controller. > > Some more details: > I am developing with the intent of running the application on a > dedicated server (or number thereof) with php5 and mysql5 (pretty > standard LAMP setup). > > What I am doing is creating a filter (well... trying to anyway) that > will filter a table of people (contacts) based on data stored in the > contacts table. It would make life easy for views and controllers if I > could just call for a filter called "people with big feet" and loading > this filter also loads relevant contacts (WHERE Contact.shoe_size > 43 > or something). Filter-rules can be edited until you get the ultimate > selection of people... this will naturally be used for marketing and > not cancer-research or anything noble like that. > > Building this dynamic "relationship" without hasMany is not big > problem. It would just be super-über-cool to do it that way. That is > why I am spending precious time trying to bend Cake to my will :) > > If you, or anyone else, has any further tips please feel free... > If not, thanks to grigri for your info so far. it was helpful. > > On Jan 15, 11:06 am, grigri <[EMAIL PROTECTED]> wrote: > > > Yeah, the foreignKey => false bit is quite recent. > > > For some reason support for beforeFind on associated models is not > > being planned, as far as I know. > > > This is a really big issue for code like the TranslationBehavior which > > can't translate its associated models (do a search on this group and > > you'll see). > > > a quote from gwoo: > > > > we have discussed this internally, and have determined that for now > > > running beforeFind on associations will cause problems with overhead and > > > conflicts. > > > Most certainly this is not a bug. It is a known limitation of the > > > beforeFind callback. > > > and from nate: > > > > The overhead required for enabling this would not be worth it's limited > > > usefulness. Create a behavior. > > > Personally I'd like to see this issue resolved, but I understand that > > it could be tricky to code efficiently and there are more important > > things to do to the cake core. > > > I must say though, your requirements do look quite difficult. > > Obviously it depends enormously on the amount of rules and associated > > data you will have stored (hundreds? thousands? millions?). The naive > > implementation (post-process record by record using afterFind
Cake core team: I kiss you!
I just wanted to post a thank you to the Cake team for being such brilliant people. Also a big thanks to everyone in the community helping everyone in their own ways. Note: Sorry, I think this turned into one of these Cake vs Rails posts. I ran across Rails in the early fall of 2005. Thought the concept was great but could not justify jumping onboard with the poor hosting support at the time. Found CakePHP a few months later and have been using it on an off ever since. From time to time I have been tempted to take another peak at Rails. They do have a lot of strong hype, after all. So, recently I had a reason to do some more serious revision. A new project, in-house hosting, possibly a lot of traffic one day. I spent a few days looking into Rails again. I was totally ready to make the jump, Ruby-books in-hand. CakePHP once again came out on-top, v1.2 had a lot to do with it but the community and documentation played a big role. * Cake has great documentation - I see a lot of complaints but I have taken a look at the Rails API-docs, IMHO horrible by comparison. The docs can me improved and more complete but they are not that bad when you consider the next point on my list: * Cake has a great community - So does Rails but for Cake I see more snippets and focused, relevant tutorials. Most of the questions I get in my head already have answers (here, in a blog, the bakery or the forge). * Cake has not yet taken any backward steps - To me some changes in Rails versions are steps backward. E.g. the way scaffolding has changed. Cake has yet to disappoint me in a feature-change. Rails has a lot in its favor. But for me the docs and the community surrounding CakePHP reassures me. I am of-course not impartial by any stretch of the imagination. But I still thought I would share my opinions. cheers ! And, if you are wondering about the title: You haven't forgot this (very old) internet classic have you? http://www.ikissyou.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Sqlite Datatype Mismatch and SQL id auto_increment
Hey guys and gals. Just switched from 1.1.19 to 1.2.0 and I'm having a little trouble with sqlite. Using the debugging tool I notice that when I submit a new entry into my 'Tasks' table: CREATE TABLE Tasks( id INTEGER SIGNED AUTO_INCREMENT, name TEXT, notes TEXT, due_date TEXT, status_id INTEGER NOT NULL REFERENCES Statuses(id), project_id INTEGER NOT NULL REFERENCES Projects(id), project_position INTEGER(5), PRIMARY KEY ('id') ); The following statement is generated: Query: INSERT INTO "tasks" ("id","name","notes","due_date_month","due_date_day","due_date_year","project_position") VALUES ('','testt','ests','1','1','1','1') Warning (512): SQL Error: 20: datatype mismatch [CORE/cake/libs/model/ datasources/dbo_source.php, line 440] Basicaly I get datatype mismatch errors because CakePHP fails to either: auto_increment the primary_id -or- neglect to insert the 'id' and just let sql do the work is anyone else having problems with this? Is there anything I can do besides amend the source code? Any opinions? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Sessions, Webserivce and Ajax
Hi Guys, Started a new discussion as the old ones title was incorrect, this disccussion continues the one at: http://groups.google.com/group/cake-php/browse_thread/thread/c83fa8bd7071cefa/a1cd792d45a45a24#a1cd792d45a45a24 Here is a summary (although reading the last posts may be important): The Sessions are not maintainable across webservices, and in particular ajax calls. Is there a reason for this? I have ajax calls that run over a logged in session state, but beacuse the $controller->params['bare'] = 1, the session does not get started and hence I can't therefor check security, and hence the action doesn't get called. Is the fact that sessions are not maintainable across ajax and webservices and intended functionality? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
mysql cache?
'$type = "ORD" $today = date("Ym"); $sql = "select curType,curId from orders_sequence where curDate='$today' and type='$type'"; $row_1 = $this->findBySql($sql); $sql = "update orders_sequence set curId = curId + 1 where curDate='$today' and type='$type'"; $this->execute($sql); $sql = "select curType,curId from orders_sequence where curDate='$today' and type='$type'"; $row_2 = $this->findBySql($sql); $row1 == $row2 ? why ?? please help me,thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How combine CakePHP + ExtJS?
Thanks hydra12 for the forms tutorial. It will help a lot of people. Best regards. On 12 ene, 14:47, foxmask <[EMAIL PROTECTED]> wrote: > on my side i get the grid and the string : > {"total":2, "users":[{"username":"foxmask", "title":"", > "realname":""}, {"username":"Invité", "title":"", "realname":""}]} > > display just after the grid . > > On Jan 11, 11:15 pm, hydra12 <[EMAIL PROTECTED]> wrote: > > > > > OK, the forms tutorial is up now. You can find it > > here:http://www.ntatd.org/mark/?p=31. Have a great weekend! > > > On Jan 11, 8:38 am, hydra12 <[EMAIL PROTECTED]> wrote: > > > > That's what it's supposed to do. getAllUsers just returns a json > > > string with data from the database. Now call myroot/users/index. It > > > should show a datagrid with all the json data in it. The way it works > > > is this: index is pretty much blank, but it loads myScript.js (or > > > whatever you named it). myScript.js calls getAllUsers on line 17: > > > > proxy: new Ext.data.HttpProxy({url: 'http://'+host+'/ext/users/ > > > getAllUsers'}), > > > > When you call index, it should call getAllUsers and load the data > > > returned into your store. When you render your datagrid, it pulls > > > data from the store and puts it in the grid. The fact that you are > > > getting the json string when you call getAllUsers directly means > > > you're on the right track. Let me know if I can help. > > > > BTW, I'm about 1/2 way done on a forms tutorial . . . > > > > hydra12 > > > > On Jan 11, 8:13 am, inma <[EMAIL PROTECTED]> wrote: > > > > > Thank you Hidra12! > > > > > I read your datagrid tutorial for ext-2.0. > > > > > I'm using ext-2.0 and CakePHP 1.2 Beta, too. > > > > > But when I call to myroot//users/getAllUsers, it shows that: > > > > > {"total":8, "users":[{"id":6, "username":"archangel", > > > > "fullname":"Worthington, Warren"}, {"id":2, "username":"cyclops", > > > > "fullname":"Summers, Scott"}, {"id":8, "username":"gambit", > > > > "fullname":"LeBeau, Remy"}, {"id":1, "username":"hydra12", > > > > "fullname":"Buckner, Mark"}, {"id":5, "username":"iceman", > > > > "fullname":"Drake, Bobby"}, {"id":3, "username":"nightcrawler", > > > > "fullname":"Wagner, Kurt"}, {"id":7, "username":"storm", > > > > "fullname":"Munroe, Ororo"}, {"id":4, "username":"wolverine", > > > > "fullname":"Logan"}]} > > > > > On 10 ene, 21:37, hydra12 <[EMAIL PROTECTED]> wrote: > > > > > > OK, I did some searching and found this > > > > > thread:http://groups.google.com/group/cake-php/browse_thread/thread/32d4c152...- > > > > > Ocultar texto de la cita - > > - Mostrar texto de la cita - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sqlite Datatype Mismatch and SQL id auto_increment
Whoops this is the correct schema: CREATE TABLE Tasks( id INTEGER SIGNED AUTO_INCREMENT, name TEXT, notes TEXT, due_date_month INTEGER(2), due_date_day INTEGER(2), due_date_year INTEGER(4), status_id INTEGER NOT NULL REFERENCES Statuses(id), project_id INTEGER NOT NULL REFERENCES Projects(id), project_position INTEGER(5), PRIMARY KEY ('id') ); On Jan 14, 2008 11:36 PM, franklin <[EMAIL PROTECTED]> wrote: > Hey guys and gals. > > Just switched from 1.1.19 to 1.2.0 and I'm having a little trouble > with sqlite. > > Using the debugging tool I notice that when I submit a new entry into > my 'Tasks' table: > > CREATE TABLE Tasks( >id INTEGER SIGNED AUTO_INCREMENT, >name TEXT, >notes TEXT, >due_date TEXT, >status_id INTEGER NOT NULL REFERENCES Statuses(id), >project_id INTEGER NOT NULL REFERENCES Projects(id), >project_position INTEGER(5), >PRIMARY KEY ('id') > ); > > The following statement is generated: > > Query: INSERT INTO > "tasks" > ("id","name","notes","due_date_month","due_date_day","due_date_year","project_position") > VALUES ('','testt','ests','1','1','1','1') > > Warning (512): SQL Error: 20: datatype mismatch [CORE/cake/libs/model/ > datasources/dbo_source.php, line 440] > > Basicaly I get datatype mismatch errors because CakePHP fails to > either: > > auto_increment the primary_id > -or- > neglect to insert the 'id' and just let sql do the work > > is anyone else having problems with this? Is there anything I can do > besides amend the source code? Any opinions? > > Thanks in advance. > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
xmlhelper cake 1.2.0.5875
hello, i'm using the xmlhelper to convert a findall() array, with Model associations, into XML. Everything works as planned, except that the name of the xml nodes that are model associations are labeled instead of if they are nested within another xml node and contain values. eg: as you can see, service_day is preserved as well as service_time,service_weather_type if they contain no values. But if they do contain any values, the node name becomes std_class. Anyone know how to keep the associated name for the node? thx in advance. -bmiles cake v. 1.2.0.5875 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
So, there is no public callback wedged between the query on "this" model and the queries for the associated models? Too bad. I guess I will have to drop the idea of using associations and instead load the data in afterFind() or possible even in the controller. Some more details: I am developing with the intent of running the application on a dedicated server (or number thereof) with php5 and mysql5 (pretty standard LAMP setup). What I am doing is creating a filter (well... trying to anyway) that will filter a table of people (contacts) based on data stored in the contacts table. It would make life easy for views and controllers if I could just call for a filter called "people with big feet" and loading this filter also loads relevant contacts (WHERE Contact.shoe_size > 43 or something). Filter-rules can be edited until you get the ultimate selection of people... this will naturally be used for marketing and not cancer-research or anything noble like that. Building this dynamic "relationship" without hasMany is not big problem. It would just be super-über-cool to do it that way. That is why I am spending precious time trying to bend Cake to my will :) If you, or anyone else, has any further tips please feel free... If not, thanks to grigri for your info so far. it was helpful. On Jan 15, 11:06 am, grigri <[EMAIL PROTECTED]> wrote: > Yeah, the foreignKey => false bit is quite recent. > > For some reason support for beforeFind on associated models is not > being planned, as far as I know. > > This is a really big issue for code like the TranslationBehavior which > can't translate its associated models (do a search on this group and > you'll see). > > a quote from gwoo: > > > we have discussed this internally, and have determined that for now > > running beforeFind on associations will cause problems with overhead and > > conflicts. > > Most certainly this is not a bug. It is a known limitation of the > > beforeFind callback. > > and from nate: > > > The overhead required for enabling this would not be worth it's limited > > usefulness. Create a behavior. > > Personally I'd like to see this issue resolved, but I understand that > it could be tricky to code efficiently and there are more important > things to do to the cake core. > > I must say though, your requirements do look quite difficult. > Obviously it depends enormously on the amount of rules and associated > data you will have stored (hundreds? thousands? millions?). The naive > implementation (post-process record by record using afterFind) would > generate a lot of SQL calls and would slow your application down quite > a bit, although judicious use of caching could improve this. > > I'm sure it's possible to come up with a better idea though, can you > give some more detailed information on your table structure? And what > database system + version you're using, in case we need anything > specific. > > On Jan 15, 9:35 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > The reason I was using finderQuery for these early tests was that > > 'foreignKey'=>false gave me errors. Could be Cake 1.2 beta problem > > with that one possibly. > > > My biggest problem though is finding a callback to do the setting of > > the conditions/finderQuery. > > Rule::beforeFind() - I don't have the data from the rules table. > > Rule::afterFind() - I have the data but I also already have the > > associated data. > > > The sequence I a getting from debug calls is: > > Rule::beforeFind > > Contact::afterFind > > Rule::afterFind > > (that's right. no beforeFind from the associated model even using > > normal hasMany without finderQuery) > > > On Jan 15, 10:22 am, grigri <[EMAIL PROTECTED]> wrote: > > > > You can use just the 'conditions' key if you set 'foreignKey' to > > > false. Using finderQuery doesn't activate all the automagic binding > > > and whatnot, so this is probably a better idea. > > > >https://trac.cakephp.org/ticket/3323https://trac.cakephp.org/changese... > > > > On Jan 15, 8:56 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > And of-course when I wrote conditions I was really talking about > > > > "finderQuery". Sorry. > > > > > On Jan 15, 9:32 am, "[EMAIL PROTECTED]" > > > > > <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I have a question that hasn't been on the table much. It is a bit of > > > > > an oddball scenario. > > > > > > Can I use dynamic data from the model's table in the "conditions" for > > > > > an association? > > > > > > I have a model that stores filter-rules. e.g. "email is from > > > > > cakephp.org" or "age is more than 40" things of this nature. These are > > > > > representative of an appropriate where-clause that finds the > > > > > corresponding items in another model filled with "people". > > > > > > It all works when I "manually" search out the people. What would be > > > > > cool is if I could very cleanly use Cake's associations in some way. > > > > > > I can use the hasMany property cal
Re: Postgres and Build 1.2.0.6311
The update and delete issue has been fixed in the latest SVN (along with a sequences fix too), I only noticed the integer-as-string thing you mentioned late in the day yesterday, I don't know whether this has had a Ticket or fix yet (my SVN copy is a few days old). I should have some time to investigate today and create a ticket for the devs if theres not one already there. Charlie On Jan 15, 2:43 am, "pixelaté" <[EMAIL PROTECTED]> wrote: > Hey, first up; I think Cake is an awesome framework. It makes website > development extremely easy! Thanks for the product and keep up the > good work! > > I was using the an earlier build of cake and everything was working > relatively well - I did have an issue where I have to restart apache > every 6 hours because the server stops responding but I've been > ignoring that hoping that future releases will fix it. > > Anyways, I decided up upgrade and had mammoth problems with postgres. > > Long story short, I had a problem with postgres updates and deletes. I > found cryptic bug messages on using test prefixes and other things > which I have no idea what they mean. Instead I just went and upgraded > my dbo_source.php and dbo_postgres.php from the svn repository. That > seemed to fix most of my issues. > > The other issue I ended up having was cake wasn't addressing data > types. It was treating all of my database fields as strings. > > Trying to enter in an empty number resulted in an error as cake was > trying to enter in an empty string rather than a null. Very > frustrating. > > I gave up and reverted to the old version and it's running again. I > hope this will be fixed soon :( > > Just thought I'd throw my experiences in. > > Cheers, > > Ian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions, redirects and setFlash
ok... does anyone know why the following the the router are being deprecated? 00503 /** 00504 * Deprecated 00505 * 00506 */ 00507 $_this->connect('/bare/:controller/:action/*', array('bare' => '1')); 00508 $_this->connect('/ajax/:controller/:action/*', array('bare' => '1')); I had to mod the ajax one to: 00508 $_this->connect('/ajax/:controller/:action/*', array('bare' => '1', 'ajax' => '1')); So that I could mod the sessionComponent to start the session if it was a ajax call. sessionComponent... lines 79 - 86: function initialize(&$controller) { if (isset($controller->params['bare'])) { $this->__bare = $controller->params['bare']; } if (isset($controller->params['ajax'])) { $this->__ajax = $controller->params['ajax']; } } lines 298 - 312: function __start(){ print_r($this->__webservice); if ($this->__started === false) { //if ($this->__bare === 0) { if ($this->__bare === 0 || ($this->__ajax == 1 && $this->__bare === 1)) { if (!$this->id() && parent::start()) { $this->__started = true; parent::_checkValid(); } else { $this->__started = parent::start(); } } } return $this->__started; } What are webserivce ones becoming and will session state be maintainable with webservices and ajax? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
Yeah, the foreignKey => false bit is quite recent. For some reason support for beforeFind on associated models is not being planned, as far as I know. This is a really big issue for code like the TranslationBehavior which can't translate its associated models (do a search on this group and you'll see). a quote from gwoo: > we have discussed this internally, and have determined that for now > running beforeFind on associations will cause problems with overhead and > conflicts. > Most certainly this is not a bug. It is a known limitation of the beforeFind > callback. and from nate: > The overhead required for enabling this would not be worth it's limited > usefulness. Create a behavior. Personally I'd like to see this issue resolved, but I understand that it could be tricky to code efficiently and there are more important things to do to the cake core. I must say though, your requirements do look quite difficult. Obviously it depends enormously on the amount of rules and associated data you will have stored (hundreds? thousands? millions?). The naive implementation (post-process record by record using afterFind) would generate a lot of SQL calls and would slow your application down quite a bit, although judicious use of caching could improve this. I'm sure it's possible to come up with a better idea though, can you give some more detailed information on your table structure? And what database system + version you're using, in case we need anything specific. On Jan 15, 9:35 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > The reason I was using finderQuery for these early tests was that > 'foreignKey'=>false gave me errors. Could be Cake 1.2 beta problem > with that one possibly. > > My biggest problem though is finding a callback to do the setting of > the conditions/finderQuery. > Rule::beforeFind() - I don't have the data from the rules table. > Rule::afterFind() - I have the data but I also already have the > associated data. > > The sequence I a getting from debug calls is: > Rule::beforeFind > Contact::afterFind > Rule::afterFind > (that's right. no beforeFind from the associated model even using > normal hasMany without finderQuery) > > On Jan 15, 10:22 am, grigri <[EMAIL PROTECTED]> wrote: > > > You can use just the 'conditions' key if you set 'foreignKey' to > > false. Using finderQuery doesn't activate all the automagic binding > > and whatnot, so this is probably a better idea. > > >https://trac.cakephp.org/ticket/3323https://trac.cakephp.org/changese... > > > On Jan 15, 8:56 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > And of-course when I wrote conditions I was really talking about > > > "finderQuery". Sorry. > > > > On Jan 15, 9:32 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I have a question that hasn't been on the table much. It is a bit of > > > > an oddball scenario. > > > > > Can I use dynamic data from the model's table in the "conditions" for > > > > an association? > > > > > I have a model that stores filter-rules. e.g. "email is from > > > > cakephp.org" or "age is more than 40" things of this nature. These are > > > > representative of an appropriate where-clause that finds the > > > > corresponding items in another model filled with "people". > > > > > It all works when I "manually" search out the people. What would be > > > > cool is if I could very cleanly use Cake's associations in some way. > > > > > I can use the hasMany property caled "conditions" to statically put my > > > > filter-rule there for the whole class. But I would like to be able to > > > > use the table-data in the condition. Each record using it's own "rule- > > > > clause" Is this possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
I checked the tickets you posted. I am using the newly released beta (cake_1.2.0.6311) but I do still get an error when setting foreignKey to false. That is: cake sets it to the default model_id format and complains about the missing field. On Jan 15, 10:22 am, grigri <[EMAIL PROTECTED]> wrote: > > https://trac.cakephp.org/ticket/3323https://trac.cakephp.org/changeset/6258 > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
The reason I was using finderQuery for these early tests was that 'foreignKey'=>false gave me errors. Could be Cake 1.2 beta problem with that one possibly. My biggest problem though is finding a callback to do the setting of the conditions/finderQuery. Rule::beforeFind() - I don't have the data from the rules table. Rule::afterFind() - I have the data but I also already have the associated data. The sequence I a getting from debug calls is: Rule::beforeFind Contact::afterFind Rule::afterFind (that's right. no beforeFind from the associated model even using normal hasMany without finderQuery) On Jan 15, 10:22 am, grigri <[EMAIL PROTECTED]> wrote: > You can use just the 'conditions' key if you set 'foreignKey' to > false. Using finderQuery doesn't activate all the automagic binding > and whatnot, so this is probably a better idea. > > https://trac.cakephp.org/ticket/3323https://trac.cakephp.org/changeset/6258 > > On Jan 15, 8:56 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > And of-course when I wrote conditions I was really talking about > > "finderQuery". Sorry. > > > On Jan 15, 9:32 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a question that hasn't been on the table much. It is a bit of > > > an oddball scenario. > > > > Can I use dynamic data from the model's table in the "conditions" for > > > an association? > > > > I have a model that stores filter-rules. e.g. "email is from > > > cakephp.org" or "age is more than 40" things of this nature. These are > > > representative of an appropriate where-clause that finds the > > > corresponding items in another model filled with "people". > > > > It all works when I "manually" search out the people. What would be > > > cool is if I could very cleanly use Cake's associations in some way. > > > > I can use the hasMany property caled "conditions" to statically put my > > > filter-rule there for the whole class. But I would like to be able to > > > use the table-data in the condition. Each record using it's own "rule- > > > clause" Is this possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions, redirects and setFlash
Ok, traced it down to the bare variable and these lines in the session component: 00295 function __start(){ 00296 if ($this->__started === false) { 00297 if ($this->__bare === 0) { 00298 if (!$this->id() && parent::start()) { 00299 $this->__started = true; 00300 parent::_checkValid(); 00301 } else { 00302 $this->__started = parent::start(); 00303 } 00304 } 00305 } 00306 return $this->__started; 00307 } Is this intended functionality? What if the call needs to maintain a session state, but is a bare = 1, like an ajax call? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: v1.2 $beforeFilter property warning
What you want looks a lot like this article in the bakery: http://bakery.cakephp.org/articles/view/extended-beforefilter-snippet It explains a method of building an array of "before-filters" and a beforeFilter-function which loops the array running each filter in turn. The error you are seeing is from a check in dispatcher.php. I see no big problem with using the code from the bakery. Just rename the variable $beforeFilters or something and cake will be happy. On Jan 15, 5:04 am, Jeremi <[EMAIL PROTECTED]> wrote: > This is how I was using it, in my AppController class > class AppController extends Controller > { > public $components = array('RequestHandler'); > public $beforeFilter = array('setContent'); > > public function setContent() > { > $this->RequestHandler->setContent('json', 'text/x-json'); > } > ?> > > On Jan 14, 10:52 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > On Jan 14, 2008 10:42 PM, Jeremi <[EMAIL PROTECTED]> wrote: > > > > I am receiving the warning: > > > > Warning (512): Dispatcher::start - Controller::$beforeFilter property > > > usage is deprecated and will no longer be supported. Use > > > Controller::beforeFilter(). [CORE/cake/dispatcher.php, line 298] > > > > But I cannot figure out the proper way to use the method, can someone > > > please help? > > > Well... > > > beforeFilter is actually a method for a controller > > > class FooController extends AppController { > > function beforeFilter() { > > // do all you beforeFiltery stuff here > > } > > > } > > > In what context were you using $beforeFilter, as that is something > > that I have not seen before. > > > -- > > Chris Hartjes > > Internet Loudmouth > > Motto for 2008: "Moving from herding elephants to handling snakes..." > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
You can use just the 'conditions' key if you set 'foreignKey' to false. Using finderQuery doesn't activate all the automagic binding and whatnot, so this is probably a better idea. https://trac.cakephp.org/ticket/3323 https://trac.cakephp.org/changeset/6258 On Jan 15, 8:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > And of-course when I wrote conditions I was really talking about > "finderQuery". Sorry. > > On Jan 15, 9:32 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a question that hasn't been on the table much. It is a bit of > > an oddball scenario. > > > Can I use dynamic data from the model's table in the "conditions" for > > an association? > > > I have a model that stores filter-rules. e.g. "email is from > > cakephp.org" or "age is more than 40" things of this nature. These are > > representative of an appropriate where-clause that finds the > > corresponding items in another model filled with "people". > > > It all works when I "manually" search out the people. What would be > > cool is if I could very cleanly use Cake's associations in some way. > > > I can use the hasMany property caled "conditions" to statically put my > > filter-rule there for the whole class. But I would like to be able to > > use the table-data in the condition. Each record using it's own "rule- > > clause" Is this possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions, redirects and setFlash
I mean wouldn't On Jan 15, 11:05 am, lordG <[EMAIL PROTECTED]> wrote: > Ok, yeah, the print_r would work as the session has not been started > yet. > > However, there does appear to be a difference between when sessions > start for normal requests and ajax requests. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions, redirects and setFlash
Ok, yeah, the print_r would work as the session has not been started yet. However, there does appear to be a difference between when sessions start for normal requests and ajax requests. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions, redirects and setFlash
Does anyone have any further suggestions on this? I cake 1.1 my ajax calls would work 100% with a session security set to medium. With Cake 1.2 however they are no longer working. It seems to have something to do with the $_SESSION array being undefined when the response is received. Shouldn't the $_SESSION have the correct information in it? I do a print_r($_SESSION) right at the beginning of the index.php file and I get the undefined error. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HasMany Associations using no foreign key
And of-course when I wrote conditions I was really talking about "finderQuery". Sorry. On Jan 15, 9:32 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > I have a question that hasn't been on the table much. It is a bit of > an oddball scenario. > > Can I use dynamic data from the model's table in the "conditions" for > an association? > > I have a model that stores filter-rules. e.g. "email is from > cakephp.org" or "age is more than 40" things of this nature. These are > representative of an appropriate where-clause that finds the > corresponding items in another model filled with "people". > > It all works when I "manually" search out the people. What would be > cool is if I could very cleanly use Cake's associations in some way. > > I can use the hasMany property caled "conditions" to statically put my > filter-rule there for the whole class. But I would like to be able to > use the table-data in the condition. Each record using it's own "rule- > clause" Is this possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ok, I nailed it.. It's a unicode problem!
http://groups.google.com/group/cake-php/browse_thread/thread/610bc62336c1cb4b/2724fab26d98b9af?lnk=gst&q=validation+between#2724fab26d98b9af working on a solution :) phpjoy wrote: > Hey all, > > I'm having some (probably stupid) validation error. The 'address' > field always invalidates, regardless of the number of chars. > I ought to add that it happens *only* on "update" (edit), the adding > works perfectly! > > var $validate = array( > 'firstname' => array('rule' => array('between', 2, > 20),'message' => > 'יש להזין לפחות 2 תווים'), > 'lastname' => array('rule' => array('between', 2, 20),'message' > => > 'יש להזין לפחות 2 תווים'), > 'ssc' => array( > 'number' => array('rule' => array('numeric'),'message' > => 'יש להזין > תעודת זהות תקינה'), > 'between'=> array('rule' => array('between', 5, > 12),'message' => > 'יש להזין תעודת זהות תקינה')), > 'address' => array('rule' => array('between', 4, 20),'message' > => > 'יש להזין לפחות 4 תווים'), > 'city' => array('rule' => array('between', 2, 20),'message' => > 'יש > להזין לפחות 2 תווים'), > 'zipcode' => array('rule' => array('numeric'),'allowEmpty' => > true,'message' => 'יש להזין מספרים בלבד'), > 'pobox' => array('rule' => array('numeric'),'allowEmpty' => > true,'message' => 'יש להזין מספרים בלבד'), > 'homephone_num' => array('rule' => array('between', 9, > 20),'message' > => 'יש להזין מספר טלפון עם קידומת'), > 'cellphone_num' => array('rule' => array('between', 10, > 20),'message' => 'יש להזין לפחות 10 תווים') > ); > > I might have messed up the validation somewhere. > > edit_profile.ctp has this line in it: > > input('UserStaticProfile.address', > array('maxlength'=>20, 'class' => 'inputbox', 'label' => 'כתובת'));?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with latest beta on Media Temple
Hi Kevin I was modifying the CAKE_CORE_INCLUDE_PATH originally, so this could well have been the problem. I'm not sure how you restart Apache on a Media Temple Grid Service. On Jan 14, 2008 9:21 PM, Baz <[EMAIL PROTECTED]> wrote: > Not sure whether this will help or not, but I got this problem when > testing locally. I was modifying CAKE_CORE_INCLUDE_PATH to point to a > different cakePHP core folder. > > In one instance, clearing out the tmp folder fixed the problem, in another > instance restarting apache helped. > > Haven't encountered it again though. > -- > Kevin Lloyd > 3HN Designs > http://www.3HNDesigns.com/ > (214) 473-4207 > > > On Jan 14, 2008 3:02 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > > > Just incase anyone has the same problem I have managed to find a fix. > > Before I was editing the webroot/index.php with the new paths. Instead > > I uploaded everything into the domain folder on media temple and then > > created a symbolic link 'html' to point to 'webroot'. Since doing this > > it has all worked great. > > > > On Jan 14, 3:01 pm, "[EMAIL PROTECTED]" < [EMAIL PROTECTED]> > > wrote: > > > Hi > > > > > > There is no cached files, I have deleted them all and I have disabled > > > caching. > > > > > > On 14 Jan, 14:55, francky06l <[EMAIL PROTECTED]> wrote: > > > > > > > Regarding the error message I got when I tried your site, seems that > > > > the cached file content are incorrect (not an array). Did you check > > > > the files ? I mean edit them and check if they are serialized > > arrays? > > > > > > > On Jan 14, 3:48 pm, "[EMAIL PROTECTED]" < [EMAIL PROTECTED]> > > > > wrote: > > > > > > > > Hi Francky > > > > > > > > Thanks for your reply, unfortunately this did not work. Driving me > > > > > crazy, I just can't see anything wrong, and it happened as soon as > > > > > > > upgraded to the latest version. > > > > > > > > On 14 Jan, 13:37, francky06l <[EMAIL PROTECTED]> wrote: > > > > > > > > > It reminds me a problem I had with caching. The problem was > > coming > > > > > > from my last "Cache::config" declared in core.php because this > > one had > > > > > > "serialize => false" in it. > > > > > > I think this has been corrected, but my temporary solution was > > to make > > > > > > the last Cache::config set with serialize => true. After > > cleaning the > > > > > > tmp/cacke/persistent directory, everything was ok. > > > > > > > > > I really do not if this is linked, maybe just a hint. > > > > > > hth > > > > > > > > > On Jan 14, 9:55 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > > > > > wrote: > > > > > > > > > > Hi > > > > > > > > > > I was hoping someone could help me, I am hosting a site on > > Media > > > > > > > Temple Grid Service, using the method described here: > > > > > > > > > >http://walkerhamilton.com/435/setting-up-cake-on-the-new-gs > > > > > > > > > > It was all working great, until I updated to the latest beta > > of 1.2. I > > > > > > > am now getting a number errors including the fater error: > > > > > > > > > > Fatal error: Class 'Router' not found in > > /mnt/gs02/herd02/24139/ > > > > > > > domains/cake/dispatcher.php on line 333 > > > > > > > > > > The site is here: > > > > > > > > > >http://adiebodie.digitalbyname.com/ > > > > > > > > > > Can anyone help? > > > > > > > > > > Thanks > > > > > > > > > > Jono > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HasMany Associations using no foreign key
Hi, I have a question that hasn't been on the table much. It is a bit of an oddball scenario. Can I use dynamic data from the model's table in the "conditions" for an association? I have a model that stores filter-rules. e.g. "email is from cakephp.org" or "age is more than 40" things of this nature. These are representative of an appropriate where-clause that finds the corresponding items in another model filled with "people". It all works when I "manually" search out the people. What would be cool is if I could very cleanly use Cake's associations in some way. I can use the hasMany property caled "conditions" to statically put my filter-rule there for the whole class. But I would like to be able to use the table-data in the condition. Each record using it's own "rule- clause" Is this possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---