Re: find and conditions on related model

2010-03-08 Thread WebbedIT
It can't work from the Shoe model as Shoe hasMany Size so it will run
one find for Shoe and another for Size. However with your associations
you could run $this->Shoe->Size-
>find('all',array('conditions'=>array('Size.size'=>10))); and it would
pull all the data you want.

But you need to back up as the association really should be HABTM due
to the fact there are many sizes that belong to many shoes. You should
not be entering multiples of the same shoe size, you should have all
possible sizes in your sizes table and when entering a shoe you can
use Cake's automagic to create a list of checkboxes or multiple select
and store the related values in a join table.

I recommend you read the following about HABTM:

http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
http://teknoid.wordpress.com/?s=habtm

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

2010-03-08 Thread Miles J
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


protect source code & security salt ...

2010-03-08 Thread toka...@gmail.com
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: How use __consruct in model

2010-03-08 Thread nurvzy
__construct() is used in Model.php (http://api.cakephp.org/class/
model#method-Model__construct).  So either you will need to override
it correctly (calling the parent with the correct parameters) or
you'll need to review what it does and maintain that contract in your
custom __construct().

Hope that helps,
Nick

On Mar 8, 11:10 pm, 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


Re: find and conditions on related model

2010-03-08 Thread nurvzy
Need a little more information to help you. How does it not work?  Any
error messages?  What is the SQL it generates?  Maybe you have a
cached model schema? Set your debug to > 0 in core.php and try again.

Hope that helps,
Nick

On Mar 8, 8:49 am, vasion  wrote:
> hey guys!
>
> i am having trouble figuring out how i can impose search conditions in
> my model pertaining to associated models.
>
> Lets say i have a model Shoe and a model Size.
>
> Shoe(id,name,price,discount) hasMany Size(id, shoe_id, size,
> quantity).
>
> And Size belongsTo Shoe.
>
> What i want to do is this:
>  $this->Shoe->find('all',array('conditions'=>array('Size.size'=>10)));
>
> in other words i want get all the shoe models who have this size. it
> does not work! can anybody point me in the right direction?

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 use __consruct in model

2010-03-08 Thread Jets
Hi,  i am trying to use constructor in models. my code is that

 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


Re: off-Cake: generating unique ident-codes?

2010-03-08 Thread bujanga
I use UUIDs in place of Integers for many of my table IDs. Don't think
that is what Micheal is after though.

What I occasionally use is a 2 character identifier combined with an
incrementing hex number. That would result in something like TI-05A2,
then TI-05A3, etc.

Gary


On Mon, Mar 8, 2010 at 8:36 AM, mivogt-LU  wrote:
> Hi there,
>
> going on with my project I am looking for a way to generate unique
> ident-codes for some entries.
> I.e. if a customer adds a request to the system I have the internal
> index model_id for internal use.
> To have a better look and feel for customers and staff I would like to
> have something more human like a combination of numbers and letters
> (not only the id or a timestamp).
>
> Any idea how to do this?
> Sure I might use php and some random functions to generate letters and
> numbers as I need.
> My problems is to have em unique - can I use the unique function for
> validating the field in databese or the model vaidation or will I have
> to program a lookup for the database to ensure a generated code is not
> already in use.
>
> Thanks at all.
>
> Michael
>
> 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


1.26 Stable and Pagination

2010-03-08 Thread MikeK
IWe're working on an upgrade to 1.26 stable and are finding a lot of
references to issues in the pagination helper in which parameter #2 to
array_merge is not an array. var_dump shows they are indeed arrays,
and this is usually on the url parameter.

See refs to url lines 258 and 344 in the paginator helper code.

The error is flagged when using paginator helper methods where url is
set using syntax such as
$options = array( 'url' => $somevar);

Casting the refs in the paginator code to be (array) makes everything
work properly.
344 org: $url = array_merge(array('page' => $paging['page'] + ($which
== 'Prev' ? $step * -1 : $step)), $url);
344 fix: $url = array_merge(array('page' => $paging['page'] + ($which
== 'Prev' ? $step * -1 : $step)), (array)$url);

So does changing the input in the view to
$options = array(array( 'url' => $somevar));

Looking at the spec for the options in those functions it does not
appear that urls must be an array within the options array, but is
this stated elsewhere?

Just trying to get it right before hitting a bunch of pagination code
for updates. I noticed in an older release that in internal function
in the paginator helper called am() used to be used and it did some
manipulation which made our original syntax work. Should we input a PR
into the system or are all our input references actually wrong?

Other than plugging in a new cake core behind our 10,000 lines of cake
code how would we know this type of change was out there? Is there a
summary list that shows API changes and functions deprecated across
releases to ease forward migration of large code bases? Bashing
through the migration like this is quite painful :(

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-08 Thread Alan Asher
The first thing that comes to my mind is using smarty.  You can direct it to
use a database field instead of a file.  In which case, you'll have a new
set of issues to deal with which are related to passing the $html object
into the template.

Also, if you trust the code then you can do a few other things like using
the eval function 

eval($code);

or depending on your style you could write the code to a file then include
the file.

file_put_contents ('tempfile.tmp','');
include('tempfile.tmp');
?>

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of braincramp
Sent: Monday, March 08, 2010 1:49 PM
To: CakePHP
Subject: php in database

Hi, I have a CMS application and would like to include link() ?> and other such tags inside the content of pages that
are stored in the database. However, when I view the pages, the php
tags are displayed as text. Is there a way to parse PHP code from
database content in a view?

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

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: using ACL in model

2010-03-08 Thread cricket
I think that would best be left to the controller. Think of what the C
in ACL stands for.

To avoid repeating code, create a protected method _changeStatus() and
check there if the User is allowed.

On Mar 8, 3:39 pm, sawa  wrote:
> Hi,
> I was wondering if it's possible to use ACL in model instead of the
> controller.
> Let's say I have fat models and I have model method change_status.
> Now, in my controllers I may invoke $mymodel->change_status on couple
> of places and I don't want to check if user is authorized to do
> change_status everywhere. Instead of that I want to check if user is
> authorized in the model, so when I invoke that method in my
> controllers I don't have to worry about forgetting to check user
> privileges for that operation.
>
> Any ideas?

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-08 Thread Pablo Viojo
Allow php code inside the pages is a very very bad idea (from the security
point of view)

I discourage you from doing that. If you need to include links on your
content you should use an alternative markup language like markdown or html
(there are a lot of wysiwyg plugins out there)

Regards

Pablo Viojo
pvi...@gmail.com
http://pviojo.net

¿Que necesitas?
http://www.needish.com


On Mon, Mar 8, 2010 at 5:49 PM, braincramp  wrote:

> Hi, I have a CMS application and would like to include  $html->link() ?> and other such tags inside the content of pages that
> are stored in the database. However, when I view the pages, the php
> tags are displayed as text. Is there a way to parse PHP code from
> database content in a view?
>
> 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.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


php in database

2010-03-08 Thread braincramp
Hi, I have a CMS application and would like to include link() ?> and other such tags inside the content of pages that
are stored in the database. However, when I view the pages, the php
tags are displayed as text. Is there a way to parse PHP code from
database content in a view?

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

2010-03-08 Thread Kyle Decot
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.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 > 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 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: Can saveAll ignore invalid data and save all others?

2010-03-08 Thread BrendonKoz
That seems a bit redundant as saveAll cycles through all of the
records and (depending on options sent via saveAll) may check each
record for valid data. Obviously if I validated each of them first I
would disable validation during the saveAll, but it's still a
magnitude in the order of 2x.  I'm currently trying to understand how
saveAll works so that I can override it and possibly suggest an
enhancement, but its functionality is broken up in a way that would
make more sense to do a small rewrite of the code rather than simply
add an if/else or switch statement. :(  I've been staring at the
method for about a day now and still don't entirely follow it well
enough to dive in to modify it.

Perhaps I was hoping for too much!  Thanks for the response,
WebRenovator.

If anyone else has any suggestions, please let me know, I'd be more
than grateful!

On Mar 8, 1:21 am, WebRenovator  wrote:
> Hi
>
> As far as I know there's no functionality in cake to chuck out invalid
> records from saveAll. You'd probably have to cycle through the array
> one by one and discard the invalid records. Then you can use saveAll()
> once you have the final valid set.
>
> On Mar 8, 7:03 am, BrendonKoz  wrote:
>
>
>
> > To clarify - I'd like invalid records to simply be ignored (and not
> > saved), and valid records saved.
>
> > I am pulling information in from a text file, each line in the file is
> > generated from a system report. I don't want duplicates, but the
> > generated report might have them so I've set a validation up so that
> > duplicates will not be uploaded, but I'd like valid (new) reports from
> > the text file to be added without hassle.
>
> > On Mar 7, 12:02 am, BrendonKoz  wrote:
>
> > > I've tried to use saveAll with the 'validate' property set to true in
> > > hopes that the definition in the API ("true to validate each record
> > > before saving") meant that it would validate each record, and upon
> > > being valid it would save the record.
>
> > > I believe I was mistaken now that I've actually attempted it. What I
> > > don't see, however, is an option similar to what I'm looking for. Is
> > > this possible as-is, or does something need to be overridden/extended
> > > to provide for such functionality?- Hide quoted text -
>
> - Show quoted text -

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 ACL in model

2010-03-08 Thread sawa
Hi,
I was wondering if it's possible to use ACL in model instead of the
controller.
Let's say I have fat models and I have model method change_status.
Now, in my controllers I may invoke $mymodel->change_status on couple
of places and I don't want to check if user is authorized to do
change_status everywhere. Instead of that I want to check if user is
authorized in the model, so when I invoke that method in my
controllers I don't have to worry about forgetting to check user
privileges for that operation.

Any ideas?

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: Searchable behavior on two models

2010-03-08 Thread Foroct
I've looked at the array I am passing when the post gets entered and
its fine. I am saving correctly using $this->Post and the post data
saves to the post table fine.

My models look like this.

User
var $actsAs = array('Searchable' => array(
'fields' => array('username', 'first_name',
'last_name', 'location', 'email')
)
);

var $hasMany = array(
'Post' => array(
'className' => 'Post',
'foreignKey' => 'user_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => Post.created DESC',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'user_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);

Post

var $actsAs = array('Searchable');

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

var $hasMany = array(
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'post_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)

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-08 Thread Bernardo Vieira
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.comFor
> > >> >  more options, visit this group
> > >> > athttp://groups.google.com/group/cake-php?hl=en
> >
> > > 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.comFor
> > >  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 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


Re: Subdomain Auth Problem

2010-03-08 Thread Kyle Decot
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 For more options, visit this group
> >> > athttp://groups.google.com/group/cake-php?hl=en
>
> > 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 at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Sent from my mobile device

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


Exporting large amount of data from cake application

2010-03-08 Thread barduck

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.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread cricket
Did you try logging $data? Or check that you're not doing $this->User-
>save(...) instead of $this->Post->save(...)

This is how I have my models set up. You should ignore the 'fields'
array in the behavior settings. I made a bunch of modifications to it.

User:

public $hasMany = array(
'Post' => array(
'className' => 'Post',
'foreignKey' => 'user_id',
'dependent' => true
),
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'user_id',
'dependent' => true
)
);


Post:

public $hasMany = array('Comment');

public $belongsTo = array('User');

public $actsAs = array(
'Tag' => array(
'table_label' => 'tags',
'tag_label' => 'name',
'separator' => ','
),
'Searchable' => array(
'fields' => array('title', 'intro', 'body', 'tags')
),
'Sluggable' => array(
'translation' => 'utf-8',
'separator' => '_',
'label' => 'title',
'length' => 128,
'overwrite' => true
)
);


Comment:

public $belongsTo = array(
'Post',
'User'
);

public $actsAs = array(
'Tree' => array(
'parent' => 'parent_id',
'left' => 'lft',
'right' => 'rght'
),
'Searchable' => array(
'fields' => array('subject', 'body')
)
);

On Mar 8, 9:09 am, Foroct  wrote:
> I thought so after I wrote it out, but when I removed the hasOne
> association I still get the same result.  For some reason when I
> create a post, the post gets added with no problem but the seachable
> fails and kicks an error.
>
> Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
> `modified`, `created`) VALUES ('User', NULL, '', '2010-03-08
> 06:05:15', '2010-03-08 06:05:15')
>
> For some reason even though the model I am updating is the Post model
> when search_index attempts to add a record to its table the User model
> always overrides Post.  Obviously since this is not the correct model
> there is no association_key (the id of the post) so it again fails.

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


Best pattern to control which data save

2010-03-08 Thread marco.rizze...@gmail.com
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: Flame Post: Performance 1.2.6 vs 1.3.0-RC1 - Bad news.

2010-03-08 Thread mark_story
Just to chip in on the subject of benchmarking as well.  I'm not a
huge fan of apache ab.  I've run into issues with it in the past when
testing php based sites. Results like those indicating that a
framework can outperform a simple php script make me question its
truthfulness.  I find that siege gives more consistent and realistic
results.

Its great to see that people are concerned about the performance that
cake has.  Its something that I and others on the core team have spent
a fair amount of improving when working on 1.3.  I'm glad to see see
that others were able to reproduce the speed improvements I saw when,
I last ran benchmarks as well :)

-Mark

On Mar 8, 4:45 am, WebbedIT  wrote:
> > Gee! Now I am really confused... Ferrari 599 is 1.2.6 and Prius is
> > 1.3.0-RC1?
>
> Lol, not quite, I compared your test to testing the newest model of a
> Ferrari against the outgoing model but using the criteria that we
> would use to test the Toyota.  Made sense to me :)
>
> > Anyway, the whole idea of hello world benchmarks is to assess the
> > frameworks weight.
>
> But you cannot assess the weight of a framework if the test doesn't t
> stress the majority of that framework.
>
> > Even though you and I do not agree on this methodology, I do bet you
> > want too a lean framework capable to deliver as many requests/second
> > as possible.
>
> I would be very interested to look at similar benchmarking on a large
> app.  Hopefully I will be in a position to do this later in the year
> as I am currently developing a multi-subdomain sector dedicated portal
> which should get a lot of traffic in Cake 1.2.6 and once I have the
> money to hire a development team I will be asking them to port the
> site to 1.3 and compare the two.
>
> > Should you think there is a better way to assess this measure, please
> > tell me, I am glad to know of it.
>
> I don't know of a better way as I'm yet to develop or run a site where
> it's performance has been called into question.  I can tell you that a
> client of mine who moved from a large bespoke CMS I coded (before I
> started using Cake) to Drupal has had a nightmare ever since.
>
> But the two systems were never comparable and I very much doubt the
> client will pay me to replicate his existing site with Cake and
> compare the performance of the two (I'd bet a lot of money on Cake
> performing better) but even if I could do this how would I make the
> test a fair comparison?
>
> For now myself and all my clients are very happy with cake 1.2.x
> performance and from your test it seems 1.3 is better so hoorah!

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


Failed to initialize storage module: user

2010-03-08 Thread Xlander
This is a brand new install. I was just trying to access the default
index.php page and I received this:

Fatal error: session_start() [function.session-start]: Failed to initialize storage
module: user (path: C:\Temp) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\cakephp\cake\libs\cake_session.php on line
581

Thanks in advance for your help.

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


decimal validation

2010-03-08 Thread Eleazar
Hi all,
I'm not sure if it's possible or if I have to write my own regex, but
my input data fails on the decimal validation when I enter a whole
value such as 100. I would like to accept integer values but also
floats eg. 100, 100.0, 100.1, 100.2 etc. I couldn't see any way to do
this without my own regex but I thought I might have missed something.



Thanks for your time.

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 different table than the controller table when no relations?

2010-03-08 Thread Zaky Katalan-Ezra
For MySql 5.0 and above
Add approved boolean column to book table.
Create a database triggers  on book table for before insert and before
update
The user that save the data will always send approved = 0
Both triggers check for the approved value, if it's 0 the trigger will not
save the data and insert the data to admin_book
if the approve value is 1, which it should be when the admin approve the
data, the data should be save.
You also need the admin_book model for the admin to approvde data.

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 different table than the controller table when no relations?

2010-03-08 Thread Chrriss
Hi!

I'm sorry I couldn't see your answers until today!

Thank you for your answers!

I tried the solution of nurvzy which was really interesting for me but
unfortunatly it is still saving in the "book" table...

I also tried the LunarDraco solution so I just tried this:

$this->data['Book']['temp_id'] = $this->data['Book']['id'];
unset($this->data['Book']['id']);
$this->Book->save($this->data);

And it save a new record but it doesn't change the temp_id...

And I have no error messages...

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 and conditions on related model

2010-03-08 Thread vasion
hey guys!

i am having trouble figuring out how i can impose search conditions in
my model pertaining to associated models.

Lets say i have a model Shoe and a model Size.

Shoe(id,name,price,discount) hasMany Size(id, shoe_id, size,
quantity).

And Size belongsTo Shoe.

What i want to do is this:
 $this->Shoe->find('all',array('conditions'=>array('Size.size'=>10)));

in other words i want get all the shoe models who have this size. it
does not work! can anybody point me in the right direction?

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


learning Japanese?

2010-03-08 Thread takotan
Hello!  I am a Japanese who is new for cakePHP.  I am looking for a
person who want to learn Japanese and teach me CakePHP(basic level) in
return via skype.  I can get up early to set up convenient time if you
live outside Japan.

I started learning PHP which is my first programing language about 6
months ago so my skill level is still basic.  I have been learning by
myself using books.  I learned html, CSS, PHP, MySQL before I try
CakePHP even though they are basic levels.  I always thought it would
be nice to have a friend who can answer my noob questions.

I speak English fluently enough to communicate so if you can’t speak
Japanese it is ok. Moreover, I had been doing language exchange using
skype before so I think I know how to teach Japanese rather than usual
Japanese people.

If you are interested in or have any questions feel free to email me.
It is totally ok to try a skype chat first and decide if it works for
you.

takotan12345 (@) gmail.com

Personal Info.
Age:28 Male
Hobby:
Web, Reading books, Movie, Manga, Music, Mixed Martial Arts, Car, TV
Game, Soccer, Baseball.


to admin,
Please delete this if this is not appropriate post.

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


Plugin Specific images/css/js on Windows environment.

2010-03-08 Thread Maddy
I am not able to load any plugin specific images using image('/'.$this->plugin.'/img/cake.power.gif'); ?> I have all
the images in "vendors" folder under the plugins root folder. I am
using Windows/IIS. I have this setting turned on to configure cakephp
to not use mod_rewrite. Configure::write('App.baseUrl',
env('SCRIPT_NAME'));

any help would be appreciated.

Thanks,
Maddy

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 Cordoba, Argentina

2010-03-08 Thread Lucas Caro
Hi all, Triple Smart (http://www.triplesmart.com) is looking for
CakePHP programmers for freelance projects or a full/part-time jpb  in
Córdoba, Argentina.
The workplace would be our offices near ciudad universitaria, and you
should also have experience with XHTML/CSS and jQuery, and be open to
learn.

Please e-mail your portfolio and/or CV directly  to info at
triplesmart dot com if you're interested, stating availability and
hourly based salary expectations.
If you can't or don't need the job, but you know someone who could,
please let him know.

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: off-Cake: generating unique ident-codes?

2010-03-08 Thread Jon Bennett
Hi,

> going on with my project I am looking for a way to generate unique
> ident-codes for some entries.
> I.e. if a customer adds a request to the system I have the internal
> index model_id for internal use.
> To have a better look and feel for customers and staff I would like to
> have something more human like a combination of numbers and letters
> (not only the id or a timestamp).
>
> Any idea how to do this?
> Sure I might use php and some random functions to generate letters and
> numbers as I need.
> My problems is to have em unique - can I use the unique function for
> validating the field in databese or the model vaidation or will I have
> to program a lookup for the database to ensure a generated code is not
> already in use.


http://book.cakephp.org/view/573/uuid

hth

Jon


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


cakephp core customize

2010-03-08 Thread genellern
hi, i've customized some functions into tasks in cakephp's libs and
have been succesful, relationships, views, forms, helpers even
datepicker.

now that i'm trying to do is this:

creating some function like "mass", take any array containing all
tables in DB to be baked and load only once all schemas and
relationships  and save into a class var like this:

$this->allModels = $this->mass();

then a cycle to bake all but that this does not load again schema
related to the model, something like this:

foreach($this->allModelsas $model) {
// ??
$this->all_exec();
}

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


off-Cake: generating unique ident-codes?

2010-03-08 Thread mivogt-LU
Hi there,

going on with my project I am looking for a way to generate unique
ident-codes for some entries.
I.e. if a customer adds a request to the system I have the internal
index model_id for internal use.
To have a better look and feel for customers and staff I would like to
have something more human like a combination of numbers and letters
(not only the id or a timestamp).

Any idea how to do this?
Sure I might use php and some random functions to generate letters and
numbers as I need.
My problems is to have em unique - can I use the unique function for
validating the field in databese or the model vaidation or will I have
to program a lookup for the database to ensure a generated code is not
already in use.

Thanks at all.

Michael

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: Searchable behavior on two models

2010-03-08 Thread Foroct
I thought so after I wrote it out, but when I removed the hasOne
association I still get the same result.  For some reason when I
create a post, the post gets added with no problem but the seachable
fails and kicks an error.

Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
`modified`, `created`) VALUES ('User', NULL, '', '2010-03-08
06:05:15', '2010-03-08 06:05:15')

For some reason even though the model I am updating is the Post model
when search_index attempts to add a record to its table the User model
always overrides Post.  Obviously since this is not the correct model
there is no association_key (the id of the post) so it again fails.

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: Searchable behavior on two models

2010-03-08 Thread Jon Bennett
> User - hasMany Post and hasMany Comment
>
> Post - belongsTo User and hasMany Comment
>
> Comment - belongsTo User and belongsTo Post and hasOne User

Last one looks wrong to me, I'd expect:

Comment belongsTo Post, User
Post belongsTo User
Post hasMany Comment
User hasMany Comment, Post

cheers,

j


-- 
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: Searchable behavior on two models

2010-03-08 Thread Foroct
All three models have the same $actAs array var $actsAs =
array('Searchable');

Each model saves its data properly using if ($this->Model->save($this-
>data)) {

Where it falls apart is after the model data save and prior to the
search_index save.

I have tracked the issue down to something in my model.  I think I am
not setting up my associations correctly particularly in my Comment
model.

User - hasMany Post and hasMany Comment

Post - belongsTo User and hasMany Comment

Comment - belongsTo User and belongsTo Post and hasOne User

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


Next Cakefest?

2010-03-08 Thread drpark
Hi all,
do you have an idea for the next cakefest's dates?


Hard to get approved for a business travel if we can't book 3 months
before the event.( we have to plan current project)

Thanks for answers,
Regards,
Jeremy

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-08 Thread Bernardo Vieira
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.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
>
> 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
>

-- 
Sent from my mobile device

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: Using hasMany from app to plugin

2010-03-08 Thread nurvzy
You're correct,  I did end up defining the relationship within the
plugin and that does indeed make it less app-agnostic.   It's a
balancing act, ideally you want your plugin to be completely self
reliant, but if that's not the goal of your app you need to decide how
much is too much?  My InstantMessenger assumes there is a User model
because I think that's a fair requirement and assumption for a my
plugin to make, a plugin that specialize is getting to two User's to
talk to one another.  But if you're getting to the point in your
plugin that it really needs to have intimate relationships with your
app models its probably time to stop trying to make it a plugin and
just make the functionality part of your app.

Just my opinion,
Nick

On Mar 7, 11:43 am, "iamcam (Cameron Perry)" 
wrote:
> Nick,
>
> Correct me if I'm wrong... You ended up creating the association
> inside the chat plugin anyway - like any other model-to-model
> relationship? I wonder if I'm being too strict in trying to keep the
> plugin too app-agnostic. And the truth is, in the current app I have,
> there are other app-specific hasMany gallery that the plugin should
> never know about so it remains portable. How do you see that changing
> the relationship? I was considering trying the hasMany :through
> relationship that a couple Cake bloggers have talked about (appears
> similar to HABTM, but not). That could possibly solve the issue
> besides just creating the Gallery install requirement to add the
> appropriate model relationships back to the app - just cuts down on
> the portability.
>
> Thanks!
> Cameron
>
> On Mar 6, 5:58 pm, nurvzy  wrote:
>
> > This is how I do it in my InstantMessenger plugin which relates to the
> > User model of the App.
>
> > //plugins/instant_messenger/models/im_chat.php
> > var $belongsTo = array(
> >     'ImSession' => array(
> >       'className' => 'InstantMessenger.ImSession',
> >       'dependant' => true
> >     ),
> >     'User' => array(
> >       'className' => 'User'
> >     )
> >   );
>
> > //app/models/user.php
> > var $hasMany = array(
> >   'Chat' => array(
> >     'className' => 'InstantMessenger.ImChat',
> >   )
> > );
>
> > Now I have an alias model of Chat for my User model that relates to
> > the plugin/model/im_chat.
>
> > Hope that helps,
> > Nick
> > On Mar 6, 9:50 am, "iamcam (Cameron Perry)" 
> > wrote:> This might be elementary for some, but I haven't quite wrapped my 
> > head
> > > around how I can build a hasMany relationship from my app model to a
> > > model in a plugin (one I'm also writing).
>
> > > The basic gist looks something like this:
>
> > > /** App's User Model **/
> > > class User extends AppModel {
> > >         var $name = 'User';
> > >         var $hasMany = array('Gallery.Gallery'); // you get the point
>
> > > }
>
> > > /** Gallery Plugin's Gallery Model **/
> > > class Gallery extends GalleryAppModel {
> > >         var $name = 'Gallery';
> > >         var $belongsTo = array( ... ); //other plugin models
>
> > > }
>
> > > /*/
>
> > > So what I want to do is basically get a list of all the galleries
> > > associated with a user. I know how to do that if the gallery is built
> > > in to the app, but since I'm trying to make it modular I'm a little
> > > stumped. PS: There are other app models that will also have a hasMany
> > > relationship to gallery, so I want to do the right thing.
>
> > > I'm in the mindset that plugins aren't meant to be messed with (too
> > > much) to integrate them into your app, so it doesn't seem like a good
> > > idea to me to start adding foreign key fields in the gallery model
> > > (like user_id or tag_id).  I considered creating a HABTM on my app
> > > side so I at least have a join table where I can match the two sets of
> > > foreign keys. Am I wrong about either of these?
>
> > > So the big question - How do I do this? Does anyone else figured this
> > > out before?
>
> > > Thanks so much in advance! This community has been very good to me in
> > > the past.
>
> > > ~Cameron

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: Show username and logout link when user is logged

2010-03-08 Thread amarradi
Yes,

thans a lot, thats what i'm looking for

On 7 Mrz., 17:40, cricket  wrote:
> if ($session->read('Auth.User')) {
>
> And to get the username use $session->read('Auth.User.username')
>
> (or whatever the field is)
>
> On Mar 6, 11:19 am, amarradi  wrote:
>
> > Hello together,
>
> > i tryed this tutorial 
> > (http://komunitasweb.com/2009/03/cakephp-acl-tutorial-what-and-how/
> > ) as an example. But now i want to show the username and the logout
> > link if the user is logged. how do i this?
>
> > How can i show the username and the link on the ctp files?
>
> > Many greetings, nice weekend
>
> > marcus radisch

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: Flame Post: Performance 1.2.6 vs 1.3.0-RC1 - Bad news.

2010-03-08 Thread WebbedIT
> Gee! Now I am really confused... Ferrari 599 is 1.2.6 and Prius is
> 1.3.0-RC1?

Lol, not quite, I compared your test to testing the newest model of a
Ferrari against the outgoing model but using the criteria that we
would use to test the Toyota.  Made sense to me :)

> Anyway, the whole idea of hello world benchmarks is to assess the
> frameworks weight.

But you cannot assess the weight of a framework if the test doesn't t
stress the majority of that framework.

> Even though you and I do not agree on this methodology, I do bet you
> want too a lean framework capable to deliver as many requests/second
> as possible.

I would be very interested to look at similar benchmarking on a large
app.  Hopefully I will be in a position to do this later in the year
as I am currently developing a multi-subdomain sector dedicated portal
which should get a lot of traffic in Cake 1.2.6 and once I have the
money to hire a development team I will be asking them to port the
site to 1.3 and compare the two.

> Should you think there is a better way to assess this measure, please
> tell me, I am glad to know of it.

I don't know of a better way as I'm yet to develop or run a site where
it's performance has been called into question.  I can tell you that a
client of mine who moved from a large bespoke CMS I coded (before I
started using Cake) to Drupal has had a nightmare ever since.

But the two systems were never comparable and I very much doubt the
client will pay me to replicate his existing site with Cake and
compare the performance of the two (I'd bet a lot of money on Cake
performing better) but even if I could do this how would I make the
test a fair comparison?

For now myself and all my clients are very happy with cake 1.2.x
performance and from your test it seems 1.3 is better so hoorah!

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: Flame Post: Performance 1.2.6 vs 1.3.0-RC1 - Bad news.

2010-03-08 Thread Walther
I think that the time to develop is much more important then the
requests per second performance. Simply because hardware is magnitudes
cheaper then development time.

On Mar 7, 5:20 pm, Dérico Filho  wrote:
> Gee! Now I am really confused... Ferrari 599 is 1.2.6 and Prius is
> 1.3.0-RC1?
>
> Anyway, the whole idea of hello world benchmarks is to assess the
> frameworks weight. That's all. I am not here trying to figure out if
> 1.2.6 is better or worse then 1.3.0-RC1.
>
> Even though you and I do not agree on this methodology, I do bet you
> want too a lean framework capable to deliver as many requests/second
> as possible.
>
> Should you think there is a better way to assess this measure, please
> tell me, I am glad to know of it.
>
> On Mar 6, 4:27 am, WebbedIT  wrote:
>
> > @Derico
>
> > > I think you're missing the point here. I am not trying to assess the
> > > supposed advantage in using CakePHP.
>
> > > I am trying to assess its weight. Whatever the application you
> > > develop, when you choose using a framework you MUST understand how it
> > > is going to affect the overall performance.
>
> > No, I still believe it is you who is missing the point here.
>
> > You don't road test a Ferrari 599 and a Toyota Prius against the same
> > set of criteria. Whilst they are both cars and can ferry a person from
> > A to B, that's where the similarities end as they are totally
> > different machines designed to achieve different things.
>
> > What you are doing is comparable to testing an updated version of the
> > Ferrari 599 against the outgoing model using the criteria set for the
> > Toyota Prius.  It's just wrong!
>
> > To put a framework through it's paces you have to test the framework
> > itself, all your testing is the frameworks ability to extract it's
> > config options and read a few .htaccess rules ... how does that
> > provide any significant results?
>
> > However, I do agree with your assessment of Robert!
>
> > @Walther:
>
> > > and to throw a spanner into the works a simple php file with only echo
> > >'Hello world' in gets 3604 requests per second
>
> > >I therefor conclude that CakePHP is faster then no framework at
> > >all
>
> > ROFL, excellent conclusion  .. does that not prove benchmarking "hello
> > world" is pointless?!?

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: Do I need Ajax?

2010-03-08 Thread WebbedIT
Interesting alternative :)

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: city list

2010-03-08 Thread WebbedIT
Sam is right in that you should be running $this->City->find('list');

That will automatically pull the id and name columns from your cities
table, if you do not have a name column then you need to supply a
fields array to tell it which alternative field to use for name.

http://book.cakephp.org/view/810/find-list

Sam is also right that the plural of City is cities, and as such make
sure your controller is called cities_controller.php and your table
cities.

I'm assuming you're then saving the city_id into another table, if so
and you want to use Cake's automagic to add a select list to the form
then the variable you send to the form view needs to be called $cities
and the form input would be called by simply adding

$form->input('ModelName.city_id');

The form helper will automatically look for the existance of a $cities
array and use that to build the options list checking for the current
calue of city_id and selecting the right option in the list if one has
already been selected.

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

2010-03-08 Thread WebbedIT
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