Re: Another cakephp success story

2010-03-09 Thread gaurav.v.sharma
:)
nice website.

Did you find any difficulties in using postgresql with cakephp ?

Did you used bake command ?

Please share your experiences, I love cakePHP and in my opinion it is
the best framework for rapid development of application.

Thanks

On Mar 10, 8:50 am, welzie  wrote:
> I recently finishedhttp://www.host-rater.com.  As the name points out
> it's a site for rating web hosts.  This was my first cakephp
> application.  The site is still in beta, please try it out and let me
> know what you think.
>
> The funnest part for me was creating a helper to display the star
> ratings.  I need to get some documentation together and contribute
> that helper.  With the helper creating star fields became one line in
> the views: starRatingInput('cost_rating'); ?>
>
> Used
> --CakePHP 1.2.1
> --Postgresql
> --Recaptha helper and component
> --Homegrown
>   --star rating helper
>   --authentication and authorization component
>
> Favorite things about cakephp which I learned while doing this project
> --ability to encapsulate functionality with components and helpers
> --the out of the box view template system is great and easy to use
> --pagination works out of the box, can be a little tricky if you need
> advanced sorting
> --CoC really applies to cakephp.  You only need to write code when u
> need unique 
> functionalityhttp://en.wikipedia.org/wiki/Convention_over_configuration
>
> Again please test the site out and let me know what you think.  btw
> the site looks pretty bad in IE6 at the moment so be 
> warned.http://www.host-rater.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Checking RequestHandler::isPost() vs Controller's data

2010-03-09 Thread Miles J
Yes exactly. RequestHandler would force it only if the HTTP method is
POST, where as $data would work no matter what source it came from. I
prefer RequestHandler, but it has been buggy sometimes.

On Mar 9, 6:10 pm, Jimmy Bourassa  wrote:
> Hello,
>
> I realized that everyone seems to do an empty() call on $this->data in
> controllers in order to check if data has been posted or not.
>
> Is it just me or RequestHandler::isPost yields better results? This
> would allow to pre-fill Controller::$data in various situations.
>
> Thanks,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Installing cakephp on a subdomain on my development server

2010-03-09 Thread bowikaxu
Check the web page code that cakephp generates and check the form
submit address, maybe its the link or a bad misconfiguration on the
core.
aad

On 9 mar, 18:25, Gillian  wrote:
> I apologize for asking, but I can't seem to get this working despite
> some googling.  I just installed cakephp on a subdirectory on my xampp
> development server, and am attempting to go through the IBM tutorial
> here:http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/i...
> to give myself a feel for it. However, when I try to process the form
> athttp://127.0.0.1/cakephp/users/registerfrom the third page of the
> tutorial, I get a 404 error that apache can't find my page 
> athttp://127.0.0.1/users/register.  I assume this means that there's a
> trick to installing on a subdomain that I haven't found, though I
> suppose it's also possible that something about the tutorial is simply
> outdated.  Any help would be appreciated.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Another cakephp success story

2010-03-09 Thread welzie
I recently finished http://www.host-rater.com.  As the name points out
it's a site for rating web hosts.  This was my first cakephp
application.  The site is still in beta, please try it out and let me
know what you think.

The funnest part for me was creating a helper to display the star
ratings.  I need to get some documentation together and contribute
that helper.  With the helper creating star fields became one line in
the views: starRatingInput('cost_rating'); ?>

Used
--CakePHP 1.2.1
--Postgresql
--Recaptha helper and component
--Homegrown
  --star rating helper
  --authentication and authorization component

Favorite things about cakephp which I learned while doing this project
--ability to encapsulate functionality with components and helpers
--the out of the box view template system is great and easy to use
--pagination works out of the box, can be a little tricky if you need
advanced sorting
--CoC really applies to cakephp.  You only need to write code when u
need unique functionality
http://en.wikipedia.org/wiki/Convention_over_configuration

Again please test the site out and let me know what you think.  btw
the site looks pretty bad in IE6 at the moment so be warned.
http://www.host-rater.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 SQL Dump when debug set to 2

2010-03-09 Thread Kareem Sabri
I have 32 on the script in question. Even on scripts with 1 it doesn't
show.

On Mar 9, 8:09 pm, Jon Bennett  wrote:
> > Nope, still on 1.2
>
> there's a limit of 200 sql queries, if you have more than that none will show.
>
> J
>
>
>
>
>
>
>
> > On Mar 9, 7:23 pm, Graham Weldon  wrote:
> >> On 10/03/2010, at 11:13 AM, Kareem Sabri wrote:
>
> >> > Hello,
>
> >> > In production mode, occasionally I want to debug something in my
> >> > Content Management System.
>
> >> > So I add Configure::write('debug', 2); in my controller code.
>
> >> > I get no SQL info. The table that holds it is appended to the layout,
> >> > but it's empty except for 0 query took 0 ms (despite that many queries
> >> > are taking place). It's not just not displaying, when I view the
> >> > source code the table is empty.
>
> >> > Any suggestions?
>
> >> > Thanks!
>
> >> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> >> > with their CakePHP related questions.
>
> >> > 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 
> >> > athttp://groups.google.com/group/cake-php?hl=en
>
> >> Are you using CakePHP 1.3?
> >> If so, you'll need to include the sql_dump element
>
> >> element('sql_dump'); ?>
>
> >> Cheers,
>
> >> Graham Weldon
> >> e. gra...@grahamweldon.com
> >> p. +61 407 017 293
> >> w.http://grahamweldon.com
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> --
> jon bennett -www.jben.net- blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Checking RequestHandler::isPost() vs Controller's data

2010-03-09 Thread Jimmy Bourassa
Hello,

I realized that everyone seems to do an empty() call on $this->data in
controllers in order to check if data has been posted or not.

Is it just me or RequestHandler::isPost yields better results? This
would allow to pre-fill Controller::$data in various situations.

Thanks,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Installing cakephp on a subdomain on my development server

2010-03-09 Thread Gillian
I apologize for asking, but I can't seem to get this working despite
some googling.  I just installed cakephp on a subdirectory on my xampp
development server, and am attempting to go through the IBM tutorial
here: 
http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/index.html
to give myself a feel for it. However, when I try to process the form
at http://127.0.0.1/cakephp/users/register from the third page of the
tutorial, I get a 404 error that apache can't find my page at
http://127.0.0.1/users/register.  I assume this means that there's a
trick to installing on a subdomain that I haven't found, though I
suppose it's also possible that something about the tutorial is simply
outdated.  Any help would be appreciated.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 SQL Dump when debug set to 2

