Re: Is it an insert or an update?

2009-08-13 Thread Martin Westin

I have not found any Cake function to handle it. I use query() to add
an "...ON DUPLICATE KEY..." for the one single place I need it. It is
a huge performance boost if you kan let MySQL do it compared to doing
a find to check before saving.

/Martin


On Aug 14, 3:58 am, Jamie  wrote:
> Basically, if the data you're saving has an id (or whatever the
> primary key of the model is), then the code will execute an update
> statement. Otherwise, it'll insert. You don't need to check
> beforehand, in other words, since the Cake code will determine from
> the data passed whether it should update or insert.
>
>
>
> Nancy wrote:
> > MySQL lets you use replace syntax if you have data and you don't know
> > if it's new or not.  Is there anything in Cakephp that'll let you do
> > that?   In other words, I don't know if the data I'm putting into my
> > database is brand spanking new or just updated.  I'd rather not have
> > to check and just let the database handle it, but not sure the
> > framework supports that.
>
> > Anyone know?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: No Error Messages

2009-08-13 Thread Dr. Loboto

Linux and Windows differs in filenames case sensitivity - Linux has
it, and in read/write permissions - you should set right permissions
and sometimes user/group on Linux. Check this first. If you think that
one of your models gives problems, check its filename to be strictly
lowercase.

On Aug 14, 2:11 am, RhythmicDevil  wrote:
> Hello,
> I am developing an app using Cake on my XP box using Apache 2.2, MySQL
> and SOAP. The app runs just fine on my XP machine. However when I move
> it to a Linux demo box all hell breaks loose. Whats making it really
> hard to debug is that I am getting no error output. Not on the screen,
> not in the logs and not in the Apache logs either no matter what I
> set: Configure::write('debug', 2); to. I know for sure that the debug
> level is not being over written as well.
>
> Currently I have to two sections to the app. One uses MySQL that works
> fine. One uses SOAP and I have a data source set up for it that seems
> to be giving me problems.
>
> I know there is an error because the browser title is set to "Errors"
> and the page only partially loads. This is all I get:
>
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
> Errors
>
>  rel="stylesheet" type="text/css" href="/css/ui.jqgrid.css" /> rel="stylesheet" type="text/css" href="/css/custom-theme/jquery-
> ui-1.7.2.custom.css" />
>
> All the views in the app use the same layout file and as I stated
> before they load just fine. The only thing that I can think of is that
> because this does not use a Model its causing some issue. But seeing
> as it the exact same code works on my XP I am completely at a loss for
> why this would be.
>
> Thanks for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validating user password after Auth

2009-08-13 Thread Martin Westin

When do you do this validation?
Saving a User record or logging n?

If it is logging in then IMHO all is fine. Auth should hash anything
that comes in. blank password = wrong pasword and all that...

If you are editing or creating users then you can name the password
field in the edit form to something like "new_password" and bypass
Auth. Then you use hash the password in the Model after validation but
before saving. That may not be the ultimate way to go, but it works.
Anyone with a better way please chime in.




On Aug 13, 6:44 pm, Adam  wrote:
> Auth with data validation in my User model doesn't pick up the
> notEmpty condition -- it hashes the empty string.
>
> Is this correct?
>
> Do i need to add custom validation to check for this? I cannot use
> $this->Auth->password() in a Model.
>
> Or is there a better way to handle this? Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search function

2009-08-13 Thread John Andersen

Hi Dave,

Congratulations on the job done!

Only one small issue/question, do you take into account, that words
may be in uppercase/lowercase?

Enjoy,
   John

On Aug 13, 11:02 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> This is what I ended up with and works.
>
> function __quickQuery($string, $rank, $auth)
>           {
>
>                  //create an array of search terms if more than 1 was
> entered
>                  $string = split(",", $string);
>
>                 $i=0;  // This is each counter
>                 // Now build your SQL String
>                 $sql = "";
>                 foreach ($string as $key => $value)
>                 {
>                         $value = trim($value);
>                         //strip white space befor and after each term
>                         $sql.= "Post.title LIKE '%" . $value . "%' OR
> Post.description LIKE '%" . $value . "%'";
>                         $i++;  // Put your counter up by 1
>                         if($i < count($string))  // Check if your counter is
> smaller than amount of values in array, if there are still values, add a OR
>                         {
>             $sql.=" OR ";
>                         }
>                 }
>
>                 $params = array(
>                                                         'conditions' =>
> array('Post.status' => 0 , 'Post.rank <=' => $rank, $sql),
>                                                          So on
> and on
>                                                         )));
>
>                          $q = $this->find('all', $params);
>
>                  return $q;
>
>           }
>
> Pass the $sql to the conditions and I end up with
> Post.title LIKE '%mary%' OR Post.description LIKE '%mary%' OR Post.title
> LIKE '%test%' OR Post.description LIKE '%test%' OR Post.title LIKE
> '%something%' OR Post.description LIKE '%something%'
>
> -Original Message-
> From: Luke [mailto:eik...@hotmail.com]
> Sent: August-12-09 1:45 PM
> To: CakePHP
> Subject: Re: Search function
>
> You are missing a few OR in your below text, I have tried it out and get all
> the needed OR, did you just keft it out below or what is the issue?
> Oh and by the way of course you will need a WHERE aswell in the first part
> $sql = "SELECT * FROM table"; I forgot that one.
>
> On 12 Aug., 17:00, "Dave Maharaj :: WidePixels.com"
>  wrote:
> > Yeah that's the basic idea to build the  "Post.title LIKE '%" . $value.
> "%'
> > OR Post.description LIKE '%" . $value . "%' "; string from the user
> > submitted text
>
> > So if there are 3 words it ends up "Post.title LIKE '%" . $value. "%'
> > OR Post.description LIKE '%" . $value . "%' ";"Post.title LIKE '%" .
> $value.
> > "%' OR Post.description LIKE '%" . $value . "%' ";"Post.title LIKE '%" .
> > $value. "%' OR Post.description LIKE '%" . $value . "%' ";
>
> > -Original Message-
> > From: Luke [mailto:eik...@hotmail.com]
> > Sent: August-12-09 11:43 AM
> > To: CakePHP
> > Subject: Re: Search function
>
> > Hi Dave,
>
> > Maybe not the nicest solution, but this should work:
>
> > $i=0;  // This is your counter
>
> > // Now build your SQL String
> > $sql = "SELECT * FROM table";
>
> > foreach ($string as $key => $value)
> > {                         $value = trim($value);
>
> >                          //strip white space befor and after each term
> >                         // $value = trim($string[$i]);
> >                          $sql.= "Post.title LIKE '%" . $value. "%' OR
> > Post.description LIKE '%" . $value . "%' ";
>
> >      $i++;  // Put your counter up by 1
> >      if($i < count($string))  // Check if your counter is smaller than
> > amount of values in array, if there are still values, add a OR
> >      {
> >             $sql.="OR";
> >      }
> > }
>
> > You can try out by putting in echo $sql at the end.
>
> > Is this what you were looking for or did I missunderstood?
>
> > Luke- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unknown top margin in layout

2009-08-13 Thread delocalizer

Hi,
(your link to 'css-code' doesn't show any css so it's hard to tell,
but...)
just looks like some padding in the header div or one of its
children.
Note that the cake.generic.css has the following style:
#header{
padding: 10px 20px;
}
and you have a div with id=header, so unless you've overridden this
somewhere it's no surprise...


