Re: Session madness

2009-04-16 Thread floepi

After some more digging, I finally found it. My predecessor added a
Session->renew() command deep inside the code which caused the
problem...

Cheers

On Apr 16, 11:50 am, floepi  wrote:
> Hi all,
>
> after three days of researching and trying to fix those damn sessions
> I am at a complete loss as to why my sessions are lost at random!
>
> I have set
>
> Configure::write('Session.checkAgent', false);
> Configure::write('Security.level', 'low');
>
> to no avail. I am NOT moving from https to http so that can't be the
> problem.
>
> The worst thing is, the error occurs very randomly. I can add 5 Books
> to my basket and it breaks on the sixth. The next time the session is
> lost by simply navigating the site. Weird!!
>
> What could be a reason for a session to be lost? The path is always
> the same!?!
>
> I reverted back to the old version, which works on our live server but
> still it breaks. I haven't changed anything on my dev server though.
>
> This is driving me crazy - if anyone has an idea, i would greatly
> appreciate it!
>
> Phil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Session madness

2009-04-16 Thread floepi

Hi all,

after three days of researching and trying to fix those damn sessions
I am at a complete loss as to why my sessions are lost at random!

I have set

Configure::write('Session.checkAgent', false);
Configure::write('Security.level', 'low');

to no avail. I am NOT moving from https to http so that can't be the
problem.

The worst thing is, the error occurs very randomly. I can add 5 Books
to my basket and it breaks on the sixth. The next time the session is
lost by simply navigating the site. Weird!!

What could be a reason for a session to be lost? The path is always
the same!?!

I reverted back to the old version, which works on our live server but
still it breaks. I haven't changed anything on my dev server though.

This is driving me crazy - if anyone has an idea, i would greatly
appreciate it!

Phil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Session reset after error.php in cake1.2

2009-03-25 Thread floepi

Hi all,

I have a production site running cake 1.1 and have made several
changes to it, including the migration to 1.2. When I update the site,
everything works fine except the error handling. The site uses a
customized error.php to handle the errors and redirect if necessary.
Error.php sets $_SESSION variables to alter the look of the following
site.

In cake 1.1 the session data is carried over from the error to the new
page, but in cake1.2 the session data seems to be reset.

I am at a loss and don't know how to fix it. Does anyone have an
idea??

Thanks a lot in advance.

Phil
--~--~-~--~~~---~--~~
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: When to use Data caching??

2009-02-16 Thread floepi

Thanks a lot. Will start using view caching more...

Cheers,
Phil



On Feb 14, 2:44 pm, Adam Royle  wrote:
> I don't tend to cache data by itself, as like you've said it generally
> won't save you much time vs mysql alone. I do use view caching on busy
> sites for static content and also for elements, as it can give a
> noticeable improvement.
>
> I guess it really depends on your traffic and the type of site you run.
> I've not tested the difference but memcache would probably give you much
> better performance than file caching.
>
> Cheers,
> Adam
>
> floepiwrote:
> > Hi all,
>
> > I am investigating the use of data caching at the moment and was
> > digging around this google group. I found some very interesting posts
> > on how to optimize cake but no satisfactory answer to "when should I
> > actually use a file cache for my data".
>
> > I took over a website which uses data caching heavily, but the queries
> > are actually pretty straight forward with just one joint. Nothing too
> > recursive. The previous developer cached all that data using the cake
> > file cache method.
>
> > I'm not the database expert but I know that most queries are chached
> > in MySQL and therefore take just a few milliseconds to retrieve. Isn't
> > opening a file, reading the content, converting the string into an
> > actual php array much slower. I understand data caching makes sense
> > for heavy queries or when using memcache, but caching every query to
> > file doesn't seem right. The site is pretty big and has lots of
> > traffic, but I still think MySQL is better optimized than the file
> > system, no?
>
> > Please let me know when you are using data caching and why.
>
> > Thanks a lot.
>
> > Phil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



When to use Data caching??

2009-02-14 Thread floepi

Hi all,