2010-03-09 Thread Jon Bennett
> Nope, still on 1.2

there's a limit of 200 sql queries, if you have more than that none will show.

J

>
> On Mar 9, 7:23 pm, Graham Weldon  wrote:
>> On 10/03/2010, at 11:13 AM, Kareem Sabri wrote:
>>
>>
>>
>>
>>
>> > Hello,
>>
>> > In production mode, occasionally I want to debug something in my
>> > Content Management System.
>>
>> > So I add Configure::write('debug', 2); in my controller code.
>>
>> > I get no SQL info. The table that holds it is appended to the layout,
>> > but it's empty except for 0 query took 0 ms (despite that many queries
>> > are taking place). It's not just not displaying, when I view the
>> > source code the table is empty.
>>
>> > Any suggestions?
>>
>> > Thanks!
>>
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>> > with their CakePHP related questions.
>>
>> > 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 
>> > athttp://groups.google.com/group/cake-php?hl=en
>>
>> Are you using CakePHP 1.3?
>> If so, you'll need to include the sql_dump element
>>
>> element('sql_dump'); ?>
>>
>> Cheers,
>>
>> Graham Weldon
>> e. gra...@grahamweldon.com
>> p. +61 407 017 293
>> w.http://grahamweldon.com
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>



-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 SQL Dump when debug set to 2

2010-03-09 Thread Kareem Sabri
Nope, still on 1.2

On Mar 9, 7:23 pm, Graham Weldon  wrote:
> On 10/03/2010, at 11:13 AM, Kareem Sabri wrote:
>
>
>
>
>
> > Hello,
>
> > In production mode, occasionally I want to debug something in my
> > Content Management System.
>
> > So I add Configure::write('debug', 2); in my controller code.
>
> > I get no SQL info. The table that holds it is appended to the layout,
> > but it's empty except for 0 query took 0 ms (despite that many queries
> > are taking place). It's not just not displaying, when I view the
> > source code the table is empty.
>
> > Any suggestions?
>
> > Thanks!
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Are you using CakePHP 1.3?
> If so, you'll need to include the sql_dump element
>
> element('sql_dump'); ?>
>
> Cheers,
>
> Graham Weldon
> e. gra...@grahamweldon.com
> p. +61 407 017 293
> w.http://grahamweldon.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 SQL Dump when debug set to 2

2010-03-09 Thread Graham Weldon

On 10/03/2010, at 11:13 AM, Kareem Sabri wrote:

> Hello,
> 
> In production mode, occasionally I want to debug something in my
> Content Management System.
> 
> So I add Configure::write('debug', 2); in my controller code.
> 
> I get no SQL info. The table that holds it is appended to the layout,
> but it's empty except for 0 query took 0 ms (despite that many queries
> are taking place). It's not just not displaying, when I view the
> source code the table is empty.
> 
> Any suggestions?
> 
> Thanks!
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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

Are you using CakePHP 1.3?
If so, you'll need to include the sql_dump element

element('sql_dump'); ?>

Cheers,

Graham Weldon
e. gra...@grahamweldon.com
p. +61 407 017 293
w. http://grahamweldon.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 SQL Dump when debug set to 2

2010-03-09 Thread Kareem Sabri
Hello,

In production mode, occasionally I want to debug something in my
Content Management System.

So I add Configure::write('debug', 2); in my controller code.

I get no SQL info. The table that holds it is appended to the layout,
but it's empty except for 0 query took 0 ms (despite that many queries
are taking place). It's not just not displaying, when I view the
source code the table is empty.

Any suggestions?

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 custom methods in related models

2010-03-09 Thread mathaios
Ok, I've done some other tests and...I've found the problem.

The problem is that I'm stupid.

'className' => 'SisField',
should be instead
'className' => 'SiS.SisField',

it's even in the manuali do not understand how i could overlook
thisi need a vacation!

thanks very much to all anyway for the support!

On 8 Mar, 10:16, WebbedIT  wrote:
> Andy is asking you to remove your className and foreign_key
> definitions to allow cake to try and define that relationship for you,
> but as I believe your definitions to completely follow convention I'm
> not sure how that will help in this case.
>
> I run MilesJ's forum plugin in my site and from that I am calling
> related models without issue so I very much doubt this is a bug with
> the core when using plugins.
>
> Yo8u say this only happens when calling a related model from a
> controller, my guessing is it will do this when calling a related
> model from a model too.  For some reason Cake is not finding your
> model, you need to play around with renaming it etc. to eventually get
> to the bottom of it.  Are all your other models working ok, is it just
> this one?
>
> HTH
>
> Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 to decide to use cakephp

2010-03-09 Thread Thiago Elias
Hi Tiago.

I think what you want to do is really easy to do, even because you said
these menus will be static.

You should use Elements instead of put everything direct on default.ctp, and
then you just call your menu like this:

$this->element("elementName");

The element is just another View file (ctp) (views/elements) that you may
call when you need.

I've maded this in my personal website (www.thiagoelias.org) - Static Menu,
and where I work (www.cidadaopg.sp.gov.br) (Dynamic Menu) The Dynamic menu
was a little bit more complicated, (due to the system table schema, but to
make the views and necessary code in controllers is pretty easy).

I hope my information was useful.

See ya. (Até a próxima).

Atenciosamente,
Thiago Elias Rezende Silva
Programador Portal CidadãoPG
www.cidadaopg.sp.gov.br




Em 9 de março de 2010 15:25, Tiago N. Sampaio escreveu:

> Hi,
>
>Im reading about cakephp, and i have one doubt. I need to find one
> framework to learn to easily develop small systems.
>It is possible to create a complex system with frames, and in one
> frame
> i have menu and another frame the application itself?
> Menu must be static and do no change every new app called, and maybe i
> use iframe for that.
>
>I will try to illustrate what i want, with ascii art hehe.
>
>
> 
>System menu (some cool css menu)
> 
>
> Application screen
>
> Fields...
>
>
> 
> (Footer)  Powered By CakePHP
> 
>
> I think that i can do this placing code on views/layouts/default.ctp,
> but this is the best to do?
> Can i have some problems doing this in this way?
>
> Thanks.
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: I have an ORM problem