On Aug 14, 7:11 am, MASTER-UA  wrote:
> I have spent all this day to find decision of my problem. I couldn't
> (( I ask you for help!
>
> This is my project 
> header:http://picasaweb.google.com/lh/photo/0One86YagXvaYLagEsBlnQ?feat=dire...
>
> This is it's 
> css-codehttp://picasaweb.google.com/lh/photo/WMZwY0ba_OvDzM143LUrqQ?feat=dire...
>
> This is CakePHP 
> result:http://picasaweb.google.com/Masterr.UA/CakePHP#5369555370927441378
>
> This is CakePHP layout 
> code:http://picasaweb.google.com/lh/photo/WMZwY0ba_OvDzM143LUrqQ?feat=dire...
>
> WHERE this margin can be?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is it an insert or an update?

2009-08-13 Thread Jamie

Basically, if the data you're saving has an id (or whatever the
primary key of the model is), then the code will execute an update
statement. Otherwise, it'll insert. You don't need to check
beforehand, in other words, since the Cake code will determine from
the data passed whether it should update or insert.

Nancy wrote:
> MySQL lets you use replace syntax if you have data and you don't know
> if it's new or not.  Is there anything in Cakephp that'll let you do
> that?   In other words, I don't know if the data I'm putting into my
> database is brand spanking new or just updated.  I'd rather not have
> to check and just let the database handle it, but not sure the
> framework supports that.
>
> Anyone know?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread technicaltitch

Sorry again - ignore the last two posts - they were because I'd added
AddModule mod_rewrite.c to Apache 2

On Aug 14, 1:32 am, technicaltitch  wrote:
> By they don't 'work', I mean the browser says "Not Found. The
> requested URL /users/admin_index was not found on this server."
>
> On Aug 14, 1:29 am, technicaltitch  wrote:
>
>
>
> > Sorry forgot to say - that is the homepage, which route.php seems to
> > be successfully redirecting to the articles_controller
> > volunteer_animal_refuge method. I can't get the direct URLs to work,
> > eg,http://localhost:8080/users/admin_indexorhttp://localhost:8080/public...
>
> > On Aug 14, 1:24 am, technicaltitch  wrote:
>
> > > These are the error messages on my local setup:
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\object.php on line 94
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> > > on line 84
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> > > on line 107
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\security.php on line 48
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\inflector.php on line 65
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\configure.php on line 89
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 157
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 221
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > > line 308
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > > line 347
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > > line 535
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > > line 805
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\controller\component.php on
> > > line 125
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\view\view.php on line 687
>
> > > Deprecated: Assigning the return value of new by reference is
> > > deprecated in C:\wamp\www\cake\cake\libs\class_registry.php on line 55
>
> > > Warning: call_user_func_array() expects parameter 2 to be array, null
> > > given in C:\wamp\www\cake\cake\dispatcher.php on line 263
>
> > > Notice: Undefined variable: banner_image in C:\wamp\www\cake\app\views
> > > \layouts\public_site.thtml on line 42
>
> > > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 2
>
> > > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 2
>
> > > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > > \elements\LangsAndMotto.thtml on line 13
>
> > > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > > \elements\LangsAndMotto.thtml on line 16
>
> > > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > > \app\views\elements\HtmlBlock.thtml on line 8
> > > Html Block motto_esp not found.
>
> > > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 27
>
> > > Notice: Undefined variable: main_menu in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 27
>
> > > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > > \app\views\elements\Menu.thtml on line 8
>
> > > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 30
>
> > > Notice: Undefined variable: sub_menu in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 30
>
> > > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > > \app\views\elements\Menu.thtml on line 8
>
> > > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 33
>
> > > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > > \articles\volunteer_animal_refuge.thtml on line 36
>
> > > Warning: Invalid argu

Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread technicaltitch

By they don't 'work', I mean the browser says "Not Found. The
requested URL /users/admin_index was not found on this server."

On Aug 14, 1:29 am, technicaltitch  wrote:
> Sorry forgot to say - that is the homepage, which route.php seems to
> be successfully redirecting to the articles_controller
> volunteer_animal_refuge method. I can't get the direct URLs to work,
> eg,http://localhost:8080/users/admin_indexorhttp://localhost:8080/public_html/users/admin_index
>
> On Aug 14, 1:24 am, technicaltitch  wrote:
>
>
>
> > These are the error messages on my local setup:
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\object.php on line 94
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> > on line 84
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> > on line 107
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\security.php on line 48
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\inflector.php on line 65
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\configure.php on line 89
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 157
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 221
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > line 308
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > line 347
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > line 535
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> > line 805
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\controller\component.php on
> > line 125
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\view\view.php on line 687
>
> > Deprecated: Assigning the return value of new by reference is
> > deprecated in C:\wamp\www\cake\cake\libs\class_registry.php on line 55
>
> > Warning: call_user_func_array() expects parameter 2 to be array, null
> > given in C:\wamp\www\cake\cake\dispatcher.php on line 263
>
> > Notice: Undefined variable: banner_image in C:\wamp\www\cake\app\views
> > \layouts\public_site.thtml on line 42
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 2
>
> > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 2
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \elements\LangsAndMotto.thtml on line 13
>
> > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > \elements\LangsAndMotto.thtml on line 16
>
> > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > \app\views\elements\HtmlBlock.thtml on line 8
> > Html Block motto_esp not found.
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 27
>
> > Notice: Undefined variable: main_menu in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 27
>
> > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > \app\views\elements\Menu.thtml on line 8
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 30
>
> > Notice: Undefined variable: sub_menu in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 30
>
> > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > \app\views\elements\Menu.thtml on line 8
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 33
>
> > Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on line 36
>
> > Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> > \app\views\elements\HtmlBlock.thtml on line 8
> > Html Block main_menu_blurb_esp not found.
> > [admin click here]
>
> > Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> > \articles\volunteer_animal_refuge.thtml on lin

Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread technicaltitch

Sorry forgot to say - that is the homepage, which route.php seems to
be successfully redirecting to the articles_controller
volunteer_animal_refuge method. I can't get the direct URLs to work,
eg, http://localhost:8080/users/admin_index or
http://localhost:8080/public_html/users/admin_index

On Aug 14, 1:24 am, technicaltitch  wrote:
> These are the error messages on my local setup:
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\object.php on line 94
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> on line 84
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
> on line 107
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\security.php on line 48
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\inflector.php on line 65
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\configure.php on line 89
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 157
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 221
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> line 308
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> line 347
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> line 535
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
> line 805
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\controller\component.php on
> line 125
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\view\view.php on line 687
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\wamp\www\cake\cake\libs\class_registry.php on line 55
>
> Warning: call_user_func_array() expects parameter 2 to be array, null
> given in C:\wamp\www\cake\cake\dispatcher.php on line 263
>
> Notice: Undefined variable: banner_image in C:\wamp\www\cake\app\views
> \layouts\public_site.thtml on line 42
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 2
>
> Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 2
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \elements\LangsAndMotto.thtml on line 13
>
> Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> \elements\LangsAndMotto.thtml on line 16
>
> Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> \app\views\elements\HtmlBlock.thtml on line 8
> Html Block motto_esp not found.
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 27
>
> Notice: Undefined variable: main_menu in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 27
>
> Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> \app\views\elements\Menu.thtml on line 8
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 30
>
> Notice: Undefined variable: sub_menu in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 30
>
> Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> \app\views\elements\Menu.thtml on line 8
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 33
>
> Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 36
>
> Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> \app\views\elements\HtmlBlock.thtml on line 8
> Html Block main_menu_blurb_esp not found.
> [admin click here]
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 59
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 74
>
> Notice: Undefined variable: article in C:\wamp\www\cake\app\views
> \articles\volunteer_animal_refuge.thtml on line 77
>
> Notice: Undefined variable: news_menu in C:\wamp\www\cake\app\views
> \articles

Re: wtf find id=1

2009-08-13 Thread AgBorkowski

$this->Position->find('all',array('conditions' => 'position_id = '.
$id,'fields'=>'position,position_id') this working fine...
9   SELECT `Position`.`position`, `Position`.`position_id` FROM
`mgt_positions` AS `Position` WHERE position_id = 3

fucking stupid bug

On 14 Sie, 02:18, "andrzejborkow...@gmail.com"
 wrote:
> fk find(){
> echo $id; //3
>                         debug($this->Position->find('all',array('conditions' 
> => array
> ('position_id'=>$id),'fields'=>'position,position_id')));
>
> }
>
> at page
> miopromo\controllers\signups_controller.php (line 70)
>
> Array
> (
>     [0] => Array
>         (
>             [Position] => Array
>                 (
>                     [position] => Wlasciciel/Wspolwlasciciel
>                     [position_id] => 1
>                 )
>
>         )
>
> 9       SELECT `Position`.`position`, `Position`.`position_id` FROM
> `mgt_positions` AS `Position` WHERE `position_id` = 1
>
> WTF ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



wtf find id=1

2009-08-13 Thread andrzejborkow...@gmail.com

fk find(){
echo $id; //3
debug($this->Position->find('all',array('conditions' => 
array
('position_id'=>$id),'fields'=>'position,position_id')));
}

at page
miopromo\controllers\signups_controller.php (line 70)

Array
(
[0] => Array
(
[Position] => Array
(
[position] => Wlasciciel/Wspolwlasciciel
[position_id] => 1
)

)



9   SELECT `Position`.`position`, `Position`.`position_id` FROM
`mgt_positions` AS `Position` WHERE `position_id` = 1

WTF ?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread technicaltitch

Definitely possible to upgrade CakePHP - will try when I get my dev
version working.

Realised I had phpBB and phpMyChat installed, have uninstalled
phpMyChat to no avail but not phpBB as we want to keep it.

Tried a higher debug level but the page displayed is just the homepage
with no trace of the failed save in. It was previously level 1 but
thanks for the tip Bert!

Having trouble installing a local version - currently the images
appear fine but the Cake variables are all undeclared. I've just
grabbed the code on the server and put it in the Apache www folder
(installed using Wamp). I've duplicated the database setup and
directory structure so database.php and index.php are still valid
(index.php is all relative to __FILE__). I've checked .htaccess, added
mod-rewrite in httpd.conf, changed to port 8080 so it doesn't clash
with IIS. My directory structure is:
root->cake->cake and root->cake->app and root->public_html and I've
changed the Apache DocRoot to root->public_html and ensured
AllowOverride All

Sorry for the stupid questions
Chris

On Aug 13, 10:54 am, Bert Van den Brande  wrote:
> Are you working in CakePHP debug mode ? I would advise setting the
> debug level to 2 , this would output performed sql queries which can
> be usefull in this case to find the cause of the error.
>
> Also, come to think of it ... I think Cake gives 404 errors when in
> production mode (debug level 0), thus hiding the real error message.
>
> Good luck !
>
> On Wed, Aug 12, 2009 at 12:45 PM,
>
>
>
> technicaltitch wrote:
>
> > Thanks hugely delocalizer and bert and anyone else who reads this. I
> > am trying to get the site working on Apache locally (I did have it but
> > the hard disk crashed a couple months ago and I'm struggling hence the
> > delay).
>
> > I hadn't come across debugging PHP before - sounds very useful. What
> > is the generally recommended setup for debugging PHP? I've found a
> > couple Eclipse plugins - EclipsePDT based on xdebug and PHPeclipse
> > which seems more basic.
>
> > The string length does not seem relevant - the two strings currently
> > isolated are:
>
> >http://geocities.com/      [ed: this is not a link - this is the text
> > I enter into the text field that creates the error]
>
> > and the two Spanish sentences in my original post starting "Los
> > animales silvestres..." - either of the sentences on its own does not
> > crash, just the pair together.
>
> > I don't specify the string length in the CakePHP, and it happens to
> > both varchar(255) and blob database fields (mysql 5).
>
> > By 404 I mean that when I press submit, it redirects to the homepage,
> > which is exactly what it does if I type in a non-existent URL. I'm not
> > sure what is doing this but if I can figure it out I'll create a 404
> > page to confirm.
>
> > Thanks hugely
> > Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread technicaltitch

These are the error messages on my local setup:

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\object.php on line 94

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
on line 84

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\model\connection_manager.php
on line 107

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\security.php on line 48

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\inflector.php on line 65

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\configure.php on line 89

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 157

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\dispatcher.php on line 221

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
line 308

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
line 347

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
line 535

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\controller\controller.php on
line 805

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\controller\component.php on
line 125

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\view\view.php on line 687

Deprecated: Assigning the return value of new by reference is
deprecated in C:\wamp\www\cake\cake\libs\class_registry.php on line 55

Warning: call_user_func_array() expects parameter 2 to be array, null
given in C:\wamp\www\cake\cake\dispatcher.php on line 263

Notice: Undefined variable: banner_image in C:\wamp\www\cake\app\views
\layouts\public_site.thtml on line 42


Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 2

Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 2

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\elements\LangsAndMotto.thtml on line 13

Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
\elements\LangsAndMotto.thtml on line 16

Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
\app\views\elements\HtmlBlock.thtml on line 8
Html Block motto_esp not found.


Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 27

Notice: Undefined variable: main_menu in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 27

Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
\app\views\elements\Menu.thtml on line 8

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 30

Notice: Undefined variable: sub_menu in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 30

Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
\app\views\elements\Menu.thtml on line 8

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 33

Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 36

Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
\app\views\elements\HtmlBlock.thtml on line 8
Html Block main_menu_blurb_esp not found.
[admin click here]


Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 59

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 74

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 77

Notice: Undefined variable: news_menu in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 77

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\elements\NewsMenu.thtml on line 11
Noticias:

Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
\app\views\elements\NewsMenu.thtml on line 24

Notice: Undefined variable: article in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 82

Notice: Undefined variable: html_blocks in C:\wamp\www\cake\app\views
\articles\volunteer_animal_refuge.thtml on line 85

Warning: Invalid a

RE: Paginate from an array help - Sorry disregard!

2009-08-13 Thread Dave Maharaj :: WidePixels.com
I got it...
 
Sorry.
 
Dave

  _  

From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: August-13-09 7:50 PM
To: cake-php@googlegroups.com
Subject: Paginate from an array help


I run my find query, get all the data I need but cant figure out how to then
pass it off to paginate.
 
$test = $this->Post->__quickQuery($string,$this->Auth->user(rank'),
$this->Auth->user('id'));
  debug($test);
...spits out my array of records found
 
but how do i then pass $test to paginate?
 
Thanks,
 
Dave




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Paginate from an array help

2009-08-13 Thread Dave Maharaj :: WidePixels.com
I run my find query, get all the data I need but cant figure out how to then
pass it off to paginate.
 
$test = $this->Post->__quickQuery($string,$this->Auth->user(rank'),
$this->Auth->user('id'));
  debug($test);
...spits out my array of records found
 
but how do i then pass $test to paginate?
 
Thanks,
 
Dave

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unknown top margin in layout

2009-08-13 Thread Piotr Kilczuk

Hello,

> WHERE this margin can be?

I suggest you installed Firebug, great for such problems.


Regards,
Piotr

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unknown top margin in layout

2009-08-13 Thread Miles J

I think you linked some wrong images.

Try putting body { padding: 0; } and also taking a screenshot of the
source in CakePHP.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Unknown top margin in layout

2009-08-13 Thread MASTER-UA

I have spent all this day to find decision of my problem. I couldn't
(( I ask you for help!

This is my project header:
http://picasaweb.google.com/lh/photo/0One86YagXvaYLagEsBlnQ?feat=directlink

This is it's css-code
http://picasaweb.google.com/lh/photo/WMZwY0ba_OvDzM143LUrqQ?feat=directlink

This is CakePHP result:
http://picasaweb.google.com/Masterr.UA/CakePHP#5369555370927441378

This is CakePHP layout code:
http://picasaweb.google.com/lh/photo/WMZwY0ba_OvDzM143LUrqQ?feat=directlink


WHERE this margin can be?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Translate behavior and ordering/searching

2009-08-13 Thread 3lancer.eu

Hello,

Any idea how can I make for example pagination use the current locale
in a model that $actsAs Translate?

Any help would be great.


Regards,
Piotr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model name bug

2009-08-13 Thread Miles J

Its not a bug. If Cake cant find your model, it will load the AppModel
object in its place.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DeleteQuery in HABTM is like 'dependent'=> true in hasMany associations?

2009-08-13 Thread José Pablo Orozco Marín

Nice, we got it! Just using deleteAll before the normal Listing->del

...
   
/* 
-- */
   
   
$conditionsArticle = array('Article.listing_id'=> (int) $id);
   
$conditionsImage = array('Image.listing_id'=> (int) $id);
   

/* 
-- */
   
   
$this->Listing->Article->deleteAll($conditionsArticle, true, true);
$this->Listing->Image->deleteAll($conditionsImage, true, true);
$this->Listing->Catalog->deleteAll($conditionsCatalog, true, true);
   
   
/* 
-- */
   
   
if ($this->Listing->del((int) $id, true)) {

...


delocalizer wrote:
> Hi Josoroma;
> This nice post: (http://groups.google.com/group/cake-php/msg/
> c10840be78a34df0) although it is about finderQuery, will probably help
> you a lot. I have to ask though - you sure you want to delete the Tags
> themeselves and not just the ArticlesTags associations? What happens
> if a Tag is shared between an article being deleted and one that
> isn't? Or now that I think about it what you probably want is to
> delete Tags that no longer belong to any Articles - in which case you
> could also put some logic in your Article model afterDelete that calls
> delete on unassociated Tags. Just a thought.
>
> On Aug 13, 3:34 am, Josoroma  wrote:
>   
>> Im using the following structure:
>>
>> User hasMany Listing
>> Listing hasMany Contacts
>> Listings hasAndBelongsToMany Articles
>> Articles hasMany Tags
>>
>> When i delete a User or a Listing all their associated Listings and
>> Articles are successfully deleted. But not their Tags. Listings and
>> Articles are deleted because we are using 'dependent'=> true in the
>> hasMany Model Structure. But how can i delete the Tags of the Articles
>> associated? do i have to use deleteQuery to achieve 
>> that?http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
>>
>> I was searching in Google and there is not tutorial or post related to
>> deleteQuery in HABTM associations.
>>
>> An example will help us a lot.
>>
>> Thanks in advance.
>> 
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Search function

2009-08-13 Thread Dave Maharaj :: WidePixels.com

This is what I ended up with and works.

function __quickQuery($string, $rank, $auth)
  {
 
 //create an array of search terms if more than 1 was
entered
 $string = split(",", $string);
 
$i=0;  // This is each counter
// Now build your SQL String
$sql = "";
foreach ($string as $key => $value)
{
$value = trim($value);
//strip white space befor and after each term
$sql.= "Post.title LIKE '%" . $value . "%' OR
Post.description LIKE '%" . $value . "%'";
$i++;  // Put your counter up by 1
if($i < count($string))  // Check if your counter is
smaller than amount of values in array, if there are still values, add a OR
{
$sql.=" OR ";
}
}



$params = array(
'conditions' =>
array('Post.status' => 0 , 'Post.rank <=' => $rank, $sql),
 So on
and on 
)));
 
 
 
 $q = $this->find('all', $params);
 

 return $q;
  
  
  }

Pass the $sql to the conditions and I end up with 
Post.title LIKE '%mary%' OR Post.description LIKE '%mary%' OR Post.title
LIKE '%test%' OR Post.description LIKE '%test%' OR Post.title LIKE
'%something%' OR Post.description LIKE '%something%'

-Original Message-
From: Luke [mailto:eik...@hotmail.com]
Sent: August-12-09 1:45 PM
To: CakePHP
Subject: Re: Search function


You are missing a few OR in your below text, I have tried it out and get all
the needed OR, did you just keft it out below or what is the issue?
Oh and by the way of course you will need a WHERE aswell in the first part
$sql = "SELECT * FROM table"; I forgot that one.


On 12 Aug., 17:00, "Dave Maharaj :: WidePixels.com"
 wrote:
> Yeah that's the basic idea to build the  "Post.title LIKE '%" . $value.
"%'
> OR Post.description LIKE '%" . $value . "%' "; string from the user 
> submitted text
>
> So if there are 3 words it ends up "Post.title LIKE '%" . $value. "%' 
> OR Post.description LIKE '%" . $value . "%' ";"Post.title LIKE '%" .
$value.
> "%' OR Post.description LIKE '%" . $value . "%' ";"Post.title LIKE '%" .
> $value. "%' OR Post.description LIKE '%" . $value . "%' ";
>
>
>
> -Original Message-
> From: Luke [mailto:eik...@hotmail.com]
> Sent: August-12-09 11:43 AM
> To: CakePHP
> Subject: Re: Search function
>
> Hi Dave,
>
> Maybe not the nicest solution, but this should work:
>
> $i=0;  // This is your counter
>
> // Now build your SQL String
> $sql = "SELECT * FROM table";
>
> foreach ($string as $key => $value)
> {                         $value = trim($value);
>
>                          //strip white space befor and after each term
>                         // $value = trim($string[$i]);
>                          $sql.= "Post.title LIKE '%" . $value. "%' OR 
> Post.description LIKE '%" . $value . "%' ";
>
>      $i++;  // Put your counter up by 1
>      if($i < count($string))  // Check if your counter is smaller than 
> amount of values in array, if there are still values, add a OR
>      {
>             $sql.="OR";
>      }
> }
>
> You can try out by putting in echo $sql at the end.
>
> Is this what you were looking for or did I missunderstood?
>
> Luke- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



No Error Messages

2009-08-13 Thread RhythmicDevil

Hello,
I am developing an app using Cake on my XP box using Apache 2.2, MySQL
and SOAP. The app runs just fine on my XP machine. However when I move
it to a Linux demo box all hell breaks loose. Whats making it really
hard to debug is that I am getting no error output. Not on the screen,
not in the logs and not in the Apache logs either no matter what I
set: Configure::write('debug', 2); to. I know for sure that the debug
level is not being over written as well.

Currently I have to two sections to the app. One uses MySQL that works
fine. One uses SOAP and I have a data source set up for it that seems
to be giving me problems.

I know there is an error because the browser title is set to "Errors"
and the page only partially loads. This is all I get:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">

Errors



All the views in the app use the same layout file and as I stated
before they load just fine. The only thing that I can think of is that
because this does not use a Model its causing some issue. But seeing
as it the exact same code works on my XP I am completely at a loss for
why this would be.

Thanks for any help.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Is it an insert or an update?

2009-08-13 Thread Nancy

MySQL lets you use replace syntax if you have data and you don't know
if it's new or not.  Is there anything in Cakephp that'll let you do
that?   In other words, I don't know if the data I'm putting into my
database is brand spanking new or just updated.  I'd rather not have
to check and just let the database handle it, but not sure the
framework supports that.

Anyone know?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



"Cake is able to connect to the database" message doesn't show up

2009-08-13 Thread Ken

"Your tmp directory is writable."

"The FileEngine is being used for caching. To change the config edit
APP/config/core.php"

"Your database configuration file is present."

Those 3 messages appeared on my browser after I configured cake as
guided but the last one doesn't show up.

"Cake is able to connect to the database."

I tried a simple tutorial to build an application with cake but it
doesn't work.

Hope that somebody can help me,
Thank you

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validating user password after Auth

2009-08-13 Thread Adam

Auth with data validation in my User model doesn't pick up the
notEmpty condition -- it hashes the empty string.

Is this correct?

Do i need to add custom validation to check for this? I cannot use
$this->Auth->password() in a Model.

Or is there a better way to handle this? Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake AclBehaviour: editing controlled items

2009-08-13 Thread Nicky De Maeyer

I've stumbled upon this problem a while ago and fixed this by editing
the core AclBehaviour, but i'm strugelling to get around this. Can
someone explain me why this is the default behaviour?
i'll take you through, step by step, of what I'm doing, and what's my
problem.

1. I've got a model, Item, this actsAs Tree and Acl => controlled
2. I add 3 items, item1, item2 (with item1 as parent) and item3 (with
item2 as its parent)
3. in the acos table I've now got 3 rows, with parent_ids respectively
null, 1 and 2
4. I go and edit the item3, i set its parent from item2 to item1
5. in the acos table, the parent_ids are still null, 1 and 2 instead
of null, 1 and 1

Am I totally missing the point here?

The solution I came up with a while ago can be found on my blog. This
solution only works for acos or aros defined with Model and
foreign_key, not with aliases.
http://www.mythix.be/cakePHP/enhancing-cakephps-built-in-acl-bhaviour
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DeleteQuery in HABTM is like 'dependent'=> true in hasMany associations?

2009-08-13 Thread José Pablo Orozco Marín

Thak you.


These are my model definitions:

User hasMany Listing

Listing hasMany Article

Listing hasMany Image

Article hasAndBelongsToMany Tag

Image hasAndBelongsToMany Tag


When i delete an article their tags are deleted ok.

When i delete an image their tags are deleted ok.

When i delete a Listing their associated images and articles are deleted 
ok, but the tags associated to the images or aticles deleted.


We are using a custom behavior to add, update or delete tags for each 
image or article created, these are are their tables:

CREATE TABLE IF NOT EXISTS `tags` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(30) character set utf8 NOT NULL,
  `model` varchar(50) character set utf8 NOT NULL,
  `ocurrances` int(11) unsigned NOT NULL,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;


CREATE TABLE IF NOT EXISTS `articles_tags` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `article_id` int(11) unsigned default NULL,
  `tag_id` int(11) unsigned default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `images_tags` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `image_id` int(11) unsigned default NULL,
  `tag_id` int(11) unsigned default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;


Like i said before, when i delete an artice or an image, the tags 
occurrances are updated and the tags are deleted. But not when i delete 
a Listing or User. There is way to force HABTM to be depandant with a 
custom action or any other solution?


Thanks in advance.



delocalizer wrote:
> Hi Josoroma;
> This nice post: (http://groups.google.com/group/cake-php/msg/
> c10840be78a34df0) although it is about finderQuery, will probably help
> you a lot. I have to ask though - you sure you want to delete the Tags
> themeselves and not just the ArticlesTags associations? What happens
> if a Tag is shared between an article being deleted and one that
> isn't? Or now that I think about it what you probably want is to
> delete Tags that no longer belong to any Articles - in which case you
> could also put some logic in your Article model afterDelete that calls
> delete on unassociated Tags. Just a thought.
>
> On Aug 13, 3:34 am, Josoroma  wrote:
>   
>> Im using the following structure:
>>
>> User hasMany Listing
>> Listing hasMany Contacts
>> Listings hasAndBelongsToMany Articles
>> Articles hasMany Tags
>>
>> When i delete a User or a Listing all their associated Listings and
>> Articles are successfully deleted. But not their Tags. Listings and
>> Articles are deleted because we are using 'dependent'=> true in the
>> hasMany Model Structure. But how can i delete the Tags of the Articles
>> associated? do i have to use deleteQuery to achieve 
>> that?http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
>>
>> I was searching in Google and there is not tutorial or post related to
>> deleteQuery in HABTM associations.
>>
>> An example will help us a lot.
>>
>> Thanks in advance.
>> 
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Allowed memory size exhausted - on clean cakephp install

2009-08-13 Thread David Coleman
Chances are that your php settings are minimilistic.  Check your php.ini
locally and see how much memory you are allowing a script to use.  Then
check your server settings and if you are not allowing the same amount, make
it match.  I have had this issue with certain hosts before as well, many
“dedicated” servers are nothing more than a virtual server that is
“dedicated” to your account.  Plesk is a good example of a fake “dedicated”
platform.  If you are not allowed to change the php.ini on your “dedicated”
solution, then it is not dedicated.

 

Best of luck.

 

 
  
  
   David Kenneth Coleman

Sr.Software Engineer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:   david.cole...@connaxis.com

The Netherlands:   + 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Anna P
Sent: 2009-08-13 14:23
To: CakePHP
Subject: Allowed memory size exhausted - on clean cakephp install

 

 

Hello!

I am moving my web application to dedicated server.

I uploaded all of my app files and voila - under server IP I got blank

page. So I've figured out to install clean cakephp version first and

see if it works there. I uploaded Cakephp 1.2.4.82.84 version and it

displayed me Cake's welcome page. I changed db config and Cake said it

is able to connect to db. But when I entered app_controller.php file

and wrote this:

 

var $uses = array('User');

 

it started to show this message:

 

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to

allocate 30720 bytes) in [...]/www/cake/libs/view/helpers/form.php on

line 1312

 

and firstly it showed error at cake/libs/i18n.php at line 437 for

another model

and error at cake/libs/view/view.php on line 663 for another model

 

What is going on? This is a clean CakePHP application with just models

at "model" catalog and thats all.

Please,help. :-)

 


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---

<>

Allowed memory size exhausted - on clean cakephp install

2009-08-13 Thread Anna P

Hello!
I am moving my web application to dedicated server.
I uploaded all of my app files and voila - under server IP I got blank
page. So I've figured out to install clean cakephp version first and
see if it works there. I uploaded Cakephp 1.2.4.82.84 version and it
displayed me Cake's welcome page. I changed db config and Cake said it
is able to connect to db. But when I entered app_controller.php file
and wrote this:

var $uses = array('User');

it started to show this message:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 30720 bytes) in [...]/www/cake/libs/view/helpers/form.php on
line 1312

and firstly it showed error at cake/libs/i18n.php at line 437 for
another model
and error at cake/libs/view/view.php on line 663 for another model

What is going on? This is a clean CakePHP application with just models
at "model" catalog and thats all.
Please,help. :-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Isseu with beforeFind($queryData) in Behaviors

2009-08-13 Thread subnoodle

Hi Brian,

in the meanwhile i found it out.
Thank you for clearifying this again.

So, basically there where two problems which let me search for days on
this issue:

=> api-doc of Cake contains a section with "own behaviors"-
description, but there only a link to the call back methods of a
model. And exactly there is the difference:
Model::beforeFind($queryData) => this appears as the only one in api-
doc
ModelBehavior::beforeFind(&$model,$query)

For me, i really couldn't guess that the header of the one beforeFind
is different than another beforeFind-Header, since they are described
in the core doc to be the same.
Further, $queryData is a different parameter-name than query, but
their use a indicated to be the same; also a bit wiring.
Return-Value is the third wiring thig: Is described to return 'true',
but is expected to return queryData; i read this at a closed bug
before. So i could guess it.

These are just hints.
And if you tell me how to change the doc, i would change it myself (if
i'm allowed to - as little contribution).

Thanks a lot & regards, Sam

On 13 Aug., 18:48, brian  wrote:
> On Thu, Aug 13, 2009 at 12:27 PM, subnoodle wrote:
>
> > Hi Brian,
> > thank you for clearifing the difference between queryData in this both
> > contextes, Behavior and Model.
> > In this case, i need to use i in behavior context.
>
> > Can i do conditions there as well?
>
> > If this is the case, how?
>
> You're creating a behavior? In that case, your best bet would be to
> have a look at some other ones. Many of them do just this--alter or
> add conditions.
>
> > (e.g., discard the given queryData and return an queryData-Strucure as
> > array, or making an conditions entry in the given queryData-object-
> > structure at a specific place)
>
> It's pretty much the same as the code I posted. The big difference is
> you need to abstract the model:
>
> AAARGGH! And I've just realised that the code I posted had a typo and
> a big error. This:
>
> $queryData['conditions'][$model->alias.'.YOUR_FIELD' = 'YOUR_CONDITION';
>
> ... should be:
>
> $queryData['conditions'][$this->alias.'.YOUR_FIELD'] = 'YOUR_CONDITION';
>
> ... when it's in Model::beforeFind(). When in a Behavior's
> beforeFind(), you'd do as I posted:
>
> $queryData['conditions'][$model->alias.'.YOUR_FIELD'] = 'YOUR_CONDITION';
>
> You don't want to *discard* the data, just alter it and return it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Issue with Auth.redirect after logout

2009-08-13 Thread l4yercake

Hi all,

I am implementing Auth and Acl and have autoRedirect set to false
because I need to do some checks in the login function.

I am noticing after a successful logout followed by a login, I am
taken to the last address I was at before I logged out, instead of the
path listed in loginRedirect. In this case the session variable for
Auth.redirect is overriding what's in the AppController. Also, this
only happens when I click on a logout link, as opposed to when I
manually type out the logout path in the browser.

I tried deleting the session variable for auth.redirect in my logout
function, but that didn't help. It only works if I put that line in
the login function, but that breaks the main functionality for
Auth.redirect, which is if you try to visit a page that request
permission and you are not logged in then the login page is displayed
and upon successful login you are then redirected to the page you were
trying to visit.

Any ideas on what might be happening??

Thanks,
L4C
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



re-paginate?

2009-08-13 Thread Dave Maharaj :: WidePixels.com
Ok I have an idea and before I attempt it I was hoping someone had some
advice or input that might help me decide it to go forward with the idea.
 
Basic idea.
Normal index renders the Ajax pagination based on standard $paginate
condition from the controller.
 
This renders all the Posts in the site...nothing special.
I have a Star/Bookmark icon beside each Post so the User can update (save or
remove the bookmark for each post)
 
Now I have added a checkbox where the user can select to either show / hide
all the Bookmarked Posts, so if the paginate has 20 posts, 10 Posts that the
User has saved it will hide them only showing 10 Posts that are not
favourites.
 
But what I need is to re-paginate so that when the number of User Posts are
hidden, the next difference will load in so that there is always 20 posts in
the pagination
What would be the ideal solution to repaginate and save the hide/show
variable to session so paginate can be done with this in its condition?
 
Dave 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: git clone: Permission denied

2009-08-13 Thread BeanDog

That worked like a charm!  I'm brand new to Git, so some of the stuff
with remote repositories is still pretty new to me.  Let me explain
how I'm expecting to manage my CakePHP project's repository, and let
me know if I'm completely off the deep end!

First, I'll create my central repository for my project as a bare
clone from CakePHP:
  git clone --bare d...@code.cakephp.org:cakephp.git myproject

Then I'll create my own working copy by cloning that:
  git clone myu...@myserver:myproject.git

I do a bunch of work in my local copy, then commit and push back to my
own central repo:
  git commit -a
  git push

To get all the changes other devs have committed to my own central
repo, I pull:
  git pull
  (OR: git fetch; git merge origin/master)

To merge the latest changes from CakePHP's repo into my own central
repo, I fetch directly into my own central repo from Cake's:
  git fetch d...@code.cakephp.org:cakephp.git

Does all that look right?


Ben Dilts

On Aug 13, 3:23 am, majna  wrote:
> check out thishttp://thechaw.com/wiki/guides/setup
>
> On Aug 13, 1:21 am, BeanDog  wrote:
>
>
>
> > The new CakePHP code site,http://code.cakephp.org/source, says to use
> > "git clone d...@code.cakephp.org:cakephp.git" to get a copy of the code
> > (I assume that's the latest 1.2 stable code).  However, when I try to
> > do that, I get the following error:
>
> > Permission denied (publickey).
> > fatal: The remote end hung up unexpectedly
>
> > Am I doing something wrong?  Is this not the best public place to git
> > the source code for CakePHP?  I was hoping switching to git would make
> > keeping the CakePHP core in my project up to date much easier.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Isseu with beforeFind($queryData) in Behaviors

2009-08-13 Thread brian

On Thu, Aug 13, 2009 at 12:27 PM, subnoodle wrote:
>
> Hi Brian,
> thank you for clearifing the difference between queryData in this both
> contextes, Behavior and Model.
> In this case, i need to use i in behavior context.
>
> Can i do conditions there as well?
>
> If this is the case, how?

You're creating a behavior? In that case, your best bet would be to
have a look at some other ones. Many of them do just this--alter or
add conditions.

> (e.g., discard the given queryData and return an queryData-Strucure as
> array, or making an conditions entry in the given queryData-object-
> structure at a specific place)

It's pretty much the same as the code I posted. The big difference is
you need to abstract the model:

AAARGGH! And I've just realised that the code I posted had a typo and
a big error. This:

$queryData['conditions'][$model->alias.'.YOUR_FIELD' = 'YOUR_CONDITION';

... should be:

$queryData['conditions'][$this->alias.'.YOUR_FIELD'] = 'YOUR_CONDITION';

... when it's in Model::beforeFind(). When in a Behavior's
beforeFind(), you'd do as I posted:

$queryData['conditions'][$model->alias.'.YOUR_FIELD'] = 'YOUR_CONDITION';

You don't want to *discard* the data, just alter it and return it.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Isseu with beforeFind($queryData) in Behaviors

2009-08-13 Thread subnoodle

Hi Brian,
thank you for clearifing the difference between queryData in this both
contextes, Behavior and Model.
In this case, i need to use i in behavior context.

Can i do conditions there as well?

If this is the case, how?
(e.g., discard the given queryData and return an queryData-Strucure as
array, or making an conditions entry in the given queryData-object-
structure at a specific place)

Thanks for an hint again!

Sam

On 13 Aug., 11:37, brian  wrote:
> On Thu, Aug 13, 2009 at 8:14 AM, subnoodle wrote:
>
> > Hello,
> > i'd like to add "ownership-support" in models in   general way.
>
> > So, i put some filtering in beforeFind, first.
> > SInce i regognized, that parameter $queryData does not work as
> > expected.
>
> > In CakeDoc is described, that queryData is an arrray of find-
> > parameters. But is 's actually the model object itself.
>
> No, in Model::beforeFind() the first (and only) param is the query
> options array. The Behavior's beforeFind(), however, takes the model
> as the 1st param. But this is something that Model takes care of when
> it triggers beforeFind from find(). You don't have to pass the model
> yourself.
>
> > So, adding 'conditions' to queryData does not work, additionally
> > $queryData->conditions is an unknown property.
>
> $queryData is an array, not an object. You want to do
> $queryData['conditions'] = array(...)
>
> Although there may already be conditions:
>
> function beforeFind)$queryData)
> {
>         if (!isset($queryData['conditions'])) {
>                 $queryData['conditions'] = array();
>         }
>
>         $queryData['conditions'][$model->alias.'.YOUR_FIELD' = 
> 'YOUR_CONDITION';
>
>         return $queryData;
>
> }
> > So, my questions are:
> > a) Can i cope queryData to filter via 'conditions'
> > b) Can i achive filtering also in model relations (belogs to, etc.)
> > and how? (I think, the join will be generated without the filter of
> > the secondary table)
> > c) Can i achive filtering in selectboxes of view in related tables?
> > ==> And this all in only one behavior?
>
> > Thanks a lot, Sam
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



File write problems with BLOB

2009-08-13 Thread Al

Hello,
The following code produces a 0 byte file on my filesystem:

App::import('Core', 'File');
$file =& new File('./files/postings/test3.pdf');
$file->write($cvID['AppFile']['data']);  //(BLOB data, pdf)

If I just do a plain string, it saves to the filesystem correctly.
Does anyone know what is causing this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help needed! Submitting date field in MySQL

2009-08-13 Thread brian

The trouble is that there are 2 requests to the add action. The first,
which displays the form, has the date in the URL. But, when the form
is submitted, there is no date param. It points to
www.site.com/events/add. What you should do is create a hidden field
so that the date is already in $data.

function add($event_date = null)
{   
if (!empty($this->data))
{   
if ($this->Event->save($this->data))
{
...
}
else
{
/* set this in case form needs to be re-displayed
 */
$this->set('event_date', 
$this->data['Event']['event_date']);
}
}
else
{
/* set for initial display of form
 */
$this->set('event_date', $event_date);
}
}

view:
$form->hidden('Event.event_date', array('value' => $event_date));

You might consider putting a check on the date before the initial
set() for the view. If null, or if date_parse() returns false, you
could set it to today:

$this->set('event_date', date('Y-m-d'));

There's no need for $this->Event->event_date = $event_date;

Also, although you don't need it as well, the substr() & mktime()
stuff could have been avoided by doing:

$v = date('Y-m-d', strtotime($event_date));

However, even that's superfluous because you might as well just do:

$v = $event_date;

On Thu, Aug 13, 2009 at 4:02 AM, Schwamm wrote:
>
> I need urgent help!  I'm a novice at Cake and I'm having trouble
> getting a date saved in my SQL database.  I am trying to have the date
> save automatically depending on which day a user clicks on on a
> calendar to create a new event.  To do that, I added a parameter to my
> "add" function called $event_date, which was passed in the URL in the
> form -MM-DD, so my URL looks like www.site.com/events/add/2009-08-27
> .  This is my function currently:
>
> function add($event_date = null) {
>            $this->Event->event_date = $event_date;
>            $this->set('event_date',$event_date); //for use again in
> view
>            if (!empty($this->data)) {
>               $year = substr($event_date,0,4); //I broke my parameter
> down to use it in a unix time stamp.
>               $month = substr($event_date,5,2);
>               $day = substr($event_date,8,2);
>               $str = mktime(0,0,0,$month,$day,$year);
>               $v = date("Y-m-d",$str);
>
>                $this->data['Event']['event_date'] = $v; //here is
> where I think I have problems.
>                        if ($this->Event->save($this->data)) {
>                                $this->Session->setFlash('Your event has been 
> saved.');
>                                
> $this->redirect(array('controller'=>'events','action' =>
> 'calendar'));
>                                }
>            }
>        }
>
> I know this code is probably horrible and passing the whole date in
> one parameter is also not the best way to do things, but if anyone
> could enlighten me as to what I'm doing wrong it'd be very much
> appreciated!
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Isseu with beforeFind($queryData) in Behaviors

2009-08-13 Thread brian

On Thu, Aug 13, 2009 at 8:14 AM, subnoodle wrote:
>
> Hello,
> i'd like to add "ownership-support" in models in   general way.
>
> So, i put some filtering in beforeFind, first.
> SInce i regognized, that parameter $queryData does not work as
> expected.
>
> In CakeDoc is described, that queryData is an arrray of find-
> parameters. But is 's actually the model object itself.

No, in Model::beforeFind() the first (and only) param is the query
options array. The Behavior's beforeFind(), however, takes the model
as the 1st param. But this is something that Model takes care of when
it triggers beforeFind from find(). You don't have to pass the model
yourself.

> So, adding 'conditions' to queryData does not work, additionally
> $queryData->conditions is an unknown property.

$queryData is an array, not an object. You want to do
$queryData['conditions'] = array(...)

Although there may already be conditions:

function beforeFind)$queryData)
{
if (!isset($queryData['conditions'])) {
$queryData['conditions'] = array();
}

$queryData['conditions'][$model->alias.'.YOUR_FIELD' = 'YOUR_CONDITION';

return $queryData;
}



> So, my questions are:
> a) Can i cope queryData to filter via 'conditions'
> b) Can i achive filtering also in model relations (belogs to, etc.)
> and how? (I think, the join will be generated without the filter of
> the secondary table)
> c) Can i achive filtering in selectboxes of view in related tables?
> ==> And this all in only one behavior?
>
> Thanks a lot, Sam
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamically change data source of models