I am investigating the use of data caching at the moment and was
digging around this google group. I found some very interesting posts
on how to optimize cake but no satisfactory answer to "when should I
actually use a file cache for my data".

I took over a website which uses data caching heavily, but the queries
are actually pretty straight forward with just one joint. Nothing too
recursive. The previous developer cached all that data using the cake
file cache method.

I'm not the database expert but I know that most queries are chached
in MySQL and therefore take just a few milliseconds to retrieve. Isn't
opening a file, reading the content, converting the string into an
actual php array much slower. I understand data caching makes sense
for heavy queries or when using memcache, but caching every query to
file doesn't seem right. The site is pretty big and has lots of
traffic, but I still think MySQL is better optimized than the file
system, no?

Please let me know when you are using data caching and why.

Thanks a lot.

Phil

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Joins across databases with useTable ??

2007-05-17 Thread floepi

Hi,

i would like to make a join over two databases.

In plain mySQL that is easy like

"... from a.user LEFT JOIN b.countries ..."

where a and b are on the same host.


I tried to do the same thing in cake by defining in the country model

var $useTable = 'b.countries';

but it always comes up with an error. Does anybody know how i can use
the cakes database abstraction but still make cross database joins.
Rewriting all the queries in the model like save is not really a nice
option.

Cheers

Phil


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



Group By when using array conditions

2007-05-10 Thread floepi

Hi all,

can someone please tell me how i can group in my SQL query when i am
using an array as condition for the findAll.

Have a look

$conditions['User.name'] = 'test'

$this->User->findAll($condtitions.' GROUP BY User.name')

does not work since it will concatenate the array and the group by
into something like

1rray Group by 

So how can i group my results in SQL?

Hope somebody can help me.

Cheers

Phil


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



Re: Turn off all http headers

2007-03-02 Thread floepi

Ahh actually when i compared the two files in a Hexeditor i found a
newline character which is somewhere created in my cake code.

Will try to hunt it down and hopefully make that work...

Cheers



On Mar 2, 6:32 pm, "floepi" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> sorry to be not very clear about it. Yes a whole bunch of headers are
> always sent but from my understanding the excel stream gets confused
> with the Cake Session cookie. I ran the php script to create the Excel
> file as a standalone and then in cake. The standalone works well, the
> one in cake can't be opened in Excel due to a formatting error.
>
> The only difference between the two is in the headers. The cake one
> has an additional Session cookie set.
>
> So i assume that is what is causing the problem. Maybe i can
> deactivate that for a layout or something
>
> Cheers
>
> Phil
>
> On Mar 2, 6:03 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
> > > Maybe I'm an idiot,
>
> > Well ... just kidding - I love your stuff ; ). But what I doubt is that
> > the header that phil copied was sent by CakePHP:> GET 
> > /userAdmin/reports/createExcel HTTP/1.1
> > > Host: useradmin.dev.web.mpc.local
> > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/
> > > 20061010 Firefox/2.0
> > > Accept: text/xml,application/xml,application/xhtml+xml,text/
> > > html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> > > Accept-Language: en-gb,en;q=0.5
> > > Accept-Encoding: gzip,deflate
> > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > > Keep-Alive: 300
> > > Connection: keep-alive
> > > Cookie: CAKEPHP=ntn92a5u894e0lvnn7bgi8k1a4
>
> > To me this is something that "Mozilla/5.0 (X11; U; Linux i686; en-GB;
> > rv:1.8.1) Gecko/20061010 Firefox/2.0" would send to a server, but not
> > CakePHP to a client ; ). You probably copied the GET request instead of
> > the response one.
>
> > Anyway, what you (phil) probably need is to either overwrite the
> > 'Content-type' header or to send us some more information about the
> > excel stream format and if you get any error messages or something.
>
> > -- Felix
> > --http://www.thinkingphp.orghttp://www.fg-webdesign.de
>
> > Chris Hartjes wrote:
> > > On 3/2/07, floepi <[EMAIL PROTECTED]> wrote:
>
> > >> are breaking the export when i use the normal send excel stream
> > >> option. Does anyone know how i can easily turn the http headers of for
> > >> a layout??
>
> > >> Thanks
>
> > >> Phil
>
> > > Maybe I'm an idiot, but won't ANYTHING that is served up by a web
> > > server have http headers attached to it?  Cake uses headers for
> > > sessions, so that would break Cake for sure, wouldn't it?


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