2010-03-09 Thread Martin Duris
> Undefined index:  Author [APP/views/books/index.ctp, line 9]

problem line :
>

i think, problem is in parsed array - you are trying to echo something
that not exist - in array
($book['Author'] dosnt exist or $book['Author']['name'] dosnt exist )

2010/3/9 monicob :
> Hi, all. I have the following problem with ORM:
>
> I'm learning to use it. I create two tables: books and author, two
> models, two controllers, two HTML files. However, when I run books
> index.ctp
>
> I got the following error message:
>
> Undefined index:  Author [APP/views/books/index.ctp, line 9]
>
>
> --index.ctp file 
>
> 
>    
> ISBNTitleAuthor
>    
>    
>    
>    
>    
>    
>    
>    
>    
>
>  I took this cakePHP code from book named: CakePHP Application
> Development edited by Packt publishing.
>
> Any ideas?
>
> TIA
>
> Monico
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 to decide to use cakephp

2010-03-09 Thread Tiago N. Sampaio
Hi,

Im reading about cakephp, and i have one doubt. I need to find one
framework to learn to easily develop small systems.
It is possible to create a complex system with frames, and in one frame
i have menu and another frame the application itself?
Menu must be static and do no change every new app called, and maybe i
use iframe for that.

I will try to illustrate what i want, with ascii art hehe.



System menu (some cool css menu)


Application screen

Fields...



(Footer)  Powered By CakePHP


I think that i can do this placing code on views/layouts/default.ctp,
but this is the best to do?
Can i have some problems doing this in this way?

Thanks.


signature.asc
Description: Esta é uma parte de mensagem assinada digitalmente


Pagination conditions involving associated data

2010-03-09 Thread WhyNotSmile
Hi everyone, I wonder whether you could help me with the following:

I have 2 models, Album and Photo.  An Album HasMany Photos, and a
Photo BelongsTo an Album.

I want to paginate the albums, but I don't want to show the ones with
no photos (occasionally there may be an empty album on the system).

Is it possible to do this in some way?  I would need to paginate the
Albums but apply the conditions to the associated Photos.  E.g. what I
want is to be able to say:

$this->paginate = array('conditions' => array('count(Album Photos) > '
=> 0));

or something like that!  But obviously that won't work, so is there a
way of doing this?

Alternatively, is there a way of paginating all albums and then
removing all the ones that are empty?  I can remove them from the
pagination array, but the count variables etc are wrong.

Thanks in advance for reading!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


I have an ORM problem

2010-03-09 Thread monicob
Hi, all. I have the following problem with ORM:

I'm learning to use it. I create two tables: books and author, two
models, two controllers, two HTML files. However, when I run books
index.ctp

I got the following error message:

Undefined index:  Author [APP/views/books/index.ctp, line 9]


--index.ctp file 



ISBNTitleAuthor










 I took this cakePHP code from book named: CakePHP Application
Development edited by Packt publishing.

Any ideas?

TIA

Monico


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


CakePHP job in South Florida

2010-03-09 Thread Bnardi
Job Requirements:

Strong knowledge of PHP, jQuery, AJAX, XML, HTML, CSS and database
technology.
Ability to work in either Windows, *nix or Mac’s environments.
Organized, with strong understanding of business processes,
familiarity with bug tracking and OOP principals.
API integration experience with sites such as eBay and Google
Version control system experience such as CVS, SVN, Git, etc.
Knowledge of strong web development IDE

2400 East Commercial Blvd, Suite 320
Ft. Lauderdale, FL 33308
Phone: 954-745-2209 I Mobile: 305-432-7989
Fax: 954-491-8126

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How use __consruct in model

2010-03-09 Thread Andy Dirnberger
You need to do two things:
1. Accept all of the parent constructor's parameters
2. Call the parent constructor

function __construct($id = false, $table = null, $ds = null) {
  parent::__construct($id, $table, $ds);

  ...

}

That said, I'm not exactly sure what you're doing with parent::$this-
>VAR. You don't need "parent::," and, if all you're doing to do in the
constructor is assign a few values, you can skip the constructor
altogether:
class TypeDeal extends AppModel {
  var $useTable = null;
  var $general = true;

  ...

}

On Mar 9, 1:10 am, Jets  wrote:
> Hi,  i am trying to use constructor in models. my code is that
>
>  class TypeDeal extends AppModel {
>         var $name ='TypeDeal';
>
>         var $validate =array(
>         'id' => array('rule' => 'notEmpty', 'message' => 'Not Empty')
>         );
>         function __construct(){
>         //      parent::$this->useTable=null;
>                 //set the $generic variable for enabling the functions 
> defined in
> AppModel
>                 parent::$this->generic=true;
>         }
>
> }
>
> but its not working. can anyone tell me , how we can use this...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


initialize model link make the apps very slow

2010-03-09 Thread Mukhamad Ikhsan
when build small apps with a few table and model relation, the
responsiveness of apps is still usable, but now when i creating many
tables with many relation, the apps is incredibly slow.

then i'm tryng to find how why the apps is very slow, and i find this flow :
bootstrap -> dispatcher -> invoke -> constructor -> loadModel, i know
even on bootstrap and dispatch the process has take a quite long
enough but is worse when loading the model, the process recursively
creating the object model that associate with model controller.

so even for a little task, cakephp always 'preparing' the worst case,
generate all relation that defined on model class. in my case (many
tables with many association defined) the bottleneck is in model
objects creation, not on the query process.

it's there a best practice to make just initialize needed model, but
still easy to maintain than by using recursive 0, and bind one by one
on the code, or worst by using app::import model on every call.

thank's





-- 
Mukhamad Ikhsan
Y!id:ikhsan_only
http://www.diodachi.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Authentication using external service?

2010-03-09 Thread Mal
Hi,
has anyone done any work on integrating cake with something like
mod_auth_pam to authenticate users from the Linux login database or
any other external service, such as LDAP?
Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Exporting large amount of data from cake application

2010-03-09 Thread Jorge Horacio Cué Cantú
Hello,

Why don't You take a look at the article "Star schema (OLAP) setup for
reporting" at the backery.
It might be used for exporting instead reporting.

The link to the article is

http://bakery.cakephp.org/articles/view/starschema-olap-setup-for-reporting

Please let us know your insights.
Regards.

On Mon, Mar 8, 2010 at 1:45 PM, barduck  wrote:

>
> Hi,
>
> In my cake application (1.2, apache, mysql), I need to export a large
> amount of data (tens of thousands of records or more) in XML format.
> The query itself is heavy but nothing the application/database
> shouldn't handle reasonably (it takes ~1-2 seconds to complete the
> query itself).
>
> I first tried the naive way of just calling find() and passing the
> result to an XML view. This, of course, chokes the application pretty
> quickly and PHP runs out of memory.
>
> Next I tried "paging" the query internally within one call in my
> controller, rending each chuck and flushing the output buffer
> manually. This worked better but it is taking way too long since I now
> have dozens of queries instead of one, each taking over a second to
> complete.
>
> Now I know there must be a way to achieve this since running the same
> query in phpmyadmin and exporting the result as XML works very well. I
> guess that in this case I need to somehow bypass some of cake
> mechanisms, iterate over the result set myself and steam the data to
> the client.
>
> But I still want to use some of cake's strengths when possible so I
> figured I need to do something like this.
>
> * use cake for the request: routes, controller/action, parse input
> parameters
> * use cake models to generate the find query
> * obtain the SQL query from cake
> * get the active mysql database connection from cake
> * execute the query on the raw connection
> * iterate over the result set, generate the XML elements, sending
> chucks of data to the client and flushing as needed.
>
> (when the above works I may save the XML to intermediate file for
> caching and redirect to that file, using cake's cache to control
> expiration).
>
> Does the above make sense or is there any better way to achieve my
> goal?
>
> How do I get the raw SQL query for my models without executing it?
> How do I get the database connection?
>
> Any help is appreciated.
>
> Thanks!
>
> - barduck
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Using "'Model.column' => array(1, 2, 3)" with mssql

2010-03-09 Thread p_W
When I use this syntax with mysql, it seems to 'unpack' the array
correctly, and the query generated is something like

"...WHERE 'Model.column' IN (1, 2, 3)..."

When I use sql server, the query generated is

"...WHERE 'Model.column' IN 'Array'"...

which obviously generates an error.  Anyone have any suggestions?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cakephp core customize

2010-03-09 Thread genellern
DONE!!!

even i could not find any help i have finalized succesfully me job, if
anybody any time need some,
 just let know that and i'll do the best i can,

thanks anyway

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


How to save data in an associative model without deleting the old related records.

2010-03-09 Thread Weather Forecaster
How do I make so that Cakephp not delete related records before
adding, new.

There are two models of Shop and MainService.

Contact them so:

 class Shop extends AppModel {

 var $hasAndBelongsToMany = array(
'MainService' =>
 array( 'className'  => 'MainService')
 );
 }

Stored in the form:

 $this->Shop->saveAll($this->data);

What happens to the base:

 SELECT `ShopsMainService`.`main_services_id` FROM
`shops_main_services` AS `ShopsMainService` WHERE
`ShopsMainService`.`carwash_id` = 71

DELETE `ShopsMainService` FROM `shops_main_services` AS
`ShopsMainService` WHERE `ShopsMainService`.`carwash_id` = 71 AND
`ShopsMainService`.`main_services_id` IN (41, 32, 30, 29, 27, 26, 23,
17, 13, 11, 7, 6, 4, 2)

   INSERT INTO `Shops_main_services` (`carwash_id`,`main_services_id`)
VALUES (71,'2'), (71,'4'), (71,'6'), (71,'7'), (71,'11'), (71,'13'),
(71,'17'), (71,'23'), (71,'26'), (71,'27'), (71,'29'), (71,'30'),
(71,'32'), (71,'41')


How to disable the removal?


The documentation is written here is  
http://book.cakephp.org/view/75/Saving-Your-Data

"By default when saving a HasAndBelongsToMany relationship, Cake will
delete all rows on the join table before saving new ones. For example
if you have a Club that has 10 Children associated. You then update
the Club with 2 children. The Club will only have 2 Children, not
12."

But how to do to disable the removal unclear.


p.s.

Ideally, it was good so CakePHP removed the missing connection add new
ones, and existing ones are not touched.

Example:
The database is the connection with ID: 1,3,5,7

Obtain new: 5,7,9
It is necessary to: remove entries with the Id 1,3
add 9
and 5.7 remain unchanged.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Initial loading of Cake problem: Trying to get property of non-object in ...