2009-08-13 Thread CobaltShark

I use Ad-hoc joins to LEFT JOIN data from different databases using
the same default db config and it works well. Just specify table =>
'common_db_name.table_name' . You will obviously need to ensure that
the db user specified in your config has at least SELECT privs to both
databases. I usually give Any user on localhost SELECT privs on my
common database, but you could just as easily grant database specific
as well.

On Aug 13, 5:11 am, Fritsie  wrote:
> Hello,
> I'm developing an application which will be used by multiple companies
> and I want to use a shared database for common information like users,
> companies, permissions etc, but I want to use a separate database for
> each company for their own (private) information. The reason to give
> every company an own database is for speed, security en taking
> advantage of the caching from the database.
>
> I've read the article by Anssi Rajakallio (doze) at the 
> Bakery:http://bakery.cakephp.org/articles/view/use-multiple-databases-in-one...
> And also the comments of the cakephp team, but I still have a few
> problems.
>
> I don't want to initialize a connection to 1 company-database (the
> solution of Anssi) at the start, but I want to be able to change from
> data source while making one request, for instance when I want to
> benchmark multiple companies I need to make one request, and multiple
> database requests on different databases (depending on the companies I
> want to benchmark).
>
> The question is how I can change dynamically the data source of all
> the models who don't use the 'shared' data source.
>
> Thanks in advance.
> Regards,
> Raymond
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: unwanted white space in html