Re: Turn off all http headers

2007-03-02 Thread floepi

Hi all,

sorry to be not very clear about it. Yes a whole bunch of headers are
always sent but from my understanding the excel stream gets confused
with the Cake Session cookie. I ran the php script to create the Excel
file as a standalone and then in cake. The standalone works well, the
one in cake can't be opened in Excel due to a formatting error.

The only difference between the two is in the headers. The cake one
has an additional Session cookie set.

So i assume that is what is causing the problem. Maybe i can
deactivate that for a layout or something

Cheers

Phil

On Mar 2, 6:03 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
> > Maybe I'm an idiot,
>
> Well ... just kidding - I love your stuff ; ). But what I doubt is that
> the header that phil copied was sent by CakePHP:> GET 
> /userAdmin/reports/createExcel HTTP/1.1
> > Host: useradmin.dev.web.mpc.local
> > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/
> > 20061010 Firefox/2.0
> > Accept: text/xml,application/xml,application/xhtml+xml,text/
> > html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> > Accept-Language: en-gb,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Cookie: CAKEPHP=ntn92a5u894e0lvnn7bgi8k1a4
>
> To me this is something that "Mozilla/5.0 (X11; U; Linux i686; en-GB;
> rv:1.8.1) Gecko/20061010 Firefox/2.0" would send to a server, but not
> CakePHP to a client ; ). You probably copied the GET request instead of
> the response one.
>
> Anyway, what you (phil) probably need is to either overwrite the
> 'Content-type' header or to send us some more information about the
> excel stream format and if you get any error messages or something.
>
> -- Felix
> --http://www.thinkingphp.orghttp://www.fg-webdesign.de
>
> Chris Hartjes wrote:
> > On 3/2/07, floepi <[EMAIL PROTECTED]> wrote:
>
> >> are breaking the export when i use the normal send excel stream
> >> option. Does anyone know how i can easily turn the http headers of for
> >> a layout??
>
> >> Thanks
>
> >> Phil
>
> > Maybe I'm an idiot, but won't ANYTHING that is served up by a web
> > server have http headers attached to it?  Cake uses headers for
> > sessions, so that would break Cake for sure, wouldn't it?


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



Turn off all http headers

2007-03-02 Thread floepi

Hi all,

i am trying to use the excel writer from pear but it seems that the
headers sent by cake


GET /userAdmin/reports/createExcel HTTP/1.1
Host: useradmin.dev.web.mpc.local
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/
20061010 Firefox/2.0
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: CAKEPHP=ntn92a5u894e0lvnn7bgi8k1a4

are breaking the export when i use the normal send excel stream
option. Does anyone know how i can easily turn the http headers of for
a layout??

Thanks

Phil


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



Re: spreadsheet_excel_writer and cakephp

2007-03-02 Thread floepi

I have the same problem but i think it comes down to the little
annotation in cake which displays how long it took.



or something. Does anyone now how to turn that off ?

Cheers

Phil