2010-03-09 Thread Brian
Hi, I am just starting to load & learn Cake, and I believe that I've
followed the correct process to get started, but I'm running into a
fatal error. I've loaded CakePHP 1.3.0, Apache 2.2, PHP 5.3. After I
load Cake into the Apache htdocs folder, change the folder name to
"first_app", and then try to run it ("http:\localhost\first_app", I
get this error message that I don't know what to do with. Has anybody
run into this before? I'm on a Windows Vista 64 bit machine. I've not
changed anything so far as I know, and I get the same problem with
Cake 1.2.6.

Notice: Trying to get property of non-object in C:\Program Files
(x86)\Apache Software Foundation\Apache2.2\htdocs\first_app\cake\libs
\cache\file.php on line 252

Fatal error: Call to a member function cd() on a non-object in C:
\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs
\first_app\cake\libs\cache\file.php on line 252

Thoughts?

Brian

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: SaveAll HABTM Saving to wrong tables...

2010-03-09 Thread nurvzy
First, your table name is wrong, should be contacts_phones instead of
contacts_phone.   Second, you're not forming your data correctly in
your view for a hasAndBelongsToMany relationship.  CakePHP expects a
HABTM relationship to come in as [Model][Model][id]s.  What you have
there is a hasMany relationship setup, which actually makes more
sense.

It looks to me from your view file that what you really want is a
Contact->hasMany->Phone instead of Contact->hasAndBelongsTo->Phone.
Setting up a hasMany relationship is easy, just remove your
contacts_phones table and add contact_id field to your phones table.

A hasAndBelongsToMany relationship between Contact and Phone means
multiple contacts can the same phone number and visa versa, that's
probably not what you want, but if it is you'll need rework your view
so your contact can select form a list of phone numbers to associate
with.  Review http://book.cakephp.org/view/189/Automagic-Form-Elements
for tips on making your HABTM relationship easier.

Hope that helps,
Nick
On Mar 9, 7:05 am, Mark  wrote:
> I am working on a project that involves a lot of many to many
> relationships, and for some reason cakephp isn't playing nice with
> them.  Take the following tables:
>
> Table: contacts
> id
> name
> created
> updated
>
> Table: phones
> id
> number
>
> Table: contacts_phone
> contact_id
> phone_id
>
> Here are my two models:
>
> class Contact extends AppModel{
>     var $name = 'Contact';
>     var $hasAndBelongsToMany = 'Phone';
>
> }
>
> class Phone extends AppModel{
>     var $name = 'Phone';
>     var $hasAndBelongsToMany = 'Contact';
>
> }
>
> The controller:
>
>     function add(){
>         if(!empty($this->data)){
>             if($this->Contact->saveAll($this->data)){
>                 $this->Session->setFlash('Contact has been saved');
>             }
>         }
>     }
>
> And the view:
>
> Add Contact
>  echo $form->create('Contact');
> echo $form->input('Contact.name');
> echo $form->input('Phone.0.number');
> echo $form->end('Save');
> ?>
>
> The result?
>
> 1       START TRANSACTION               0               0
> 2       INSERT INTO `contacts` (`name`, `updated`, `created`) VALUES
> ('Mark', '1268143497', '1268143497')            1               0
> 3       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> 4       SELECT `ContactsPhone`.`phone_id` FROM `contacts_phones` AS
> `ContactsPhone` WHERE `ContactsPhone`.`contact_id` = 3          0       0     
>   0
> 5       COMMIT          0               0
>
> What am I missing?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


SaveAll HABTM Saving to wrong tables...

2010-03-09 Thread Mark
I am working on a project that involves a lot of many to many
relationships, and for some reason cakephp isn't playing nice with
them.  Take the following tables:

Table: contacts
id
name
created
updated

Table: phones
id
number

Table: contacts_phone
contact_id
phone_id

Here are my two models:

class Contact extends AppModel{
var $name = 'Contact';
var $hasAndBelongsToMany = 'Phone';
}

class Phone extends AppModel{
var $name = 'Phone';
var $hasAndBelongsToMany = 'Contact';

}

The controller:

function add(){
if(!empty($this->data)){
if($this->Contact->saveAll($this->data)){
$this->Session->setFlash('Contact has been saved');
}
}
}

And the view:

Add Contact
create('Contact');
echo $form->input('Contact.name');
echo $form->input('Phone.0.number');
echo $form->end('Save');
?>

The result?

1   START TRANSACTION   0   0
2   INSERT INTO `contacts` (`name`, `updated`, `created`) VALUES
('Mark', '1268143497', '1268143497')1   0
3   SELECT LAST_INSERT_ID() AS insertID 1   1   0
4   SELECT `ContactsPhone`.`phone_id` FROM `contacts_phones` AS
`ContactsPhone` WHERE `ContactsPhone`.`contact_id` = 3  0   0   0
5   COMMIT  0   0


What am I missing?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: find list with CONCAT returns empty data

2010-03-09 Thread nurvzy
So in your case you would define something like this in your Tree
model:
var $virtualFields = array(
'name' => 'CONCAT(Tree.cultivar, "-", Tree.stage)'
);

Then in your find:
$crop = $this->Tree->find('list', array('fields' => array('id',
'name')));

However you can further simplify your query because id and name are
defaults for find('list')
$crop = $this->Tree->find('list');

Have fun,
Nick

On Mar 9, 4:44 am, nurvzy  wrote:
> If you're on 1.3 use Virtual Fields 
> --http://book.cakephp.org/view/1608/Virtual-fields.
>
> So this is a pretty common gotcha with CakePHP.  If you use one of
> those SQL tricks the result will be outside cake's array scope.  If
> you were to do a find('all') on that you would see your CONCAT
> field in the key 0 of $crop.  As such, when using find('list') the key
> 0 is not within CakePHP's model scope which in turn is ignored giving
> you what you see now.
>
> Virtual Fields (new in 1.3) to the rescue.  You can define these
> special "not real" fields and they react like you would expect any
> normal field would within a find, condition, or pagination.  Pretty
> cool!
>
> Hope that helps,
> Nick
>
> On Mar 9, 3:45 am, Eleazar  wrote:
>
> > Quick update: the following also produces the above result
> > $crp = $this->Tree->find('list',array('fields'=>array('id','cultivar
> > AS name')));
>
> > but
>
> > $crp = $this->Tree-
>
> > >find('list',array('fields'=>array('id','cultivar')));
>
> > works fine. Again, I'm on 1.3 beta, maybe this has been resolved?
>
> > Thanks
>
> > On Mar 9, 12:40 pm, Eleazar  wrote:
>
> > > Hi, I have the following code:
>
> > > $crop = 
> > > $this->Tree->find('list',array('fields'=>array('id','CONCAT(Tree.cultivar,\'
> > >  -
>
> > > \' ,Tree.stage) AS name')));
> > >         debug($crop);
>
> > > It produces the following SQL:
>
> > > SELECT `Tree`.`id`, CONCAT(Tree.cultivar,' - ' ,Tree.stage) AS name
> > > FROM `trees` AS `Tree` WHERE 1 = 1
>
> > > When I debug $crop I get this:
> > > Array
> > > (
> > >     [1] =>
> > > )
>
> > > There is only one entry in the Tree table so the 1 is fine, but there
> > > is no data... when I run the query directly in phpmyadmin I get
> > > id      name
> > > 1       apples - year1
>
> > > The fact that $crop has a key but no value seems to be a bug? I'm not
> > > sure how to report this if indeed it is. I'm using 1.3 beta.
>
> > > Any help or comments would be appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: protect source code & security salt ...

2010-03-09 Thread Eleazar
If other people will have access to the ftp, then you can obscure your
code by removing all linebreaks and whitespaces so it's difficult for
humans to read (I'm sure you'll get a script for that somewhere). I've
also heard that you can compile the php code into machine code...
haven't done it before but maybe a search will turn up a tutorial or
two on the subject.



On Mar 9, 9:45 am, Miles J  wrote:
> No one can access the files unless they get in through your FTP or
> cpanel. Make sure everything is protected safely: FTP, SSH, etc.
>
> On Mar 8, 11:27 pm, "toka...@gmail.com"  wrote:
>
> > Hi,
> > How can I protect my (cake) PHP code  when putting my app on
> > webhosting?
>
> > I need to be sure:
>
> > 1) that nobody can steal/modify the source
>
> > 2) the security salt value and database.config are somehow
> > protected...
>
> > any idea? I dont have any experience in this area.
>
> > Thanks
> > Tomas

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: find list with CONCAT returns empty data

2010-03-09 Thread nurvzy
If you're on 1.3 use Virtual Fields -- 
http://book.cakephp.org/view/1608/Virtual-fields.

So this is a pretty common gotcha with CakePHP.  If you use one of
those SQL tricks the result will be outside cake's array scope.  If
you were to do a find('all') on that you would see your CONCAT
field in the key 0 of $crop.  As such, when using find('list') the key
0 is not within CakePHP's model scope which in turn is ignored giving
you what you see now.

Virtual Fields (new in 1.3) to the rescue.  You can define these
special "not real" fields and they react like you would expect any
normal field would within a find, condition, or pagination.  Pretty
cool!

Hope that helps,
Nick


On Mar 9, 3:45 am, Eleazar  wrote:
> Quick update: the following also produces the above result
> $crp = $this->Tree->find('list',array('fields'=>array('id','cultivar
> AS name')));
>
> but
>
> $crp = $this->Tree-
>
> >find('list',array('fields'=>array('id','cultivar')));
>
> works fine. Again, I'm on 1.3 beta, maybe this has been resolved?
>
> Thanks
>
> On Mar 9, 12:40 pm, Eleazar  wrote:
>
> > Hi, I have the following code:
>
> > $crop = 
> > $this->Tree->find('list',array('fields'=>array('id','CONCAT(Tree.cultivar,\'
> >  -
>
> > \' ,Tree.stage) AS name')));
> >         debug($crop);
>
> > It produces the following SQL:
>
> > SELECT `Tree`.`id`, CONCAT(Tree.cultivar,' - ' ,Tree.stage) AS name
> > FROM `trees` AS `Tree` WHERE 1 = 1
>
> > When I debug $crop I get this:
> > Array
> > (
> >     [1] =>
> > )
>
> > There is only one entry in the Tree table so the 1 is fine, but there
> > is no data... when I run the query directly in phpmyadmin I get
> > id      name
> > 1       apples - year1
>
> > The fact that $crop has a key but no value seems to be a bug? I'm not
> > sure how to report this if indeed it is. I'm using 1.3 beta.
>
> > Any help or comments would be appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: find list with CONCAT returns empty data

2010-03-09 Thread Eleazar
Quick update: the following also produces the above result
$crp = $this->Tree->find('list',array('fields'=>array('id','cultivar
AS name')));

but

$crp = $this->Tree-
>find('list',array('fields'=>array('id','cultivar')));

works fine. Again, I'm on 1.3 beta, maybe this has been resolved?


Thanks


On Mar 9, 12:40 pm, Eleazar  wrote:
> Hi, I have the following code:
>
> $crop = 
> $this->Tree->find('list',array('fields'=>array('id','CONCAT(Tree.cultivar,\' -
>
> \' ,Tree.stage) AS name')));
>         debug($crop);
>
> It produces the following SQL:
>
> SELECT `Tree`.`id`, CONCAT(Tree.cultivar,' - ' ,Tree.stage) AS name
> FROM `trees` AS `Tree` WHERE 1 = 1
>
> When I debug $crop I get this:
> Array
> (
>     [1] =>
> )
>
> There is only one entry in the Tree table so the 1 is fine, but there
> is no data... when I run the query directly in phpmyadmin I get
> id      name
> 1       apples - year1
>
> The fact that $crop has a key but no value seems to be a bug? I'm not
> sure how to report this if indeed it is. I'm using 1.3 beta.
>
> Any help or comments would be appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to save data in an associative model without deleting the old related records.

2010-03-09 Thread nurvzy
To get what you want you'll need to set 'unique' => false within your
declaration of HABTM association in your model.

//models/shop.php
var $hasAndBelongsToMany = array(
  'MainService' => array(
'className' => 'MainService',
'unique' => false,
  )
);

Here is the documentation of all the available key options for HABTM
and what they do:
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM

Hope that helps,
Nick

On Mar 9, 6:20 am, Weather Forecaster  wrote:
> How do I make so that Cakephp not delete related records before
> adding, new.
>
> There are two models of Shop and MainService.
>
> Contact them so:
>
>      class Shop extends AppModel {
>
>          var $hasAndBelongsToMany = array(
>                 'MainService' =>
>                      array( 'className'              => 'MainService')
>                  );
>      }
>
> Stored in the form:
>
>      $this->Shop->saveAll($this->data);
>
> What happens to the base:
>
>      SELECT `ShopsMainService`.`main_services_id` FROM
> `shops_main_services` AS `ShopsMainService`     WHERE
> `ShopsMainService`.`carwash_id` = 71
>
>     DELETE `ShopsMainService` FROM `shops_main_services` AS
> `ShopsMainService` WHERE `ShopsMainService`.`carwash_id` = 71 AND
> `ShopsMainService`.`main_services_id` IN (41, 32, 30, 29, 27, 26, 23,
> 17, 13, 11, 7, 6, 4, 2)
>
>    INSERT INTO `Shops_main_services` (`carwash_id`,`main_services_id`)
> VALUES (71,'2'), (71,'4'), (71,'6'), (71,'7'), (71,'11'), (71,'13'),
> (71,'17'), (71,'23'), (71,'26'), (71,'27'), (71,'29'), (71,'30'),
> (71,'32'), (71,'41')
>
> How to disable the removal?
>
> The documentation is written here is  
> http://book.cakephp.org/view/75/Saving-Your-Data
>
> "By default when saving a HasAndBelongsToMany relationship, Cake will
> delete all rows on the join table before saving new ones. For example
> if you have a Club that has 10 Children associated. You then update
> the Club with 2 children. The Club will only have 2 Children, not
> 12."
>
> But how to do to disable the removal unclear.
>
> p.s.
>
> Ideally, it was good so CakePHP removed the missing connection add new
> ones, and existing ones are not touched.
>
> Example:
> The database is the connection with ID: 1,3,5,7
>
> Obtain new: 5,7,9
> It is necessary to: remove entries with the Id 1,3
>                             add 9
>                             and 5.7 remain unchanged.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best pattern to control which data save

2010-03-09 Thread nurvzy
You can always pass in array('validate' => false) during a save to
bypass all validation rules.

So in your admin_edit() action you would could use:
$this->save($this->data, array('validate' => false));

Be advised you're database restrictions will still be in place (eg.
can't put strings in INT fields, etc...)

Hope that helps,
Nick

On Mar 9, 4:23 am, "marco.rizze...@gmail.com"
 wrote:
> For example if I am superadmin I would can edit and add data even if I
> don't respect the valdation rule.
> So I will have views like superadmin_add,superadmin_edit where  I
> disable validation rule
>
> On 9 Mar, 11:18, WebbedIT  wrote:
>
> > The answer depends on exactly what you're doing at the time.
>
> > Within your validation rules you can specify if the rule applies on
> > add or edit.
>
> > Or you can alter the models validation array from with the controller
> > by calling unset($this->ModelName->validate['fieldName']); or
> > something similar.
>
> > Also, by not including the field in the data array cake will not try
> > to validate it.
>
> > Which one to use depends on what it is you're trying to do.
>
> > HTH
>
> > Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best pattern to control which data save

2010-03-09 Thread marco.rizze...@gmail.com
For example if I am superadmin I would can edit and add data even if I
don't respect the valdation rule.
So I will have views like superadmin_add,superadmin_edit where  I
disable validation rule

On 9 Mar, 11:18, WebbedIT  wrote:
> The answer depends on exactly what you're doing at the time.
>
> Within your validation rules you can specify if the rule applies on
> add or edit.
>
> Or you can alter the models validation array from with the controller
> by calling unset($this->ModelName->validate['fieldName']); or
> something similar.
>
> Also, by not including the field in the data array cake will not try
> to validate it.
>
> Which one to use depends on what it is you're trying to do.
>
> HTH
>
> Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


find list with CONCAT returns empty data

2010-03-09 Thread Eleazar
Hi, I have the following code:

$crop = $this->Tree-
>find('list',array('fields'=>array('id','CONCAT(Tree.cultivar,\' -
\' ,Tree.stage) AS name')));
debug($crop);

It produces the following SQL:

SELECT `Tree`.`id`, CONCAT(Tree.cultivar,' - ' ,Tree.stage) AS name
FROM `trees` AS `Tree` WHERE 1 = 1

When I debug $crop I get this:
Array
(
[1] =>
)

There is only one entry in the Tree table so the 1 is fine, but there
is no data... when I run the query directly in phpmyadmin I get
id  name
1   apples - year1

The fact that $crop has a key but no value seems to be a bug? I'm not
sure how to report this if indeed it is. I'm using 1.3 beta.

Any help or comments would be appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Subdomain Auth Problem

2010-03-09 Thread Kyle Decot
Since I've done all of your suggestions an I'm still having no success
perhaps it's the way that I'm doing my subdomains. Here's how I'm
doing it. Let me know what you think. In my routes.php I have:

$subdomain = substr(env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"),
"."));

if ($subdomain == 'api') {

}

else if(

Then in my hosting cpanel, I go to the subdomains tab and add a new
subdomain, and set my cake app directory as the path for the
subdomain. Is this an acceptable way of doing this or could this be
the cause of my problems.

On Mar 8, 5:28 pm, Kyle Decot  wrote:
> I inserted that but still when I go to blog.mysite.com and do 
> $this->Session->read(); in my app_controller.php's beforeRender() It doesn't
>
> contain my user information. Any other ideas or suggestions?
>
> On Mar 8, 3:05 pm, Bernardo Vieira  wrote:
>
>
>
> > I have it in my beforeFilter callback in app_controller:
> > $this->Cookie->domain = '.mydomain.tld';
>
> > Note that the '.' before your domain name is what tells the browser that the
> > cookie is valid for *.mydomain.tld.
>
> > On Mon, Mar 8, 2010 at 4:50 PM, Kyle Decot  wrote:
> > > Where do I set the realm for the session cookie? The security level in
> > > my core.php file is set to low.
>
> > > On Mar 8, 6:47 am, Bernardo Vieira  wrote:
> > > > You also need to set the realm of the session cookie to your domain
> > > > (it defaults to the hostname) and set the security level of the
> > > > security component below 2
>
> > > > On 3/8/10, Kyle Decot  wrote:
>
> > > > > Well my sessions.save is set to database in my core.php file. Also, I
> > > > > did $session->read() on my www page and I get all of my auth info,
> > > > > however if I do the same thing on, blog.mysite.com then auth is now
> > > > > empty. Any ideas on next steps to take towards solving this? Thanks
> > > > > guy.
>
> > > > > On Mar 7, 8:36 pm, Nabil Alsharif  wrote:
> > > > >> My first guess would be that you lost session data when you went to
> > > the
> > > > >> subdomain. Maybe because the session cookies weren't sent with the
> > > > >> requests going to the subdomain or maybe something else, I'm can't 
> > > > >> see
> > > > >> whats happening on your servers The point is it's easy to check 
> > > > >> if
> > > > >> the session was lost, that wold be the first thing I'd look at. Good
> > > > >> luck.
>
> > > > >> On Sun, 2010-03-07 at 15:25 -0800, Kyle Decot wrote:
> > > > >> > Yep. It's all one Cake App. Any ideas?
>
> > > > >> > On Mar 7, 11:43 am, cricket  wrote:
> > > > >> > > A subdomain is usually a completely separate site. Do you already
> > > > >> > > have
> > > > >> > > the same Cake app serving all of your subdomains?
>
> > > > >> > > On Mar 6, 5:34 pm, Kyle Decot  wrote:
>
> > > > >> > > > I have a couple different subdomains on my site but I am having
> > > > >> > > > some
> > > > >> > > > problems w/ the Auth Component. I login fine under the standard
> > > www
> > > > >> > > > subdomain but then if I go to a different subdomain, then I am
> > > no
> > > > >> > > > longer logged in. How do I make sure that my Auth login 
> > > > >> > > > persists
> > > > >> > > > across all of my subdomains?
>
> > > > >> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > >> > with their CakePHP related questions.
>
> > > > >> > 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 > > > >> >  om>For more options, visit this group
> > > > >> > athttp://groups.google.com/group/cake-php?hl=en
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > > with their CakePHP related questions.
>
> > > > > 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 > > > >  om>For more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=en
>
> > > > --
> > > > Sent from my mobile device
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > 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 > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Gr

Re: Best pattern to control which data save

2010-03-09 Thread WebbedIT
The answer depends on exactly what you're doing at the time.

Within your validation rules you can specify if the rule applies on
add or edit.

Or you can alter the models validation array from with the controller
by calling unset($this->ModelName->validate['fieldName']); or
something similar.

Also, by not including the field in the data array cake will not try
to validate it.

Which one to use depends on what it is you're trying to do.

HTH

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


missing controller on redirect

2010-03-09 Thread voocake
hey,

i have this problem:

I check if if the request comes from a proxy, if it's so i add the
Services to the app base, because the proxy is www.xyz.com/services/ourservice

if (isset($_SERVER['HTTP__ID'])) {
Configure::write('App.base', '/Services/');
}

everything works smoothly, except when a controller calls a redirect
function! in this case i get an error message that the Services
Controller was not found and i should create it.

Any idead how to fix this problem? i'm really stuck here!

Thanks for your help & time.
Greetings
Mike

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best pattern to control which data save

2010-03-09 Thread marco.rizze...@gmail.com
Ok thanks
I have another question.
Is it possible to enable/disable  a validation rule from controller
code?
Namely for example in some actions I would apply the validation rule
before to call the "save" method of a Model  ,
in other action I wouldn't apply the validation rule before to call
the "save" method of a Model.
Thanks

On 9 Mar, 09:16, WebbedIT  wrote:
> A custom validation rule would do the job nicely
>
> http://book.cakephp.org/view/150/Custom-Validation-Rules
>
> Place all your logic in the model and it will be called before a save
> and return meaningful errors to the form if the data is not valid
> along with any other errors.
>
> I have a message model which does something very similar, the user
> specifies multiple recipients by a comma seperated list of usernames
> in a text field (as you would with email addresses in outlook) and my
> validation rule is as follows:
>
> function __validateRecipients($field) {
>   if(!$field['recipients']) {
>     return "This field cannot be left blank";
>   } else {
>     $recipients = explode(',', str_replace(' ', '',
> $field['recipients']));
>     foreach($recipients AS $k => $v) {
>       if(!$this->User->findByUsername($v)) {
>         $invalid[] = $v;
>       }
>     }
>     if(!empty($invalid)) {
>       return "Could not find recipient(s) ".join(', ', $invalid);
>     }
>   }
>   return true;
>
> }
>
> HTH
>
> Paul
>
> On Mar 8, 6:14 pm, "marco.rizze...@gmail.com"
>
>  wrote:
> > Hi
> > I have a question about saving data.
> > I describe my situation.
> > I have a web application where a user can send document to other
> > users.
> > Now a user can send only to certain users.
> > A user send a document through an "add" action where I do a save where
> > the data to save is :
>
> > $this->data['Send']['sender_id']
> > $this->data['Recipient'][0]['recipient_id']
> > $this->data['Recipient'][1]['recipient_id']
> > $this->data['Recipient'][2]['recipient_id']
> > .
>
> > Now I must control that the $this->data['Send']['recipient_id'] is one
> > of a user that can receive  and not another.
> > My question is what is the best pattern to do the control that the
> > $this->data['Send']['recipient_id'] is one of a user that can receive
> > and not another.
> > Do I it through validation (but I have to do a query for each 
> > $this->data['Recipient'][0]['recipient_id']) or I use another system?
>
> > Many Thanks
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best pattern to control which data save

2010-03-09 Thread WebbedIT
A custom validation rule would do the job nicely

http://book.cakephp.org/view/150/Custom-Validation-Rules

Place all your logic in the model and it will be called before a save
and return meaningful errors to the form if the data is not valid
along with any other errors.

I have a message model which does something very similar, the user
specifies multiple recipients by a comma seperated list of usernames
in a text field (as you would with email addresses in outlook) and my
validation rule is as follows:

function __validateRecipients($field) {
  if(!$field['recipients']) {
return "This field cannot be left blank";
  } else {
$recipients = explode(',', str_replace(' ', '',
$field['recipients']));
foreach($recipients AS $k => $v) {
  if(!$this->User->findByUsername($v)) {
$invalid[] = $v;
  }
}
if(!empty($invalid)) {
  return "Could not find recipient(s) ".join(', ', $invalid);
}
  }
  return true;
}



HTH

Paul

On Mar 8, 6:14 pm, "marco.rizze...@gmail.com"
 wrote:
> Hi
> I have a question about saving data.
> I describe my situation.
> I have a web application where a user can send document to other
> users.
> Now a user can send only to certain users.
> A user send a document through an "add" action where I do a save where
> the data to save is :
>
> $this->data['Send']['sender_id']
> $this->data['Recipient'][0]['recipient_id']
> $this->data['Recipient'][1]['recipient_id']
> $this->data['Recipient'][2]['recipient_id']
> .
>
> Now I must control that the $this->data['Send']['recipient_id'] is one
> of a user that can receive  and not another.
> My question is what is the best pattern to do the control that the
> $this->data['Send']['recipient_id'] is one of a user that can receive
> and not another.
> Do I it through validation (but I have to do a query for each 
> $this->data['Recipient'][0]['recipient_id']) or I use another system?
>
> Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: php in database

2010-03-09 Thread WebbedIT
Whilst Alan is right that it is indeed possible, Pablo's warnings are
well worth heeding.  It's never a good idea to allow people to type
executable PHP into a database stored template as you leave yourself
open to a whole load of issues ... I've been there, tried it and never
tried again.

Also who is going to be using this system?  It's difficult finding
clients/users that can remember a few HTML tags never mind PHP and
even harder a variant of PHP such as CakePHP!

If the people using this system have that sort of knowledge then it is
surely much easier and safer for them to work on the source of views
than to enter data into a database, that way they can use their PHP/
HTML editors/IDEs with syntax highlighting and a whole host of
shortcuts that make their coding lives easier.

Imagine chasing down unclosed elements and incorrect parenthesis in a
textarea? Not a lot of fun!

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: 1.26 Stable and Pagination

2010-03-09 Thread WebbedIT
You misunderstand the error and/or the output of your var_dump.  The
url parameter in your options array is not an array it's a variable,
signified by the fact you call it $somevar.

$options = array( 'url' => $somevar);

Try

$options = array( 'url' => array($somevar));

I personally have my pagination options in an element as I want them
to be the same across my application and at the top of that element I
include the following to automatically include any passed arguments
from the URL into the pagination links

if (!empty($this->passedArgs)) {
$paginator->options(array('url' => $this->passedArgs));
} ?>

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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