2009-08-13 Thread brian

Just specifying UTF-8 will not work because the file is not actually
encoded as UTF-8. You'll need to convert the file(s) from whatever
character set it is to UTF-8. I suggest using iconv for that[1]. If
you cannot install it, there's an online version[2]. There's also a
GUI app available[3]. I've never used either of those though.

First, you'll need to know the code that iconv uses for your character set:

iconv --list

This will list all the codes it uses. Once you know that, you can
convert the file to UTF-8. For example, if your files are encoded with
ISIRI 3342 Farsi Charset:

iconv -f ISIRI-3342 -t UTF-8 < filename > filename.utf8

Once your files are converted, ensure that you have
Configure::write('App.encoding', 'UTF-8'); in core.php. Then set the
document's character set with $html->charset().

[1] http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html
[2] http://www.iconv.org/
[3] http://www.marblesoftware.com/Marble_Software/Charco.html

On Thu, Aug 13, 2009 at 2:06 AM, persianshadow wrote:
>
> i found my problem but need solution !
>
> my layout and view file contain some Asian (persian) Character and i
> must save my file with UTF8 encode instead
>
> ANSI . when i save my view file with ANSI encode everything goes Right
> way and css appear in head tag and don't show
>
> unwanted white spaces but with UTF8 encoding don't ! these Characters
> are static and don't Retrieve from databse
>
> and if must my view file with UTF8 encoding for show correct
> Character . i test this solution but don't affecte :
>
> 1 - save my file with ANSI encode and add charset
> (); ?> to my layout .
>
> anybody have solution for this problem ?
>
> On Aug 13, 8:41 am, persianshadow  wrote:
>> i set my css link with your parameters but now don't insert css link
>> in my html document !
>>
>> only with this format : $html->css('screen'); work but with above
>> bugs .
>>
>> also cakephp don't show any Error and i confuse with this problem :(.
>>
>> On Aug 13, 1:52 am, brian  wrote:
>>
>> > You're not passing the param correctly. Try this:
>>
>> > echo $html->css('screen', 'stylesheet', null, false);
>>
>> > On Wed, Aug 12, 2009 at 4:30 PM, persianshadow 
>> > wrote:
>>
>> > > hi brian
>>
>> > > yes ! my css links insert in body tag !
>>
>> > > now i change these :
>>
>> > > 1 - add  to head tag
>>
>> > > 2 - and my css tags in head tag :
>>
>> > > > > > echo $html->css('screen');
>> > > echo $html->css('custom');
>> > > ?>
>>
>> > > and i do this : $html->css('screen', $inline=false) but don't work and
>> > > css links stay in body tag.
>>
>> > > please help me for right way.
>>
>> > > On Aug 12, 7:55 pm, brian  wrote:
>> > >> It looks to me like a CSS issue. Newlines in the source shouldn't have
>> > >> any affect at all on how the page renders. Look at the HTML tab in
>> > >> Firebug and hover the cursor over the surrounding elements in the
>> > >> source to see the margin/padding. If you click on the tag, you can see
>> > >> the style rules on the right.
>>
>> > >> I'm sure it's entirely unrelated, but I noticed that you have CSS
>> > >> links in the body. Those should be in the head. If you are using
>> > >> HtmlHelper to set those in the view, you can pass false as the last
>> > >> param to get it to place the link in the head.
>>
>> > >> css( $path, $rel = NULL, $htmlAttributes = array ( ), $inline = true )
>>
>> > >> On Wed, Aug 12, 2009 at 11:16 AM, 
>> > >> persianshadow wrote:
>>
>> > >> > hi
>>
>> > >> > i design my html code with XHtml and CSS and add to my cakephp
>> > >> > application but in html view
>>
>> > >> > i have two unwanted white space  that don't have any codes in source
>> > >> > view of html output
>>
>> > >> > view image of my page with unwanted white space :
>>
>> > >> >http://s1d4.turboimagehost.com/sp/ec096e69ec1f5ec9d0f5939bf7999847/un...
>>
>> > >> >  but i spy with firebug and in html section of firbug i found empty
>> > >> > line , see image :
>>
>> > >> >http://s1d4.turboimagehost.com/sp/4f64597bd71ebd1dd1452593873c4e60/un...
>>
>> > >> > and when i inspect in dom i see this :
>>
>> > >> >http://s1d4.turboimagehost.com/sp/419e5d0980f8b0940711832ddecd0255/un...
>>
>> > >> > yes ! replaceWholeText() function insert " \n " character in my html
>> > >> > page and this code generate in real time
>>
>> > >> > and don't part of my code , i test my cakephp application in other
>> > >> > browsers but get same problem.
>>
>> > >> > i don't use Ajax or javascript in my layout 
>>
>> > >> > anybody have idea ?
>>
>>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Isseu with beforeFind($queryData) in Behaviors