On Jan 5, 2:12 am, "roman_coder" <[EMAIL PROTECTED]> wrote:
> Here is some code.  I also have the path topearin the vendors
> directory in my include path.
> .;C:\Program Files\xampp\htdocs\mem\vendors\Pear
>
> Call from within view:
>
>  vendor('Pear\Spreadsheet\Excel\Writer');
>
> $workbook = new Spreadsheet_Excel_Writer();
> $worksheet =& $workbook->addWorksheet();
>
> //Set Column Zoom to 75%
> $worksheet->setZoom(75);
>
> //Set Column Sizes
> $worksheet->setColumn(0,0,4.43);
>
> // Create a format for Titles
> $titleFormat =& $workbook->addFormat();
> $titleFormat->setBold();
> $titleFormat->setSize('14');
>
> $worksheet->write(0,1,'Events Details - Trust and
> Safety',$titleFormat);
> $workbook->send('ListVie1w.xls');
> $workbook->close();
> ?>
>
> Code from call outside of Cake:
> require_once 'Spreadsheet/Excel/Writer.php';
>
>  $workbook = new Spreadsheet_Excel_Writer();
> $worksheet =& $workbook->addWorksheet();
>
> //Set Column Zoom to 75%
> $worksheet->setZoom(75);
>
> //Set Column Sizes
> $worksheet->setColumn(0,0,4.43);
>
> // Create a format for Titles
> $titleFormat =& $workbook->addFormat();
> $titleFormat->setBold();
> $titleFormat->setSize('14');
>
> $worksheet->write(0,1,'Events Details - Trust and
> Safety',$titleFormat);
> $workbook->send('ListView.xls');
> $workbook->close();
> ?>


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



Re: hasone/belongsto with nonstandard keys

2007-01-31 Thread floepi

Ups sorry got a mistake in there.

Should be like this

$whichKey = empty($assocData['associatedKey']) ? $model->primaryKey :
$assocData['associatedKey'];
$sql .= ' = ' . $model->escapeField($whichKey);

in dbSource.

Does anyone know if that could cause problems when i do not use $this-
>name ??

Cheers

Phil

On Jan 31, 12:18 pm, "floepi" <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> i actually had the same problem and fixed it by created my own hasOne
> function.
>
> You need to change some stuff in the dbo_source file and the
> model_php5 file.
>
> on line 873 in dbo_source you can put this code in there
>
> $associatedKey = 
> trim($this->name($assocData['associatedKey']));
> $whichKey = $associatedKey =='' ? 
> $model->primaryKey :
> $associatedKey;
> $sql .= ' = ' . 
> $model->escapeField($whichKey);
>
> and in model_php5 on 250
>
> 'hasOne' => array('className', 'conditions', 'order', 
> 'foreignKey',
> 'associatedKey', 'dependent'),
>
> when you define the hasOne association just do like this
>
> var $hasOne = array('Location' =>
> array('className'=> 'Location',
>   'conditions'   => '',
>   'order'=> '',
>   'dependent'=>  true,
>   'foreignKey'   => 'user_id',
>   'associatedKey'   => 'user_id' // this
> one is the new key that i added in
> )
>   );
>
> Works really well and lets you have hasOne connections on any table.
>
> Hope that helps.
>
> Would be nice to see that function in the official release. Tell me
> what you think.
>
> Cheers
>
> Phil
>
> On Dec 13 2006, 2:24 am, "dyssident" <[EMAIL PROTECTED]> wrote:
>
> > you know, i actually did that by accident at one point, and it did in
> > fact work. however, it broke loads of other stuff because the real
> > primary key for Profile is `id`.
>
> > if feels like i should be able to define the keys to join on at both
> > ends of the association. can it be that the only way to do one-to-one
> > joins is on the primary key?
>
> > gwoo wrote:
> > > set var $primaryKey = 'zipcode'; in Profile model


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



Re: hasone/belongsto with nonstandard keys

2007-01-31 Thread floepi

Hi there,

i actually had the same problem and fixed it by created my own hasOne
function.

You need to change some stuff in the dbo_source file and the
model_php5 file.

on line 873 in dbo_source you can put this code in there


$associatedKey = 
trim($this->name($assocData['associatedKey']));
$whichKey = $associatedKey =='' ? 
$model->primaryKey :
$associatedKey;
$sql .= ' = ' . 
$model->escapeField($whichKey);

and in model_php5 on 250


'hasOne' => array('className', 'conditions', 'order', 
'foreignKey',
'associatedKey', 'dependent'),

when you define the hasOne association just do like this

var $hasOne = array('Location' =>
array('className'=> 'Location',
  'conditions'   => '',
  'order'=> '',
  'dependent'=>  true,
  'foreignKey'   => 'user_id',
  'associatedKey'   => 'user_id' // this
one is the new key that i added in
)
  );

Works really well and lets you have hasOne connections on any table.

Hope that helps.

Would be nice to see that function in the official release. Tell me
what you think.

Cheers

Phil


On Dec 13 2006, 2:24 am, "dyssident" <[EMAIL PROTECTED]> wrote:
> you know, i actually did that by accident at one point, and it did in
> fact work. however, it broke loads of other stuff because the real
> primary key for Profile is `id`.
>
> if feels like i should be able to define the keys to join on at both
> ends of the association. can it be that the only way to do one-to-one
> joins is on the primary key?
>
> gwoo wrote:
> > set var $primaryKey = 'zipcode'; in Profile model


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



Re: General condition to all my finds

2006-12-05 Thread floepi

Hmm well the conditions are not really what i was looking for. Using
cake's awesome modularity there surely should be a way to add a
condition statement to all my standard cake find methods.

I was thinking down the line of using the app_model.php and add a
beforefind() function that injects my query. Have to find out about the
db module and then add the condition i think.

Will try to keep you posted.

Thanks for the replies.

Cheers

Phil

On Dec 1, 7:49 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> I think this can be of help:
>
> http://wiki.cakephp.org/docs:understanding_associations
>
> Until someone writes a bakery article, considering that some wiki documents
> are outdated. Care to take the challenge Christoph? ;)
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de Christoph
> Enviado el: Viernes, 01 de Diciembre de 2006 04:06 p.m.
> Para: Cake PHP
> Asunto: Re:Generalcondition to all my finds
>
> As an aside, is there a bakery article out there somewhere that better
> describes what all the keys do in the association arrays?  finderQuery,
> conditions, etc?  I've searched but was unable tofindanything.  The
> documentation is very vague regarding this.


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



General condition to all my finds

2006-12-01 Thread floepi

Hi all,

is is possible to inject a condition into all my find methods. All of
my tables have an active field and i would like to create a global
condidtion for my sql queries that always filter out the records where
active is = 0

Could not find any information about it anywhere.

Thanks for your help. 

Cheers

Phil


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



Re: Findall and group by

2006-11-15 Thread floepi

Sorry maybe to make it more clear

In the chapter models in the manual you have following complex
condition (http://manual.cakephp.org/chapter/models)

array
("or" =>
array
(
"Post.title" => array("First post", "Second post", "Third
post"),
"Post.created" => "> " . date('Y-m-d', strtotime("-2 weeks"))
)
)

And now i want to group the result by Post.title. How should i do that.


Thanks in advance

Cheers





On Nov 15, 5:38 pm, "floepi" <[EMAIL PROTECTED]> wrote:
> hmm well that works if i have a string as the condition but not the
> array. I tried appending the group bit to the conditions array but that
> won't work.
>
> Array
> (
> [Job.jobName] => LIKE bc%
> [0] => group by User.userName
> )
>
> Thanks
>
> Phil
>
> On Nov 14, 10:15 pm, "bingo" <[EMAIL PROTECTED]> wrote:
>
> > hi floepi,
>
> > for grouping you can do this
> > $conditions = 'Job.location = testGroupby Col';
> > $this->Job->findAll($condition);
>
> > you can set debug to 3 and see the actually query that is being issued
> > by Cake
> 
> > regards,
> > Bingo


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



Re: Findall and group by

2006-11-15 Thread floepi

hmm well that works if i have a string as the condition but not the
array. I tried appending the group bit to the conditions array but that
won't work.

Array
(
[Job.jobName] => LIKE bc%
[0] => group by User.userName
)

Thanks

Phil

On Nov 14, 10:15 pm, "bingo" <[EMAIL PROTECTED]> wrote:
> hi floepi,
>
> for grouping you can do this
> $conditions = 'Job.location = testGroupby Col';
> $this->Job->findAll($condition);
>
> you can set debug to 3 and see the actually query that is being issued
> by Cake
> 
> regards,
> Bingo


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



Findall and group by

2006-11-14 Thread floepi

Hi all,

i was just wondering if i could somehow use the genius findall function
and define a group by option

i am not sure how i put that in the conditions. i have an array like

$conditions = array('Job.location'=>'test')
$this->Job->findAll($conditions);

but how can i group this now ??

Thanks 

Phil


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



Re: Debugging SQL

2006-11-08 Thread floepi

Aarrgh that was easy. I was looking all over the place but not there.

Cheers

Phil

On Nov 8, 1:18 pm, "Bert Van den Brande" <[EMAIL PROTECTED]> wrote:
> in core.php put the debug level to 1 or 2 ?
>
> On 11/8/06, floepi <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > i looked through various discussions about the cake sql debugging but
> > could not really work out how to do this yet. Can someone please tell
> > me "step by step" what i need to do so i can see the SQL statement and
> > the error. I try to save something and Cake does not tell me anything
> > why it does not work :(
> 
> > Thanks
> 
> > Phil


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



Debugging SQL

2006-11-08 Thread floepi

Hi,

i looked through various discussions about the cake sql debugging but
could not really work out how to do this yet. Can someone please tell
me "step by step" what i need to do so i can see the SQL statement and
the error. I try to save something and Cake does not tell me anything
why it does not work :(

Thanks

Phil


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



Re: This->query output

2006-11-07 Thread floepi

Hi,

thanks for your reply. You are right - i seem to work against the
framework due to my working habbits. I need to get used to cake first i
think.
Even so - do you know how to create your own query function. It looks
really confusing to me.

Cheers

Phil

On Nov 7, 1:33 pm, "lloydhome" <[EMAIL PROTECTED]> wrote:
> Phil,
>
> For most things it is better to have the data the way it is returned.
> I would encourage you to work within the framework and not against it.
> That said, maybe you have some logic that is legacy like I do.  I am
> porting a clumsy mess of code into Cake but it cannot be done all at
> once.  I have old methods that want the data in a flat associative
> array as you describe.  In my AppModel class I put:
>
>   /**
>* Totally flatten an array.
>*/
>   function & array_flatten(&$array) {
> if (is_array($array)) {
>   $newarray = array();
>   foreach ($array as $k=>$v) {
> if (is_array($v)) {
>   $newarray += $this->array_flatten($v);
> } else
>   $newarray[$k] = $v;
>   }
>   return $newarray;
> }
> return $array;
>   }
>
> Then to use:
>
> $newarray = array();
> foreach ($results as $v) {
>   $newarray[] = $this->User->array_flatten($v);
> 
> }HTH,
> DL


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



This->query output

2006-11-07 Thread floepi

Hi all,

i was wondering why cake gives me a weird output array for my query

Query:
SELECT
jobName,
ujc.id,
roleName,
userName,
disciplineName

FROM user_job_connections as ujc
LEFT JOIN jobs on jobs.id = ujc.job_id
LEFT JOIN roles on roles.id = ujc.role_id
LEFT JOIN users on users.id = ujc.user_id
LEFT JOIN disciplines on disciplines.id = ujc.discipline_id
WHERE userName="'.$userName.'"'



Output:
Array
(
[0] => Array
(
[jobs] => Array
(
[jobName] => hub
)

[ujc] => Array
(
[id] => 1
)

[roles] => Array
(
[roleName] => Producer
)

[users] => Array
(
[userName] => philip-f
)

[disciplines] => Array
(
[disciplineName] => Lighting
)

)

I rather would like the output to be:

Array
(
[0] => Array
(
[jobName] => hub
[id] => 1
[roleName] => Producer
[userName] => philip-f
[disciplineName] => Lighting
)

Can somebody tell me why cake creates subarrays for each joint. Makes
displaying the data in the view quite difficult.

Do i have to write my own query function which does not format the
results in such a way? Or run a formatting function after i get the
results. 

Any help appreciated. 

Thanks

Phil


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