2009-08-13 Thread subnoodle

Hello,
i'd like to add "ownership-support" in models in   general way.

So, i put some filtering in beforeFind, first.
SInce i regognized, that parameter $queryData does not work as
expected.

In CakeDoc is described, that queryData is an arrray of find-
parameters. But is 's actually the model object itself.

So, adding 'conditions' to queryData does not work, additionally
$queryData->conditions is an unknown property.

So, my questions are:
a) Can i cope queryData to filter via 'conditions'
b) Can i achive filtering also in model relations (belogs to, etc.)
and how? (I think, the join will be generated without the filter of
the secondary table)
c) Can i achive filtering in selectboxes of view in related tables?
==> And this all in only one behavior?

Thanks a lot, Sam

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Dynamically change data source of models

2009-08-13 Thread Fritsie

Hello,
I'm developing an application which will be used by multiple companies
and I want to use a shared database for common information like users,
companies, permissions etc, but I want to use a separate database for
each company for their own (private) information. The reason to give
every company an own database is for speed, security en taking
advantage of the caching from the database.

I've read the article by Anssi Rajakallio (doze) at the Bakery:
http://bakery.cakephp.org/articles/view/use-multiple-databases-in-one-app-based-on-requested-url
And also the comments of the cakephp team, but I still have a few
problems.

I don't want to initialize a connection to 1 company-database (the
solution of Anssi) at the start, but I want to be able to change from
data source while making one request, for instance when I want to
benchmark multiple companies I need to make one request, and multiple
database requests on different databases (depending on the companies I
want to benchmark).


The question is how I can change dynamically the data source of all
the models who don't use the 'shared' data source.


Thanks in advance.
Regards,
Raymond

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DeleteQuery in HABTM is like 'dependent'=> true in hasMany associations?

2009-08-13 Thread delocalizer

Hi Josoroma;
This nice post: (http://groups.google.com/group/cake-php/msg/
c10840be78a34df0) although it is about finderQuery, will probably help
you a lot. I have to ask though - you sure you want to delete the Tags
themeselves and not just the ArticlesTags associations? What happens
if a Tag is shared between an article being deleted and one that
isn't? Or now that I think about it what you probably want is to
delete Tags that no longer belong to any Articles - in which case you
could also put some logic in your Article model afterDelete that calls
delete on unassociated Tags. Just a thought.

On Aug 13, 3:34 am, Josoroma  wrote:
> Im using the following structure:
>
> User hasMany Listing
> Listing hasMany Contacts
> Listings hasAndBelongsToMany Articles
> Articles hasMany Tags
>
> When i delete a User or a Listing all their associated Listings and
> Articles are successfully deleted. But not their Tags. Listings and
> Articles are deleted because we are using 'dependent'=> true in the
> hasMany Model Structure. But how can i delete the Tags of the Articles
> associated? do i have to use deleteQuery to achieve 
> that?http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
>
> I was searching in Google and there is not tutorial or post related to
> deleteQuery in HABTM associations.
>
> An example will help us a lot.
>
> Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving SQL query generated by the framework

2009-08-13 Thread siva linga reddy gangula
I want to know that can we do the cms with cake php


On Thu, Aug 13, 2009 at 3:06 PM, siva linga reddy gangula <
sivaling...@gmail.com> wrote:

>
> In php we can give the database connections like this
>  $con=mysql_connect("localhost","root","");
>  $sel=mysql_select_db(dbanme);
>
> After we can write the sql query as for our view .
>
>
>
>
> $db =ConnectionManager::getDataSource('default');
> debug($db->showLog());
>
>
> On Aug 13, 7:43 am, Abhishek  wrote:
> > Hi,
> > How can i get the SQL query generated by the framework. It does get
> > saved in the log, but in that case along with that lot of other
> > information is saved.
> >
> > I need to store just the SQL query generated as it is in a database so
> > that i can retrieve them later
> > and run them.
> >
> > Any idea how do i go about it
> >
> > Regards
> > Abhishek Jainhttp://www.fidelus.in
> >
>
>
>
> --
> siva
>



-- 
siva

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help needed! Submitting date field in MySQL

2009-08-13 Thread Schwamm

I need urgent help!  I'm a novice at Cake and I'm having trouble
getting a date saved in my SQL database.  I am trying to have the date
save automatically depending on which day a user clicks on on a
calendar to create a new event.  To do that, I added a parameter to my
"add" function called $event_date, which was passed in the URL in the
form -MM-DD, so my URL looks like www.site.com/events/add/2009-08-27
.  This is my function currently:

function add($event_date = null) {
$this->Event->event_date = $event_date;
$this->set('event_date',$event_date); //for use again in
view
if (!empty($this->data)) {
   $year = substr($event_date,0,4); //I broke my parameter
down to use it in a unix time stamp.
   $month = substr($event_date,5,2);
   $day = substr($event_date,8,2);
   $str = mktime(0,0,0,$month,$day,$year);
   $v = date("Y-m-d",$str);

$this->data['Event']['event_date'] = $v; //here is
where I think I have problems.
if ($this->Event->save($this->data)) {
$this->Session->setFlash('Your event has been 
saved.');

$this->redirect(array('controller'=>'events','action' =>
'calendar'));
}
}
}

I know this code is probably horrible and passing the whole date in
one parameter is also not the best way to do things, but if anyone
could enlighten me as to what I'm doing wrong it'd be very much
appreciated!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving SQL query generated by the framework

2009-08-13 Thread siva linga reddy gangula
In php we can give the database connections like this
 $con=mysql_connect("localhost","root","");
 $sel=mysql_select_db(dbanme);

After we can write the sql query as for our view .



$db =ConnectionManager::getDataSource('default');
debug($db->showLog());


On Aug 13, 7:43 am, Abhishek  wrote:
> Hi,
> How can i get the SQL query generated by the framework. It does get
> saved in the log, but in that case along with that lot of other
> information is saved.
>
> I need to store just the SQL query generated as it is in a database so
> that i can retrieve them later
> and run them.
>
> Any idea how do i go about it
>
> Regards
> Abhishek Jainhttp://www.fidelus.in




-- 
siva

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model name bug

2009-08-13 Thread simplecy

I accidently used the wrong model filenames in a test project using
scaffolding e.g I used "issues,php" and "places.php" instead of
"issue.php" and "place.php"

However the project worked OK!!!

I then tried using associations but couldn't get then to work (but got
no errors)

Eventually (after 2 days) I realised my initial mistake - changed
the filenames from plural to singular and all OK.

I don't know all the implications of singular/plural for model
filenames but I think it would be better for CakePHP to report an
error rather than letting it work for simpler cases and then silently
failing later on :)

BTW is this the place to report bugs?

regards

Simon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



BarCamp Phnom Penh '09 - Technology, Communication and Innovation

2009-08-13 Thread Chantra

Sorry for cross prosing.

BarCamp Phnom Penh 2009 is an open conference of all things
Technology, Communication and Innovation. It's a user generated
conferences — open, participatory workshop-events, whose technology-
related content is provided by participants.

Venue: Paññasastra University of Cambodia (South Campus), Phnom Penh
Cambodia
Date: October 3 - 4, 2009

More at: http://barcampphnompenh.org/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Calling save attempts to insert instead of update

2009-08-13 Thread JamesF

to back up what robert is saying in your function definition you are
declaring $id=null. if your function is not getting an $id passed to
it
that would cause an insert not an update.

in short you should make sure you are passing an id and also put a
conditional check on $id such as:

//if we find an item with this id
//you could use read() instead of find
if($this->find('first', array('conditions'=>array('Model.id'=>$id
{
$this->Model->id = $id;

}

else {
//failed to get model id
//now this acts like an add form
//or die
}

On Aug 12, 11:37 am, Robert P  wrote:
> Model::saveField() still requires a valid primary key, which I suspect
> he is setting to NULL at the beginning of his method.
>
> On Aug 12, 9:30 pm, eusef  wrote:
>
> > If you know which field you need to update perhaps you could try
> > using :
>
> >    saveField(string $fieldName, string $fieldValue, $validate = false)
>
> > From
> >  :http://book.cakephp.org/view/75/Saving-Your-Data
>
> > GL - Phil
>
> > On Aug 11, 8:03 pm, tron  wrote:
>
> > > I have a problem with one specific controller trying to INSERT instead
> > > of UPDATE and I am getting duplicate entry errors. the "$this->data"
> > > variable contains the correct primary key of table I'm trying to
> > > update, but still tries to INSERT instead. Most notable text message
> > > is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
> > > AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
> > > getting the id at all?
>
> > > Code:
>
> > >         function        edit( $id = null )
> > >         {
> > >         pr( $id );
> > >         pr( $this->data );
> > >         $this->Employee->id = $id;
>
> > >         if( !empty( $this->data ) )
> > >         {
> > >             if( $this->Employee->save( $this->data ) )
> > >             {
> > >             }
>
> > >         } else {
> > >             $this->data = $this->Employee->read( null, $id );
> > >         }
> > >         }
>
> > > Both the pr functions display the correct data that suggests it should
> > > be doing an UPDATE instead of INSERT.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Calling save attempts to insert instead of update

2009-08-13 Thread JamesF

to back up what robert is saying in your function definition you are
declaring $id=null. if you function is not getting an $id passed to it
that would cause an insert not an update.

in short you should make sure you are passing an id and also out a
conditional check on $id such as:


//if we find an item with this id
//you could use read() instead of find
if($this->find('first', array('conditions'=>array('Model.id'=>$id
{
$this->Model->id = $id;
}

else {
//failed to get model id
//now this acts like an add form
//or die
}
On Aug 11, 8:03 pm, tron  wrote:
> I have a problem with one specific controller trying to INSERT instead
> of UPDATE and I am getting duplicate entry errors. the "$this->data"
> variable contains the correct primary key of table I'm trying to
> update, but still tries to INSERT instead. Most notable text message
> is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
> AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
> getting the id at all?
>
> Code:
>
>         function        edit( $id = null )
>         {
>         pr( $id );
>         pr( $this->data );
>         $this->Employee->id = $id;
>
>         if( !empty( $this->data ) )
>         {
>             if( $this->Employee->save( $this->data ) )
>             {
>             }
>
>         } else {
>             $this->data = $this->Employee->read( null, $id );
>         }
>         }
>
> Both the pr functions display the correct data that suggests it should
> be doing an UPDATE instead of INSERT.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving SQL query generated by the framework

2009-08-13 Thread Abhishek

Hi,
For this i 'll have to set the debug level to atleast '2' ..
secondly this would give in return all the queries executed for that
page ..
though i need to save only specific queries ..

let me give some background .. maybe that would help ..
In the application there is an option where user can generate
reports ..
I intend to provide an option where he can save the report generated
for future reference ..
i guess the simplest way is to save the SQL query generated for that
report ..


Regards
Abhishek Jain

On Aug 13, 2:28 pm, majna  wrote:
> $db =ConnectionManager::getDataSource('default');
> debug($db->showLog());
>
> On Aug 13, 7:43 am, Abhishek  wrote:
>
> > Hi,
> > How can i get the SQL query generated by the framework. It does get
> > saved in the log, but in that case along with that lot of other
> > information is saved.
>
> > I need to store just the SQL query generated as it is in a database so
> > that i can retrieve them later
> > and run them.
>
> > Any idea how do i go about it
>
> > Regards
> > Abhishek Jainhttp://www.fidelus.in
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange contain/find issue

2009-08-13 Thread WebbedIT

Further update: I am getting to the bottom of this, but could still do
with a pointer or two.

In my AppController I have a __AuthExtra() method which requests extra
data to be added into the session.  I am calling this on my User model
but I am using contain and I'm containing the Person model as follows:

function __AuthExtra() {
  $auth = $this->Session->read('Auth');
  $data = ClassRegistry::init('User')->find('first', array(
'conditions' => array('User.id'=>$auth['User']['person_id']),
'contain' => array( 'Person' => array('OnlineAddress.parent_model
= \'Person\'', 'OnlineAddress.type_id = 54', 'Organisation'=>array
('Cause')) )
  ));
  $this->Session->write('Auth', Set::merge($auth, $data));
}

I assume that containable must do some sort of caching as my find call
from Person::view is using the contain associations specified in
AppController::__AuthExtra() rather than those I specify in subsequent
calls?!?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange contain/find issue

2009-08-13 Thread WebbedIT

Hi Martin,

I would say that was 3 questions, but who's counting :o)

> What does the sql output say? && Is the missing data being queried at all?

Data is not being queried

> What happens if you use recursive instead of containable?

I have not tried this but from adding echoes into containable I can
see it is adding the same recursive integer (2) for both my Person
model (not fetching data) and my Tests model (carbon copy of Person
but does fetch data)

At present I am digging around in dbo_source.php, as it's read()
method is failing to complete all the queries, and echoing $model-
>hasMany at the start of this method shows that my $Person->hasMany
array is being stripped of it's PostalAddress and TelephonyNumber
records.

Time to backtrack and see when they are being stripped.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-13 Thread Bert Van den Brande

Are you working in CakePHP debug mode ? I would advise setting the
debug level to 2 , this would output performed sql queries which can
be usefull in this case to find the cause of the error.

Also, come to think of it ... I think Cake gives 404 errors when in
production mode (debug level 0), thus hiding the real error message.

Good luck !

On Wed, Aug 12, 2009 at 12:45 PM,
technicaltitch wrote:
>
> Thanks hugely delocalizer and bert and anyone else who reads this. I
> am trying to get the site working on Apache locally (I did have it but
> the hard disk crashed a couple months ago and I'm struggling hence the
> delay).
>
> I hadn't come across debugging PHP before - sounds very useful. What
> is the generally recommended setup for debugging PHP? I've found a
> couple Eclipse plugins - EclipsePDT based on xdebug and PHPeclipse
> which seems more basic.
>
> The string length does not seem relevant - the two strings currently
> isolated are:
>
> http://geocities.com/       [ed: this is not a link - this is the text
> I enter into the text field that creates the error]
>
> and the two Spanish sentences in my original post starting "Los
> animales silvestres..." - either of the sentences on its own does not
> crash, just the pair together.
>
> I don't specify the string length in the CakePHP, and it happens to
> both varchar(255) and blob database fields (mysql 5).
>
> By 404 I mean that when I press submit, it redirects to the homepage,
> which is exactly what it does if I type in a non-existent URL. I'm not
> sure what is doing this but if I can figure it out I'll create a 404
> page to confirm.
>
> Thanks hugely
> Chris
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving SQL query generated by the framework

2009-08-13 Thread majna

$db =ConnectionManager::getDataSource('default');
debug($db->showLog());


On Aug 13, 7:43 am, Abhishek  wrote:
> Hi,
> How can i get the SQL query generated by the framework. It does get
> saved in the log, but in that case along with that lot of other
> information is saved.
>
> I need to store just the SQL query generated as it is in a database so
> that i can retrieve them later
> and run them.
>
> Any idea how do i go about it
>
> Regards
> Abhishek Jainhttp://www.fidelus.in
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: git clone: Permission denied

2009-08-13 Thread majna

check out this
http://thechaw.com/wiki/guides/setup

On Aug 13, 1:21 am, BeanDog  wrote:
> The new CakePHP code site,http://code.cakephp.org/source, says to use
> "git clone d...@code.cakephp.org:cakephp.git" to get a copy of the code
> (I assume that's the latest 1.2 stable code).  However, when I try to
> do that, I get the following error:
>
> Permission denied (publickey).
> fatal: The remote end hung up unexpectedly
>
> Am I doing something wrong?  Is this not the best public place to git
> the source code for CakePHP?  I was hoping switching to git would make
> keeping the CakePHP core in my project up to date much easier.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange contain/find issue

2009-08-13 Thread Martin Westin

Two quick questions / checks.

What does the sql output say?
Is the missing data being queried at all?

What happens if you use recursive instead of containable?

/Martin


On Aug 13, 10:35 am, WebbedIT  wrote:
> I have been trying to debug an issue I am facing for over 3 hours and
> was wondering if someone could give me some pointers.
>
> I have a person.php model which has the following hasMany associations
>
> var $hasMany = array(
>   'OnlineAddress' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('OnlineAddress.parent_model'=>'Person')
>   ),
>   'PostalAddress' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('PostalAddress.parent_model'=>'Person')
>   ),
>   'TelephonyNumber' => array(
>     'foreignKey'=>'parent_id',
>     'conditions'=>array('TelephonyNumber.parent_model'=>'Person')
>   )
> );
>
> In my 'people_controller.php' I have a view action, showhn below, with
> a find() using contain
>
> function view($id) {
>   $this->data = $this->Person->find('first', array(
>     'conditions'=>array('Person.id'=>$id),
>     'contain'=>array(
>       'Title',
>       'Gender',
>       'User'=>array('UserGroup'),
>       'OnlineAddress' => array(
>         'conditions' => array('OnlineAddress.parent_model'=>'Person',
> 'OnlineAddress.type_id'=>54)
>       ),
>       'PostalAddress',
>       'TelephonyNumber' => array(
>         'conditions' => array
> ('TelephonyNumber.parent_model'=>'Person',
> 'TelephonyNumber.type_id'=>51)
>       )
>     )
>   ));
>   echo debug($this->data);
>
> }
>
> When I access /People/view/3, which I know has a matching each for
> OnlineAddress and TelephonyNumber it only returns data for
> OnlineAddress ... it doesn't even return empty arrays for
> PostalAddress and TelephonyNumber.
>
> The strangest thing is if I save person.php to test.php and
> people_controller.php to tests_controller.php (setting the test model
> to $useTable='person' and changing the Person references to Test etc.)
> and access /tests/view/3 it returns the expected: 1 record for
> OnlineAddress, empty array for PostalAddress and 1 record for
> TelephonyNumber.
>
> I have had a dig through conainable.php and it seems to be doing it's
> job, seeing the correct associations etc, I am now going to have a dig
> through find which I assume is where the various finds get ran and the
> arrays merged to produce the final result array.
>
> Anyone else had similar issue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Strange contain/find issue

2009-08-13 Thread WebbedIT

I have been trying to debug an issue I am facing for over 3 hours and
was wondering if someone could give me some pointers.

I have a person.php model which has the following hasMany associations

var $hasMany = array(
  'OnlineAddress' => array(
'foreignKey'=>'parent_id',
'conditions'=>array('OnlineAddress.parent_model'=>'Person')
  ),
  'PostalAddress' => array(
'foreignKey'=>'parent_id',
'conditions'=>array('PostalAddress.parent_model'=>'Person')
  ),
  'TelephonyNumber' => array(
'foreignKey'=>'parent_id',
'conditions'=>array('TelephonyNumber.parent_model'=>'Person')
  )
);

In my 'people_controller.php' I have a view action, showhn below, with
a find() using contain

function view($id) {
  $this->data = $this->Person->find('first', array(
'conditions'=>array('Person.id'=>$id),
'contain'=>array(
  'Title',
  'Gender',
  'User'=>array('UserGroup'),
  'OnlineAddress' => array(
'conditions' => array('OnlineAddress.parent_model'=>'Person',
'OnlineAddress.type_id'=>54)
  ),
  'PostalAddress',
  'TelephonyNumber' => array(
'conditions' => array
('TelephonyNumber.parent_model'=>'Person',
'TelephonyNumber.type_id'=>51)
  )
)
  ));
  echo debug($this->data);
}

When I access /People/view/3, which I know has a matching each for
OnlineAddress and TelephonyNumber it only returns data for
OnlineAddress ... it doesn't even return empty arrays for
PostalAddress and TelephonyNumber.

The strangest thing is if I save person.php to test.php and
people_controller.php to tests_controller.php (setting the test model
to $useTable='person' and changing the Person references to Test etc.)
and access /tests/view/3 it returns the expected: 1 record for
OnlineAddress, empty array for PostalAddress and 1 record for
TelephonyNumber.

I have had a dig through conainable.php and it seems to be doing it's
job, seeing the correct associations etc, I am now going to have a dig
through find which I assume is where the various finds get ran and the
arrays merged to produce the final result array.

Anyone else had similar issue?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ajax remoteFunction problem

2009-08-13 Thread Dr. Loboto


function new_heading(heading) {
  var name = prompt("Enter a heading name", "");
  new Ajax.Updater(
   'heading_list',
   'url('/calendars/add_heading/'); ?>' +
name + '',
   {
asynchronous:true,
evalScripts:true,
requestHeaders:['X-Update', 'heading_list']
   }
  );
}


On Aug 13, 1:05 am, bondo  wrote:
> The function h($text) in /cake/basics.php has changed and is causing
> the problem for me. It now uses htmlspecialchars which escapes the
> single quotes. In the beta version it didn't do this.
>
> Without modifying that code, how can I solve my problem so that it
> does not escape the single quote?
>
> On Aug 12, 11:08 am, bondo  wrote:
>
>
>
> > I just upgrade from an old 1.2beta version to 1.2.3.8166 but I'm
> > having a problem with using the remoteFunction now.
>
> > This is the code I have:
> > 
> > function new_heading(heading) {
> >                 var name = prompt("Enter a heading name", "");
>
> >                  >                         echo $ajax->remoteFunction(array
> > ("update"=>"heading_list", "url"=>"/calendars/add_heading/' + name +
> > '"));
> >                 ?>}
>
> > 
>
> > With the old version, when I view the source in a browser, it would
> > look like:
> > new Ajax.Updater('heading_list','/calendars/add_heading/' + name + '',
> > {asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
> > 'heading_list']})        }
>
> > Now however, it looks like:
> >                 new Ajax.Updater('heading_list','/calendars/
> > add_heading/' + name + '', {asynchronous:true,
> > evalScripts:true, requestHeaders:['X-Update',
> > 'heading_list']})        }
>
> > It doesn't work with the escaped apostrophe's. How can I fix that? I
> > haven't been able to find anything on it. Thanks.
> > Bondo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---