Array Format for Multiple Inserts

2014-06-24 Thread Christopher Wilson
I have a series of Form elements(select) that I create dynamically w/ JS, 
and I have JS that will change the name so that they will create an array. 

I can create either *Module.column_id.0* or *Module.0.column_id* and 
increment the number, but I can't get the multiple elements to write to the 
database.

Can someone point me in the write direction? I can't find about dynamic 
inputs in the book


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Writing array from dynamically generated Select boxes to database.

2014-06-24 Thread Christopher Wilson
I don't quite know what this is called, so I'm having trouble finding a 
working example. This is what I want:

   1. A select/pulldown menu that pulls data from the database.
   2. An "add" button that creates a new menu that is a clone of the 
   original
   3. For this to write to the database. So if I have the 3 selects, I get 
   3 new rows in the table.

Here is what I have:

   1. A select/pulldown menu that pulls data from the database.
   2. An "add" button that creates a new menu that is a clone of the 
   original
   3. JS script that will change the name so that it will create nested 
   arrays of the selections.
   4. The ability to write one pulldown, but only one.
   5. Cake 2.something.

Is what I want possible with Cake? I know it is possible with straight PHP, 
I've done it before. However, I can't get cake to write multiple values to 
the database. I have no idea where to even begin with this. There's nothing 
in the book, and I can't find someone who has done something similar.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 3.0.0 development preview 2 released

2014-03-14 Thread Christopher Castro
yes yes, I know, it will autoload AriclesTable for ArticlesController.
This just work when having 1:1 relation between Controller and Model.

But I have some complex applications where Controller uses more than 1
model (unrelated each other)... so I like to declare Controller::$uses and
load all of them at the begining with a single line.
An example: StatisticsController. There is no StatisticsTable nor
StatisticEntity, it uses a bunch of models to do some statistical stuff,
and it may create relations between models on the fly to do its job.
So now, in 3.0,  I'll have to loadModel() each model on controller's
contructor or beforeFilter callback
Not a big deal, I can live without $uses

Regards



2014-03-14 13:20 GMT+01:00 Stephen S :

> I think the only time I have implemented $uses is when I've built a shell
> which directly deals with one model throughout...
>
>
> On 14 March 2014 12:13, Christopher Castro  wrote:
>
>> I see.
>> No really, no particular reason.
>> I just like the model autoloading feature in 2.x. I'm a bit lazy and
>> don't like to manually loadModel()... heheh
>>
>> Regards
>>
>>
>> 2014-03-13 23:45 GMT+01:00 José Lorenzo :
>>
>> $uses was not actually offering much. Is there a particular reason you
>>> wanted to keep it?
>>>
>>>
>>> On Thursday, March 13, 2014 9:51:14 PM UTC+1, Christopher Castro wrote:
>>>
>>>> Yes I know... nothing new, similar to old versions of cake.
>>>>
>>>> Is there any reason about removing Controller::$uses ?
>>>> because I dont see the point. Moreover, app-template
>>>> (PagesController::$uses) and 3.0-book still mention it.
>>>>
>>>>
>>>> 2014-03-13 21:33 GMT+01:00 Thomas von Hassel :
>>>>
>>>>> No, a PostsController will try to load a table class called PostsTable
>>>>> automagically
>>>>>
>>>>> /thomas
>>>>>
>>>>>
>>>>>
>>>>> On 13 Mar 2014, at 21:29, Christopher Castro 
>>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm taking a look to the new ORM, and I've noticed there is no longer
>>>>> Controller::$uses.
>>>>> we have to use loadModel() instead? No more model autoloading?  :(
>>>>>
>>>>> Great work btw
>>>>>
>>>>>
>>>>> 2014-03-13 16:11 GMT+01:00 José Lorenzo :
>>>>>
>>>>>> Sorry, I made a mistake in my previous paste, This is a new version
>>>>>> http://bin.cakephp.org/saved/120567
>>>>>>
>>>>>> There was another thread with the same topic here in the group, you
>>>>>> may want to check it to know how it is supposed to work if you create 
>>>>>> your
>>>>>> Entity class.
>>>>>>
>>>>>>
>>>>>> On Thursday, March 13, 2014 4:09:36 PM UTC+1, José Lorenzo wrote:
>>>>>>>
>>>>>>> Yeah, you need an entity class or do the following:
>>>>>>>
>>>>>>> http://bin.cakephp.org/saved/120566
>>>>>>>
>>>>>>>  Check the modified lines in the add() method. This is just a
>>>>>>> workaround if you don't want a custom entity. We hope to make this 
>>>>>>> easier
>>>>>>> and more clear in the future.
>>>>>>>
>>>>>>> On Thursday, March 13, 2014 4:03:08 PM UTC+1, André Luis wrote:
>>>>>>>>
>>>>>>>> My Controller: http://bin.cakephp.org/saved/120565
>>>>>>>> I didnt create any entity yet, but the index and view are working
>>>>>>>> very well.
>>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>>>>> Find us on Twitter http://twitter.com/CakePHP
>>>>>>
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "CakePHP" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to cake-php+u...@googlegroups.com.
>>>>>> To post to this group, send email to cake...@googlegroups.com.
>>>>>>
>>>>>> Visit 

Re: CakePHP 3.0.0 development preview 2 released

2014-03-14 Thread Christopher Castro
I see.
No really, no particular reason.
I just like the model autoloading feature in 2.x. I'm a bit lazy and don't
like to manually loadModel()... heheh

Regards


2014-03-13 23:45 GMT+01:00 José Lorenzo :

> $uses was not actually offering much. Is there a particular reason you
> wanted to keep it?
>
>
> On Thursday, March 13, 2014 9:51:14 PM UTC+1, Christopher Castro wrote:
>
>> Yes I know... nothing new, similar to old versions of cake.
>>
>> Is there any reason about removing Controller::$uses ?
>> because I dont see the point. Moreover, app-template
>> (PagesController::$uses) and 3.0-book still mention it.
>>
>>
>> 2014-03-13 21:33 GMT+01:00 Thomas von Hassel :
>>
>>> No, a PostsController will try to load a table class called PostsTable
>>> automagically
>>>
>>> /thomas
>>>
>>>
>>>
>>> On 13 Mar 2014, at 21:29, Christopher Castro  wrote:
>>>
>>> Hi,
>>>
>>> I'm taking a look to the new ORM, and I've noticed there is no longer
>>> Controller::$uses.
>>> we have to use loadModel() instead? No more model autoloading?  :(
>>>
>>> Great work btw
>>>
>>>
>>> 2014-03-13 16:11 GMT+01:00 José Lorenzo :
>>>
>>>> Sorry, I made a mistake in my previous paste, This is a new version
>>>> http://bin.cakephp.org/saved/120567
>>>>
>>>> There was another thread with the same topic here in the group, you may
>>>> want to check it to know how it is supposed to work if you create your
>>>> Entity class.
>>>>
>>>>
>>>> On Thursday, March 13, 2014 4:09:36 PM UTC+1, José Lorenzo wrote:
>>>>>
>>>>> Yeah, you need an entity class or do the following:
>>>>>
>>>>> http://bin.cakephp.org/saved/120566
>>>>>
>>>>> Check the modified lines in the add() method. This is just a
>>>>> workaround if you don't want a custom entity. We hope to make this easier
>>>>> and more clear in the future.
>>>>>
>>>>> On Thursday, March 13, 2014 4:03:08 PM UTC+1, André Luis wrote:
>>>>>>
>>>>>> My Controller: http://bin.cakephp.org/saved/120565
>>>>>> I didnt create any entity yet, but the index and view are working
>>>>>> very well.
>>>>>>
>>>>>
>>>> --
>>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>>> Find us on Twitter http://twitter.com/CakePHP
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "CakePHP" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to cake-php+u...@googlegroups.com.
>>>> To post to this group, send email to cake...@googlegroups.com.
>>>>
>>>> Visit this group at http://groups.google.com/group/cake-php.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Christopher Castro.
>>> Analista Programador Senior PHP/MySQL
>>> Pamplona, España
>>> QuickApps CMS <http://www.quickappscms.org/>
>>>
>>>
>>> --
>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to cake-php+u...@googlegroups.com.
>>> To post to this group, send email to cake...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/cake-php.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>  --
>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to cake-php+u...@googlegroups.com.
>>> To post to this group, send email to cake...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/cake-php.
&g

Re: CakePHP 3.0.0 development preview 2 released

2014-03-13 Thread Christopher Castro
Yes I know... nothing new, similar to old versions of cake.

Is there any reason about removing Controller::$uses ?
because I dont see the point. Moreover, app-template
(PagesController::$uses) and 3.0-book still mention it.


2014-03-13 21:33 GMT+01:00 Thomas von Hassel :

> No, a PostsController will try to load a table class called PostsTable
> automagically
>
> /thomas
>
>
>
> On 13 Mar 2014, at 21:29, Christopher Castro  wrote:
>
> Hi,
>
> I'm taking a look to the new ORM, and I've noticed there is no longer
> Controller::$uses.
> we have to use loadModel() instead? No more model autoloading?  :(
>
> Great work btw
>
>
> 2014-03-13 16:11 GMT+01:00 José Lorenzo :
>
>> Sorry, I made a mistake in my previous paste, This is a new version
>> http://bin.cakephp.org/saved/120567
>>
>> There was another thread with the same topic here in the group, you may
>> want to check it to know how it is supposed to work if you create your
>> Entity class.
>>
>>
>> On Thursday, March 13, 2014 4:09:36 PM UTC+1, José Lorenzo wrote:
>>>
>>> Yeah, you need an entity class or do the following:
>>>
>>> http://bin.cakephp.org/saved/120566
>>>
>>> Check the modified lines in the add() method. This is just a workaround
>>> if you don't want a custom entity. We hope to make this easier and more
>>> clear in the future.
>>>
>>> On Thursday, March 13, 2014 4:03:08 PM UTC+1, André Luis wrote:
>>>>
>>>> My Controller: http://bin.cakephp.org/saved/120565
>>>> I didnt create any entity yet, but the index and view are working very
>>>> well.
>>>>
>>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to cake-php+unsubscr...@googlegroups.com.
>> To post to this group, send email to cake-php@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Christopher Castro.
> Analista Programador Senior PHP/MySQL
> Pamplona, España
> QuickApps CMS <http://www.quickappscms.org/>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps CMS <http://www.quickappscms.org>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 3.0.0 development preview 2 released

2014-03-13 Thread Christopher Castro
Hi,

I'm taking a look to the new ORM, and I've noticed there is no longer
Controller::$uses.
we have to use loadModel() instead? No more model autoloading?  :(

Great work btw


2014-03-13 16:11 GMT+01:00 José Lorenzo :

> Sorry, I made a mistake in my previous paste, This is a new version
> http://bin.cakephp.org/saved/120567
>
> There was another thread with the same topic here in the group, you may
> want to check it to know how it is supposed to work if you create your
> Entity class.
>
>
> On Thursday, March 13, 2014 4:09:36 PM UTC+1, José Lorenzo wrote:
>>
>> Yeah, you need an entity class or do the following:
>>
>> http://bin.cakephp.org/saved/120566
>>
>> Check the modified lines in the add() method. This is just a workaround
>> if you don't want a custom entity. We hope to make this easier and more
>> clear in the future.
>>
>> On Thursday, March 13, 2014 4:03:08 PM UTC+1, André Luis wrote:
>>>
>>> My Controller: http://bin.cakephp.org/saved/120565
>>> I didnt create any entity yet, but the index and view are working very
>>> well.
>>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps CMS <http://www.quickappscms.org>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Custom fields in plugins

2013-09-11 Thread Christopher Castro
I think *CCK Fields* concept is the best approach,
Google it, take a look to Drupal or to my QuickApps CMS


2013/9/11 gersonfs 

> Hello everybody!
>
> I have several plugins in my central repository that I developed. Are
> plugins to ease repetitive tasks as system news, product registration, etc..
>
> I have dozens of sites that use these plugins.
>
> However, each client has a different need. These needs are reflected in
> additional fields in the database tables of plugins. But many times, a
> particular field would only be useful for one client, and not for others.
>
> Do not think it's interesting that the tables of plugins has dozens of
> unnecessary fields.
>
> So what would be the best way to add or remove fields from a particular
> plugin, especially for a customer without breaking compatibility and is
> easy to upgrade in the future??
>
> Ideally, it would add and remove fields to a particular plugin database
> table, without having to change the plugin code. However, when i upgrade
> this plugin in particular customer, have to know that it has custom fields.
>
> Any idea?
>
> Sorry my English.
>
> Thanks!
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
quickappscms.org
https://github.com/QuickAppsCMS/QuickApps-CMS

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Custom fields in plugins

2013-09-11 Thread Christopher Castro
I think CCK Fields concept is the best approach,
Google it, take a look to Drupal or my QuickApps CMS


2013/9/11 gersonfs 

> Hello everybody!
>
> I have several plugins in my central repository that I developed. Are
> plugins to ease repetitive tasks as system news, product registration, etc..
>
> I have dozens of sites that use these plugins.
>
> However, each client has a different need. These needs are reflected in
> additional fields in the database tables of plugins. But many times, a
> particular field would only be useful for one client, and not for others.
>
> Do not think it's interesting that the tables of plugins has dozens of
> unnecessary fields.
>
> So what would be the best way to add or remove fields from a particular
> plugin, especially for a customer without breaking compatibility and is
> easy to upgrade in the future??
>
> Ideally, it would add and remove fields to a particular plugin database
> table, without having to change the plugin code. However, when i upgrade
> this plugin in particular customer, have to know that it has custom fields.
>
> Any idea?
>
> Sorry my English.
>
> Thanks!
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps.es <http://www.quickapps.es><https://github.com/y2k2000/QuickApps>
https://github.com/QuickAppsCMS/QuickApps-CMS

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Elfinder 2.x integration with cakephp 2.x ?

2012-08-11 Thread Christopher Castro
elFinder v2.0 based module for QuickApps CMS:
https://github.com/QuickAppsCMS/QACMS-Mediamanager

2012/8/11 Piotr Beschel 

> https://github.com/TamiasSibiricus/CakePHP-ElRte-Plugin
>
> W dniu sobota, 11 sierpnia 2012 16:52:13 UTC+2 użytkownik MetZ napisał:
>
>> So.. After some messing around,, I figured out how to do it using the old
>> 1.x conncetors (probably not the best pratice, but it works).
>> If anyone want to know how I did it => http://whatswhat.no/**
>> development/framework/cakephp-**2/475-how-to-setup-and-use-**
>> elfinder-2-0-as-your-**filemanager-in-cakephp-2-x<http://whatswhat.no/development/framework/cakephp-2/475-how-to-setup-and-use-elfinder-2-0-as-your-filemanager-in-cakephp-2-x>
>>
>> Also, If anyone have some imporvements to add, let me know..
>>
>> Thanks anyway!
>>
>> -Tom
>>
>> kl. 02:07:21 UTC+2 lørdag 11. august 2012 skrev MetZ følgende:
>>>
>>> Hi all..
>>>
>>> I have been using the old Elfinder as my filemanager in my admin panel
>>> (the v.1.somthing).
>>>
>>> Now, I am trying to implement the new Elfinder 2 to my admin panel, and
>>> are experiencing some trouble.
>>>
>>> mainly, I can not seem to get the connector going. I have created an
>>> helper to load all JS to view, and tried to load the connector in my
>>> controller.
>>>
>>> Any suggestions? Or perhaps you have this working on your projects?
>>>
>>> What is the best approach here? I am not to experienced with components
>>> and such..
>>>
>>> Thanks for any help on this..
>>>
>>> Regards!
>>> -Tom
>>>
>>  --
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
quickappscms.org
https://github.com/QuickAppsCMS/QuickApps-CMS

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Fat CakePHP

2012-08-08 Thread Christopher Castro
Yes, and I agree with you. And of course hosting space is not an issue.
What I was trying to say is: Bandwidth !== HDD space. And that may be an
issue.

Let's say that an ordinary person has an upload bandwidth of 2Mbps (Just
and ordinary *a*dsl line 50d/2u). That may take up to 6 minutes when
uploading a full cake lib to production FTP, that means wait 6 minutes to
see if the uploaded thing works.

Yes I know..."who cares...just 6 mins". Well, the thing is that I really
hate waste my time on things like that. I prefer to wait 1 minute or less
uploading a 2mb package.
But whatever. Some people like to make coffee in the meanwhile, and some
others just doesn't.

Well this is my last comment on this...We are getting out of subject dont
you think?

---

Regards!
Chris

2012/8/8 John Hardy 

> Wow, size is a non-issue. You can lease a server instance from rackspace
> with 10GB of disk for 15 dollars a month.
> Tell your clients to forgo their lattes for 3 days or bum change in front
> of their office.
>
> Do you put plastic covers over your floor mats?
>
>
> On Aug 8, 2012, at 12:43 PM, Christopher Castro  wrote:
>
> 1- But you're uploading the libs just one time.
> No that's no true. Only true if all your clients/projects are hosted in a
> server managed by yourself.
>
> 2- If you have a crappy DSL line just go make some coffee
> No, my line is not crappy, it's just an *A*DSL line, probably the same
> you use at home. Also I dont like coffe.
>
> 3- Hosting package that dings you for a single upload of ~10MB then you
> need to find a new provider.
> Similar to 1. But, I can ride my unicorn and go tell to all my clients
> that they must pay a better provider.
>
> ---
>
> Regards!
> Chris
>
> 2012/8/8 lowpass 
>
>> But you're uploading the libs just one time. If you have a crappy DSL
>> line just go make some coffee. As for bandwidth, if you have a hosting
>> package that dings you for a single upload of ~10MB then you need to find a
>> new provider.
>>
>>
>> On Wed, Aug 8, 2012 at 8:29 AM, Christopher Castro wrote:
>>
>>> Yeah sure, in a perfect world  where unicorns live and clouds are made
>>> of sugar... ¬¬
>>> Bandwidth is not unlimited or free.
>>> And your common-asymmetric-adsl line can beat your patient, time and
>>> money when uploading up to 15Mb to your common-shared-hosting.
>>>
>>> ---
>>>
>>> I always remove "Cake/Tests|TestSuite/*" and "Cake/Console" from all my
>>> production projects to reduces all those inconveniences. With this you can
>>> get a 2Mb package (uncompressed)
>>>
>>> ---
>>>
>>> Regards,
>>> Chris
>>>
>>>
>>> 2012/8/8 euromark 
>>>
>>>> seriously? if you have trouble accepting the fact that webspace is
>>>> literally free nowadways (>>>>> 1000 GB), and that the app itself and its
>>>> assets (images) will usually cake up 5 times more space in the long
>>>> run, you really got your facts wrong.
>>>> what exactly is the problem with 5-10 MB? Even if the folder would be
>>>> 10 times the size - who cares?
>>>>
>>>>
>>>> Am Mittwoch, 8. August 2012 09:14:01 UTC+2 schrieb WyriHaximus:
>>>>>
>>>>> Deleting test is my thought exactly if you really want to cut down the
>>>>> file size. But I would be more interested why the size is a problem in the
>>>>> first place?
>>>>>
>>>>> On Wed, Aug 8, 2012 at 8:46 AM, Sergei  wrote:
>>>>>
>>>>>> Well you can delete Test (5 Mb) folder for sure.
>>>>>>
>>>>>> --
>>>>>> Sergei
>>>>>>
>>>>>>
>>>>>> On Tuesday, August 7, 2012 9:20:07 PM UTC+9, sanjeev wrote:
>>>>>>>
>>>>>>> Hello Everybody,
>>>>>>>
>>>>>>> I have developed CMS in CakePHP but Size of CakePHP installation is
>>>>>>> too high. Any idea how to stripped-down CakePHP installation (in terms 
>>>>>>> of
>>>>>>> file size)?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "CakePHP" group.
>>>>>> To post to this group, send email to cake...@googlegroups.com.
>>>>>

Re: Fat CakePHP

2012-08-08 Thread Christopher Castro
1- But you're uploading the libs just one time.
No that's no true. Only true if all your clients/projects are hosted in a
server managed by yourself.

2- If you have a crappy DSL line just go make some coffee
No, my line is not crappy, it's just an *A*DSL line, probably the same you
use at home. Also I dont like coffe.

3- Hosting package that dings you for a single upload of ~10MB then you
need to find a new provider.
Similar to 1. But, I can ride my unicorn and go tell to all my clients that
they must pay a better provider.

---

Regards!
Chris

2012/8/8 lowpass 

> But you're uploading the libs just one time. If you have a crappy DSL line
> just go make some coffee. As for bandwidth, if you have a hosting package
> that dings you for a single upload of ~10MB then you need to find a new
> provider.
>
>
> On Wed, Aug 8, 2012 at 8:29 AM, Christopher Castro wrote:
>
>> Yeah sure, in a perfect world  where unicorns live and clouds are made of
>> sugar... ¬¬
>> Bandwidth is not unlimited or free.
>> And your common-asymmetric-adsl line can beat your patient, time and
>> money when uploading up to 15Mb to your common-shared-hosting.
>>
>> ---
>>
>> I always remove "Cake/Tests|TestSuite/*" and "Cake/Console" from all my
>> production projects to reduces all those inconveniences. With this you can
>> get a 2Mb package (uncompressed)
>>
>> ---
>>
>> Regards,
>> Chris
>>
>>
>> 2012/8/8 euromark 
>>
>>> seriously? if you have trouble accepting the fact that webspace is
>>> literally free nowadways (>>>>> 1000 GB), and that the app itself and its
>>> assets (images) will usually cake up 5 times more space in the long
>>> run, you really got your facts wrong.
>>> what exactly is the problem with 5-10 MB? Even if the folder would be 10
>>> times the size - who cares?
>>>
>>>
>>> Am Mittwoch, 8. August 2012 09:14:01 UTC+2 schrieb WyriHaximus:
>>>>
>>>> Deleting test is my thought exactly if you really want to cut down the
>>>> file size. But I would be more interested why the size is a problem in the
>>>> first place?
>>>>
>>>> On Wed, Aug 8, 2012 at 8:46 AM, Sergei  wrote:
>>>>
>>>>> Well you can delete Test (5 Mb) folder for sure.
>>>>>
>>>>> --
>>>>> Sergei
>>>>>
>>>>>
>>>>> On Tuesday, August 7, 2012 9:20:07 PM UTC+9, sanjeev wrote:
>>>>>>
>>>>>> Hello Everybody,
>>>>>>
>>>>>> I have developed CMS in CakePHP but Size of CakePHP installation is
>>>>>> too high. Any idea how to stripped-down CakePHP installation (in terms of
>>>>>> file size)?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "CakePHP" group.
>>>>> To post to this group, send email to cake...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to cake-php+u...@**
>>>>> googlegroups.com.
>>>>> Visit this group at 
>>>>> http://groups.google.com/**group/cake-php?hl=en-US<http://groups.google.com/group/cake-php?hl=en-US>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> <http://wyrihaximus.net/>
>>>> Website<http://wyrihaximus.net/?utm_source=signature&utm_medium=email&utm_campaign=emailsignature>
>>>>  | 
>>>> Blog<http://blog.wyrihaximus.net/?utm_source=signature&utm_medium=email&utm_campaign=emailsignature>
>>>>  | Linkedin <http://nl.linkedin.com/in/ceesjankiewiet> | 
>>>> Tw**itter<http://twitter.com/wyrihaximus> |
>>>> Facebook <http://www.facebook.com/CeesJan.Kiewiet>
>>>>
>>>  --
>>> 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.
>>> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Christopher Castro.
>> Analista Programador Senior PHP/MySQL
>> P

Re: Fat CakePHP

2012-08-08 Thread Christopher Castro
Yeah sure, in a perfect world  where unicorns live and clouds are made of
sugar... ¬¬
Bandwidth is not unlimited or free.
And your common-asymmetric-adsl line can beat your patient, time and money
when uploading up to 15Mb to your common-shared-hosting.

---

I always remove "Cake/Tests|TestSuite/*" and "Cake/Console" from all my
production projects to reduces all those inconveniences. With this you can
get a 2Mb package (uncompressed)

---

Regards,
Chris

2012/8/8 euromark 

> seriously? if you have trouble accepting the fact that webspace is
> literally free nowadways (>>>>> 1000 GB), and that the app itself and its
> assets (images) will usually cake up 5 times more space in the long
> run, you really got your facts wrong.
> what exactly is the problem with 5-10 MB? Even if the folder would be 10
> times the size - who cares?
>
>
> Am Mittwoch, 8. August 2012 09:14:01 UTC+2 schrieb WyriHaximus:
>>
>> Deleting test is my thought exactly if you really want to cut down the
>> file size. But I would be more interested why the size is a problem in the
>> first place?
>>
>> On Wed, Aug 8, 2012 at 8:46 AM, Sergei  wrote:
>>
>>> Well you can delete Test (5 Mb) folder for sure.
>>>
>>> --
>>> Sergei
>>>
>>>
>>> On Tuesday, August 7, 2012 9:20:07 PM UTC+9, sanjeev wrote:
>>>>
>>>> Hello Everybody,
>>>>
>>>> I have developed CMS in CakePHP but Size of CakePHP installation is too
>>>> high. Any idea how to stripped-down CakePHP installation (in terms of file
>>>> size)?
>>>>
>>>> Regards,
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To post to this group, send email to cake...@googlegroups.com.
>>> To unsubscribe from this group, send email to cake-php+u...@**
>>> googlegroups.com.
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en-US<http://groups.google.com/group/cake-php?hl=en-US>
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> <http://wyrihaximus.net/>
>> Website<http://wyrihaximus.net/?utm_source=signature&utm_medium=email&utm_campaign=emailsignature>
>>  | 
>> Blog<http://blog.wyrihaximus.net/?utm_source=signature&utm_medium=email&utm_campaign=emailsignature>
>>  | Linkedin <http://nl.linkedin.com/in/ceesjankiewiet> | 
>> Tw**itter<http://twitter.com/wyrihaximus> |
>> Facebook <http://www.facebook.com/CeesJan.Kiewiet>
>>
>  --
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
quickappscms.org
https://github.com/QuickAppsCMS/QuickApps-CMS

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Can CakePHP code be obfuscated for protection?

2012-08-07 Thread Christopher Castro
For some of my Cake projects I use a "paid" software that work pretty well:
"SourceCop".
The problem: There is an online decoder that can be found googling...it's
an obfuscator no an encrypter.

2012/8/7 Steve Found 

> On 06/08/12 03:03, Lightee wrote:
>
>> Dear CakePHP gurus,
>>
>> I have an upcoming project with a stingy customer who looks like the
>> not-willing-to-pay-up type. My cakePHP code will be deposited to his web
>> server for testing before payment. I want to obfuscate my code so that he
>> cannot steal it and then find all sorts of excuses not to pay me.
>>
>> May I know if there is a way to obfuscate my cakePHP code such that
>> someone who has access to the webserver and steals it will have trouble
>> reading it?
>>
>> Thank you.
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@**googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/**group/cake-php<http://groups.google.com/group/cake-php>
>>
> I would be tempted to go the usual javascript route and simply remove all
> whitespace and comments from your code and replacing meaningful variable
> names with meaningless ones. https://github.com/kcampion/**
> PHP-Compactor.git <https://github.com/kcampion/PHP-Compactor.git> is a
> nice starting point and as an added bonus, the compacted script will
> obviously load a little faster.
>
> There are some heavy weight systems around like Zend Encoder but if you
> simply make it so that it will take the client just as long to untangle
> what you have written as it would have done to write it themselves then I
> would think they will be unlikely to steal it if the project is of a decent
> size.
>
> Steve.
>
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org Check out the new CakePHP Questions site
> http://ask.cakephp.org and help others with their CakePHP related
> questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@**googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/**group/cake-php<http://groups.google.com/group/cake-php>
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
quickappscms.org
https://github.com/QuickAppsCMS/QuickApps-CMS

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Autocomplete example for cakephp 2.2

2012-07-25 Thread Christopher von Hessert
Hi, I'm looking all over google for a way to implement a Autocomplete input 
field with no luck. All examples I have found are for cakephp < 1.3

Does anyone have a working example for cakephp 2.2?

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Is there a way to test if "on localhost" ?

2012-05-12 Thread Christopher Castro
You can try something like this:

if (in_array(env('HTTP_HOST'), array('localhost', '127.0.0.1'))) {
// localhost
} else {
// live
}

2012/5/12 Daniel 

> Hi,
>
> I want to write some code along the lines of:
> if ("on localhost")
>// site is being tested: do something
> else
>// site is live: do something else
>
> ... or is there another way to do this?
>
> Thanks.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps.es <http://www.quickapps.es/>
https://github.com/quickapps/QuickApps-CMS/

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: QuickApps and Croogo

2012-04-25 Thread Christopher Castro
Better try both and see by yourself:
http://demo.quickappscms.org/
http://wiki.croogo.org/1.4/getting-started/demo

Both are capable to do the same things, with more or less effort.

- QACMS is strongly inspired by Drupal and built on Cake 2.1.
- Croogo is inspired by Wordpress, and it's latest version (1.4) is built
on Cake 2.x

As QACMS developer I can say:
Maybe the main different between each other is on the "Fields" system
implemented on both platforms.
QACMS offer a really powerful Field API (same as Drupal's CCK) which allows
you to easily create almost any kind of content, e.g.: The blog section in
the demo-site above was completely built using only CCK Fields (no extra
plugins needed).

(Other difference is how the 'Hook' system works on each platform)

Basically. QACMS is aimed to offer a platform that let you do almost
anything with less code-writing as possible, and be easy for both
developers and users to work with. That is why maybe qacms offer more
functionalities out of the box than Croogo.
An example of this filosofy is
QuickApps-CLI<http://quickappscms.org/eng/page/quickapps-cli.html>,
which helps you to build all the basics for modules and themes in a few
minutes.

--

I've never used croogo in any of my projects, so my personal opinions as
user about it are very limited and they are purely technical.


Regards,

2012/4/25 kani 

> What is diffrence and how compatible with cakephp core.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 

Christopher Castro.
quickappscms.org
https://github.com/quickapps/QuickApps-CMS/

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Accessing function from view

2012-03-21 Thread Christopher Ramsey
Hi,
Abstract: I would like to perform a calculus from $start_date and
$end_date fetched from the MySQL table. Where should I put my calculus
function ?

Detail: I am new to CakePhp. I have this Controller:

class PostersController extends AppController {
var $name = 'Posters';

function index (){
$request  = $this->Poster->find('all');
$this->set('posters', $request);
}

In my Posters MySQL table, I have $start_date and $end_date fields.
I want to have a function to perform a calculus for the duration using
this function.

function PosterDuration ($start_date, $end_date){
$duration = $start_date->diff($end_date);
return $duration;
}

I want to view the $duration in my View for each Poster. However I
don't know where to put this function logic.

1- I thought to put it as a private function in my PostersController,
however I don't know if I could access it from the Posters.ctp View.
2- I thought of creating a Component called
DuractionCalculusComponent.
3- Could it be a behaviour ?

Since I am new in CakePhp, I have modest knowledge and don't know
which option to chose. Your help will be appreciated.

Thank You

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: photo gallery

2011-12-15 Thread Christopher Castro
SlideShowPro Director<http://slideshowpro.net/products/slideshowpro_director/>is
the best I know for image galleries, it is written on cakePHP.


2011/12/15 heohni 

> Hi, has anyone ever used/build a photo gallery management for cake?
> Does anyone knows a good source or a script that works well with cake?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Christopher Castro.
Analista Programador Senior PHP/MySQL
Pamplona, España
QuickApps.es <http://www.quickapps.es/>
https://github.com/quickapps/QuickApps-CMS/

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Complex LIKE Conditions in CakePHP

2010-12-22 Thread Christopher Geheran

So, I am attempting to have multiple like conditions on the same
field, as follows, and Im sending this into the pagination class.

array(
   'Product.short_description LIKE' => array("%_ $plural _%", "%_
$singular _%")
)

Since the above is an array, cakephp is attempting to add the IN
clause into the sql, which makes perfect sense-- but, obviously does
not work for a LIKE condition.

Since its an array, you can not do this:

array(
   'Product.short_description LIKE' => "%_ $plural _%",
   'Product.short_description LIKE' => "%_ $singular _%"
)

You cannot do this because the Keys are the same, so you only end up
with the last key in the SQL. I attempted making the entire thing an
array, like this:

array(
   '0'=>'Product.short_description LIKE' => "%_ $plural _%",
   '1'=>'Product.short_description LIKE' => "%_ $singular _%"
)

Cake didn't seem to like that either.

Any suggestions?

Thanks,

Chris

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: Problem with models....help please!!!

2010-06-07 Thread Christopher Hanson

On 07/06/2010 08:46, dtemes wrote:

I think you have a typo:

var $actAs = array('Containable');

should be

var $actsAs = array('Containable');

you forgot the 's'



On 6 jun, 21:09, Christopher Hanson  wrote:
   

hey, i tried the following

  array(
  'className' =>  'InvoiceRows',
  'foreignKey' =>  'invoice_id',
  'order' =>  'InvoiceRows.delta ASC',
  ),
  );
  var $belongsTo = array(
  'Client' =>  array(
  'className' =>  'Client',
  ),
  );

}

and

Invoice->contain('Country');
  $data = $this->Invoice->find('all');
  //$data = $this->Invoice->findById($invoice_id);
  debug($data);
  $this->set('client_data', $data);

  }

}

also even if i try contain(); it still comes back with this error

*Warning*  (512):*SQL Error:*  1064: You have an error in 
your SQL syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near 'contain' at line 1  
[*CORE\cake\libs\model\datasources\dbo_source.php*, line*673*]

Chris

--
Best Regards Christopher Hanson
 

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
   
thanks detemes, noticed this already last night and changed it and it 
worked. until changed couldnt see why wasnt working lol thanks


--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-07 Thread Christopher Hanson

On 06/06/2010 20:18, Jens Ulf Dittrich wrote:
I guess you have no Class "InvoiceRows" in your Models. I think your 
Invoice AppModel should be something like:


...
var $hasMany = array(
'InvoiceRows' => array( // I guess that is ok for the name
'className' => 'Invoice', // <-- this one has to be a name of 
an actually existing Model/Table

.


Hi Jens

InvoiceRows works fine alrready, i Have classname as InvoiceRows, a 
table in db invoice_rows and model file invoice_rows.php but thanks for 
the help anyway.


--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson

On 06/06/2010 20:28, John Andersen wrote:

First, to make sure that your association between Invoice and
InvoiceRow does not affect the issue solving, please comment it out in
your Invoice model!

Taking your example, finding invoices from within the Invoices
controller, then you must specify the Containable conditions as:

[code]
$this->Invoice->find(
'all',
array(
   'contain' =>  array(
  'Client' =>  array(
 'Country'
  )
   )
)
);
[/code]

The reason is the Country is related through the Client. This will
mean that the Country record will be located inside the Client record.

Try it out and tell us what you got and whether it helped you on the
way :)
Enjoy,
John

On Jun 6, 10:09 pm, Christopher Hanson  wrote:
   

hey, i tried the following

  array(
  'className' =>  'InvoiceRows',
  'foreignKey' =>  'invoice_id',
  'order' =>  'InvoiceRows.delta ASC',
  ),
  );
  var $belongsTo = array(
  'Client' =>  array(
  'className' =>  'Client',
  ),
  );

}

and

Invoice->contain('Country');
  $data = $this->Invoice->find('all');
  //$data = $this->Invoice->findById($invoice_id);
  debug($data);
  $this->set('client_data', $data);

  }

}

also even if i try contain(); it still comes back with this error

*Warning*  (512):*SQL Error:*  1064: You have an error in 
your SQL syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near 'contain' at line 1  
[*CORE\cake\libs\model\datasources\dbo_source.php*, line*673*]

Chris

--
Best Regards Christopher Hanson
 

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 do have it working now, is noticed a mistake in invoice.php, $asctAs 
instead of $actsAs, i now get countries, do you know how to display the 
Country data in the same way on the client data so i can keep same 
variable access?


thanks

--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson
thanks John, tried that but still doesnt fetch any country data, im 
really not sure where the problem is :( any other suggestions? thanks


--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson

hey, i tried the following

 array(
'className' => 'InvoiceRows',
'foreignKey' => 'invoice_id',
'order' => 'InvoiceRows.delta ASC',
),
);
var $belongsTo = array(
'Client' => array(
'className' => 'Client',
),
);

}

and

Invoice->contain('Country');
$data = $this->Invoice->find('all');
//$data = $this->Invoice->findById($invoice_id);
debug($data);
$this->set('client_data', $data);

}

}

also even if i try contain(); it still comes back with this error

*Warning*  (512)  :*SQL Error:*  1064: You have an error 
in your SQL syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near 'contain' at line 1  
[*CORE\cake\libs\model\datasources\dbo_source.php*, line*673*]

Chris

--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson

On 06/06/2010 19:51, John Andersen wrote:

Have you added the Containable behavior to your model(s) or even
better to the AppModel? Like:
[code]
var $actsAs = array('Containable');
[/code]

Only after doing that, can you use it!

If you have done it, then please show the code of your find statement
including the contain conditions..
Enjoy,
John

On Jun 6, 9:34 pm, Christopher Hanson  wrote:
   

also i have been reading on containable and i just get SQL errors when i
try to use either $this->Model->contain() or in the params for find, any
ideas whats gong wrong?

--
Best Regards Christopher Hanson
 

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
   
Johndont beat me with a bati forgot that bit :D lol how would 
you suggest i get the country data pulling right in my invoice data? if 
you dont mind me askin


thanks and ill try the above now.

Chris

--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson
also i have been reading on containable and i just get SQL errors when i 
try to use either $this->Model->contain() or in the params for find, any 
ideas whats gong wrong?


--
Best Regards Christopher Hanson

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: Problem with models....help please!!!

2010-06-06 Thread Christopher Hanson

On 06/06/2010 18:54, John Andersen wrote:

There is nothing wrong with your associations/relationships between
the Invoice, Client and Country models.
You just have to read up on the recursive attribute in the model, see:
http://book.cakephp.org/view/1057/Model-Attributes#recursive-1063

That should give you a hint :)

Next I suggest you study the Containable behavior, as that will make
life easier for you in the future, with regard to finding related
information. See:
http://book.cakephp.org/view/1323/Containable

Last I also suggest you conform to the CakePHP conventions, see:
http://book.cakephp.org/view/901/CakePHP-Conventions
Note specially the Model naming (hint: className =>  InvoicesRows)!

Enjoy,
John

On Jun 6, 7:05 pm, "phpcoder2...@googlemail.com"
  wrote:
   

Hey guys, new here so please be gentle ;) lol here is my issue i need
help getting my head around.

I have the following models

invoice.php
client.php
country.php

client has country_id in db which relates to id in the country table
and pulls the correct country. this pulls out by using belongsTo
country in my client model and works great! my problem now is when i
go into an invoice it pulls the the client because im using belongsTo
client in the invoice model and using hasMany invoices in my client
model, this works great except the invoice only pulls the client
details along with the invoice data and doesnt fetch the country...
can anyone help me?

heres the code too:

invoice model

  array(
 'className' =>  'InvoicesRows',
 'foreignKey' =>  'invoice_id',
 'order' =>  'InvoiceRows.delta ASC',
 ),
 );
 var $belongsTo = array(
 'Client' =>  array(
 'className' =>  'Client',
 ),
 );

}

my client model

  array(
 'className' =>  'Invoice',
 'foreignKey' =>  'client_id',
 'order' =>  'Invoices.invoice_no DESC',
 ),
 );
 var $belongsTo = array(
 'Country' =>  array(
 'className' =>  'Country',
 'foreignKey' =>  'country_id',
 ),
 );

}

can anyone see anything wrong?

thanks Chris
 

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
   
thanks for your reply John, id just stumbled upon recursive before thie 
email, its bringing my Country data but inside of the Client data, every 
where else im accessing it outside Client, so Client -> data, Country -> 
data but recursive is fetching Client -> data, Country. I though id 
changed InvoicesRow to InvoiceRows (thats better right?); guess i hadnt 
lol, thanks


Chris

--
Best Regards Christopher Hanson

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: Configuring CSS

2009-04-24 Thread christopher

Thats great I have that done, I am struggling more with the correct
code to place in the default.ctp and if I have to call the CSS any
where else.  Thanks for your reply so far.

On Apr 24, 1:49 am, brian  wrote:
> By default, your stylesheets should be in webroot/css.
>
>
>
> On Thu, Apr 23, 2009 at 3:32 PM, christopher  wrote:
>
> > Hi could anyone tell me how to use my own CSS style sheet in Cake
> > PHP.  I have just started using CakePHP and am having difficulty.
> > I have created teh default.ctp file in the web root and the CSS file
> > in the views layout folder but I think  the default code is wrong.
>
> > Would appreciate a simple guide on how to set it up.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Configuring CSS

2009-04-23 Thread christopher

Hi could anyone tell me how to use my own CSS style sheet in Cake
PHP.  I have just started using CakePHP and am having difficulty.
I have created teh default.ctp file in the web root and the CSS file
in the views layout folder but I think  the default code is wrong.

Would appreciate a simple guide on how to set it up.

Thanks

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



More L10n for InputHelper Date

2008-10-28 Thread David Christopher Zentgraf

Hi,

Is there an elegant way to completely l6e (localize) the InputHelper's  
Date widget? I know about being able to translate month names via .po  
files. But I want to built a date input in Japanese, and the 100%  
correct way would be like this:
2008年10月29日, i.e. inserting 年, 月 and 日 either between the  
drop-down fields or include them in the values.

Is there a simple way to do this without doing every field individually?
My users could survive with just number dropdowns, but it'd be nice to  
do it correctly.

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



Re: missing view

2008-09-09 Thread David Christopher Zentgraf

On 9 Sep 2008, at 16:28, David C. Zentgraf wrote:

> The URL /test implies /test/index, which means Cake will look for  
> this:
>
> app/controllers/test_controller.php (needs to have function index())
> app/views/test/index.ctp (or .thtml for Cake 1.1)

Forgot of course that test_controller.php implies that you also have
app/models/test.php
and a database table named "tests".

With Cake 1.2 this controller/model dependency is somewhat "weaker",  
but 1.1 will complain if it's not there.

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



Set::extract, parents and ticket 5225

2008-09-08 Thread David Christopher Zentgraf

Hi!

I have a tree structure like this:

Array (
[0] => Array (
[Location] => Array (
[id] => 1
[parent_id] =>
[lft] => 1
[rght] => 32
[name_en] => Tokyo
...
)
[children] => Array (
[0] => Array (
[Location] => Array (
[id] => 58
...

I'm trying to extract all children of the Location "Tokyo" and I  
expected to do it with the following Xpath:

Set::extract('/Location[name_en=Tokyo]/../children', $data);

But Set just gives me an undefined offset: 0 [CORE/cake/libs/set.php,  
line 403].
Seems ticket 5225 (https://trac.cakephp.org/ticket/5225) is not fixed  
yet after all? (trying this on very latest checkout 7573)

Chrs,
Dav

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



Support for ORDER BY FIELD(`id`, 1, 2, ... )

2008-09-04 Thread David Christopher Zentgraf

Hi,

I was wondering if anybody has thought about adding support for  
"manual sorting" to Cake.
In my specific case, I need to paginate a model and want to order it  
by the average score of ratings that are stored in another table  
(Place hasMany Rating; ORDER BY AVG(Rating.score)). The best solution  
I found so far, next to writing my own paginator, was to add a  
condition like this to the paginate conditions:

1 = 1 ORDER BY FIELD(`Place`.`id`, 128, 97, ... ) DESC

where I'm getting the list of ids in a separate query in the right  
order.
This works fine, but since I don't like the "1 = 1 hack" I was  
wondering if there's a chance to get something like this into Cake:

find('all', array('order' => array('Place.id' => array(1, 2,  
3, ... ;

which would produce the above ORDER BY clause. I think that might come  
in handy in other situations as well.

Chrs,
Dav

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



HABTM database tables not found after update to 1.2.0.7531

2008-08-28 Thread David Christopher Zentgraf

Hi,

I just updated to the latest svn version 1.2.0.7531, and suddenly Cake  
won't find my DB tables anymore.

class Place extends AppModel {
...
var $hasAndBelongsToMany = array(
'Station' => array(
'className' => 'CgStation',
'joinTable' => 'places_stations',
'foreignKey'=> 'place_id',
'associationForeignKey' => 'station_id',
'unique'=> true
),
);
}

class CgStation extends AppModel {
...
var $useTable = 'stations';
var $hasAndBelongsToMany = array(
'Place' => array(
'className' => 'Place',
'joinTable' => 'places_stations',
'foreignKey'=> 'station_id',
'associationForeignKey' => 'place_id',
'unique'=> true
)
);
}

This worked perfectly fine in RC2, now Cake is giving me:
"Database table places_stations for model PlacesStation was not found."

The table is there though, and I do not have a model "PlacesStations".  
Should I?
Both models have $useDbConfig for a non-default DB configuration  
(mysql) BTW.

The SQL debug states:

Nr  Query   AffectedNum. 
rows   Took (ms)
1   DESCRIBE `places`   31  31  
11
...
5   DESCRIBE `stations` 10  10  
82
6   DESCRIBE `places_stations`  5   5   
14

No errors there...

Anybody know what's going on?

Chrs,
Dav

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



Re: Documentation

2008-06-24 Thread David Christopher Zentgraf

I suppose I'm talking about this:
http://book.cakephp.org/view/21/a-typical-cakephp-request

Just right now I feel it's neither high-level enough nor detailled  
enough to really help. Adding code examples would be great. Following  
variables/data throughout the application would help (controller/ 
action Cakes::buy() is being chosen because...) etc. Explaining Model  
relationship declarations and where to call them from (why doesn't  
ModelA->ModelB->find('all') take conditions on the association into  
account).


On 25 Jun 2008, at 09:51, David C. Zentgraf wrote:

> Just the vaguest of ideas, but a section on "app flow" would be good  
> I think.
>
> Which parts of Cake get called in which order, which files are  
> minimally relevant to a functioning application, where all the  
> automagic comes from [1] etc. I think for "traditional" PHP  
> programmers [2] Cake is a huge opaque blob in the beginning. Example  
> apps like the blog tutorial are helping somewhat, but you'll still  
> have to piece together the big picture yourself.
>
> [1] e.g. relationship between specifying $belongsTo and the  
> generated SQL
> [2] i.e. page starts at the top, includes() are easy to follow, one  
> instruction after the other, page ends
>
> Chrs,
> Dav
>
> On 25 Jun 2008, at 01:11, John David Anderson wrote:
>
>>
>> Bakers,
>>
>> How are we doing? What is the most confusing? What's most needed and
>> missing? I have a punchlist of my own, but I'm looking for input from
>> you guys, especially the new ones.
>>
>> Thanks,
>>
>> John
>>
>> >>
>


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



Re: Baking controllers, Missing table for 'Item'

2008-06-10 Thread David Christopher Zentgraf

Okay, sorry, please ignore. There _was_ an 'item' relationship which  
shouldn't have been there.
Better go get some lunch... ;o)

On 11 Jun 2008, at 13:16, David Christopher Zentgraf wrote:

> Hi,
>
> I'm trying to bake my controllers via the console. My app and Cake  
> directories are separated, the Cake folder is in /path/to/trunk/cake/ 
> cake, my app in /path/to/trunk/shop/admin.
>
> From /path/to/trunk/cake/cake/console I do this:
>
> $ ./cake -app /path/to/trunk/shop/admin
> ...
> ---
> App : admin
> Path: /path/to/trunk/shop/admin
> ...
> ---
> Bake Controller
> Path: /path/to/trunk/shop/admin/controllers/
> ...
> ---
> Baking ProductsController
> ---
> ...
>
> After all questions are answered, I get this error:
> "Error: Missing database table 'items' for model 'Item'"
>
> Baking the database config and the models from it worked fine.
> There's no model or field in my app called "item".
> Trying this on the latest svn checkout 1.2.0.7165.
> Could this be my fault or is it a Cake bug?
>


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



Baking controllers, Missing table for 'Item'

2008-06-10 Thread David Christopher Zentgraf

Hi,

I'm trying to bake my controllers via the console. My app and Cake  
directories are separated, the Cake folder is in /path/to/trunk/cake/ 
cake, my app in /path/to/trunk/shop/admin.

 From /path/to/trunk/cake/cake/console I do this:

$ ./cake -app /path/to/trunk/shop/admin
...
---
App : admin
Path: /path/to/trunk/shop/admin
...
---
Bake Controller
Path: /path/to/trunk/shop/admin/controllers/
...
---
Baking ProductsController
---
...

After all questions are answered, I get this error:
"Error: Missing database table 'items' for model 'Item'"

Baking the database config and the models from it worked fine.
There's no model or field in my app called "item".
Trying this on the latest svn checkout 1.2.0.7165.
Could this be my fault or is it a Cake bug?


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



Tools for merging directories

2008-06-04 Thread David Christopher Zentgraf

Hi,

With the release of RC1 (Cheers!), I'll use the opportunity to ask the  
list what you use to update your Cake builds.
What's the best tool for you to merge directory structures? Something  
like Diff for whole trees.
I tried several tools on the Mac, but none have really worked all that  
well for me.
Actually, the trick that worked best for me is to (ab)use tar, but I'd  
like something with more control.
(http://macdiggs.com/index.php/2007/12/27/merge-two-folders-on-mac-using-terminal-and-tar/
 
)

What are you guys using?

Chrs,
Dav

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



Re: Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.

On May 23, 2:49 pm, francky06l <[EMAIL PROTECTED]> wrote:
> If the user model is in the plugin it should not a problem.. Maybe the
> problem is how you call the find and from where ?

I do the find in the UsersController::read() function.  It seems to me
that it is a problem with the association because, when I set $this-
>User->recursive = -1; I get back just the user.  But, anything else,
it tries to pull the UserProfile and screws up.

> I guess this is when you try to find user from the application and not
> the plugin ?

No, I make the call from the users_controller in the plugin.

>Maybe the problem comes from the "calling" rather than
> the callee ?

I don't see a problem with $this->User->findById(1); but, like I said,
if I set recursive to -1 I get the user I want but, not the
user_profile.  I wanted to get both.

Alternatively, I can set the UserModel and UserProfileModel both to
recursive = -1 and just live with the extra calls but, this would be a
pain if I want to find all users.

I have also tried declaring different $hasOne and $belongsTo without
the plugin name like, 'User' instead of 'users.User' but, if I do
that, it says that it cannot find the database table user_profiles for
the 'UserProfile' model.

> hth

Thank you for replying :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.

Hi great coders,

 I am having a problem trying to get my model associations in a
plugin to come through.

I have a plugin called users and I have a users_controller and a
user_profiles_controller and thier associated models.  Between these
two models, I have them associated as, user has one user profile and
the user profile belongs to a user.

 In my controller, since I want to save the profile information at
the same time as I create the user, I have to declare the $uses
array.  This is fine but, since I am in a plugin, I have to declare
these like so:

public $uses = array('users.User', 'users.UserProfile');  This works
perfectly and I can create a user and a user profile and it saves just
fine.

The problem is when I try to find the user.  In my model association I
have to have:
$belongsTo = 'users.User'; and $hasOne = 'users.UserProfile'; or else
it will say that it cannot find the correct table.

Now, with this set, I get a giant SQL statement with an error:

Query: SELECT `User`.`id`, `User`.`email`, `User`.`password`,
`User`.`group_id`, `User`.`created`, `User`.`updated`,
`User`.`modified`, `users`.`UserProfile`.`id`,
`users`.`UserProfile`.`first_name`, `users`.`UserProfile`.`last_name`,
`users`.`UserProfile`.`address`, `users`.`UserProfile`.`city`,
`users`.`UserProfile`.`state`, `users`.`UserProfile`.`zip`,
`users`.`UserProfile`.`province`, `users`.`UserProfile`.`country`,
`users`.`UserProfile`.`home_telephone`,
`users`.`UserProfile`.`cell_phone`, `users`.`UserProfile`.`fax`,
`users`.`UserProfile`.`user_id` FROM `users` AS `User` LEFT JOIN
`user_profiles` AS `users`.`UserProfile` ON
(`users`.`UserProfile`.user_id = `User`.`id`) WHERE 1 = 1

1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '.`UserProfile` ON (`users`.`UserProfile`.user_id = `User`.`id`)
WHERE 1 = 1' at line 1

To me, it looks like the error is in the statement where it says
users.UserProfile ON users.UserProfile.user_id

So, I am at a loss, can't find anything here on the group, or the
tickets and IRC isn't very helpful today.

So, here is the code I have, maybe a second set of eyes will see
something I dont.

Remember, this is in a plugin.


USERS_CONTROLLER - /app/plugins/users/controllers/users_controller.php
---
class UsersController extends UsersAppController {
public $components = array('Auth');
public $uses = array('users.User', 'users.UserProfile');

public function beforeFilter() {
parent::beforeFilter();
$this->Auth->loginAction = '/login';
$this->Auth->logoutAction = '/logout';
$this->Auth->allowedActions = array('index', 'create', 'read',
'update', 'delete');
}

public function index() {

}

public function create() {
if(!empty($this->data)) {
$this->data['User']['password'] = 
$this->Auth->password($this-
>data['User']['password']);
$this->User->create($this->data);
$this->User->save($this->data);
$user_id = $this->User->id;
$this->data['UserProfile']['id'] = $user_id;
$this->data['UserProfile']['user_id'] = $user_id;
$this->UserProfile->create($this->data);
$this->UserProfile->save($this->data);
}
$this->set('fields', $this->User->getColumnTypes());
}

public function read($id = 1) {
$this->set('user', $this->User->findById($id));
}

public function update($id = 1) {
$this->set('user', $this->User->findById($id));
}

public function delete() {

}
}

USER_MODEL - /app/plugins/users/models/user.php
---
class User extends UsersAppModel {
public $useDbConfig = 'users';
public $hasOne = 'users.UserProfile';
}

USER_PROFILE_MODEL - /app/plugins/users/models/user_profile.php
--
class UserProfile extends UsersAppModel {
public $useDbConfig = 'users';
public $belongsTo = 'users.User';
}

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



Re: Is migrations support planned for Cake?

2008-05-19 Thread David Christopher Zentgraf

On 20 May 2008, at 08:21, Dardo Sordi Bogado wrote:

> I've didn't noticed it, isn't anyone else using the Cake schema shell?
> If that is the case, they are missing a great tool.

Speaking for me personally, I'm not using schema because there's very  
little documentation to be found. This thread seems like the most  
informative thing I've read about the whole topic so far (thanks both  
for your posts). I've played around with schema once just looking at  
the provided ones, but couldn't figure out how to create multiple  
UNIQUE indexes and got frustrated.

You've got me interested in the whole concept again, but I really wish  
there were some in-depth articles about schema. *wink*wink*nudge*nudge*

Chrs,
Dav

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



Re: setting path in app/webroot/index.php

2008-05-19 Thread David Christopher Zentgraf

Don't fumble around with index.php UNLESS you deliberately moved the / 
cake and /app directories from their original locations.

What you probably want to do is edit the 3 .htaccess files in / , /app  
and /app/webroot to look something like this:


 RewriteEngine on

 RewriteBase /~user/project/trunk/

 RewriteRule^$app/webroot/[L]
 RewriteRule(.*) app/webroot/$1[L]
  

Add the RewriteBase line, with the same path in all three .htaccess  
files.
(The path will look somewhat different for you on Windows.)

I can't seem to find the relevant entry in the manual anymore right now.
Is it still there?


On 19 May 2008, at 21:42, vishal wrote:

>
> Hi All,
>  I am New user on this community..can any body help me
> please !
>
> I have problem in setting the path in app/webrot/index.php
>
>
> My cake is installed in:
>
> X:\small_projects\vishal
>
> if (!defined('DS')) {
>   define('DS', DIRECTORY_SEPARATOR);
>   }
>
>   if (!defined('ROOT')) {
>
>   define('ROOT', '/home/small_projects/vishal/cake_1.1.19.6305');
>   }
>   if (!defined('APP_DIR')) {
>   //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION');
>   define('APP_DIR', 'app');
>   }
>
>   if (!defined('CAKE_CORE_INCLUDE_PATH')) {
>
>   define('CAKE_CORE_INCLUDE_PATH', '/home/small_projects/vishal/
> cake_1.1.19.6305/');
>   }
>
>
>
>
> where X:/ drives in my local server 192.168.0.60
>
> so please set my path accordingly..if possible. & please check & edit
> where i am wrong..
> I am very confuse regarding that.
>
>
> Thanks in advance..!!!
> vishal
>
> >


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



Re: undefined variable problem $form

2008-05-19 Thread David Christopher Zentgraf

Hi,

1) $validate goes into the Model, not the controller!
http://book.cakephp.org/view/66/models

2) $form is the Helper, and you'll need to specify in the Controller  
which helpers you want to be able to use in the View.
http://book.cakephp.org/view/98/helpers

Chrs,
Dav

On 19 May 2008, at 21:33, vishal wrote:

>
>
>
>
> Hi All,
>
>  I am new user on this community.I am not an expert in
> cake.so please help me in this issue.
>
>
>
> undefined variable $form
>
>
>
> This is my add.ctp file :
>
> Add User
>
>
>  echo $form->create('User');?>
> echo  $form->input('name');
> echo $form->input('address', array('rows' => '3'));
> echo $form->input('phone');
> echo $form->input('mobile');
> echo $form->input('email');
> echo $form->input('city');
> echo $form->input('state');
> echo $form->input('image',array('type' => 'file'));
> echo $form->end('Save User');
> ?>
>
>
>
> This is the controller file:
>
>
>  class UsersController extends AppController {
>
>var $name = 'Users';
>var $layout='user';
>//var $layout='edit';
>
>/* var $validate = array(
>
>  'name' => VALID_NOT_EMPTY,
>  'address' => VALID_NOT_EMPTY,
>   'phone' => VALID_NUMBER,
>   'mobile' => VALID_NUMBER,
>  'email' => VALID_EMAIL,
>  'city' => VALID_NOT_EMPTY,
>   'state' => VALID_NOT_EMPTY,
>   'image' => VALID_NOT_EMPTY,
>  'born' => VALID_NUMBER
>   );
>
>*/
>var $validate = array(
>'name' => array(
>'rule' => array('minLength', 1),
>'message' => 'please enter the name'
>),
>'address' => array(
>'rule' => array('minLength', 1)
>)
>);
>
>var $paginate = array(
>'limit' => 4,
>'order' => array(
>'User.name' => 'asc'
>)
>);
>
>
>function index() {
>//$this->set('users', $this->User->find('all'));
>//$data = $this->paginate('User');
>  //$this->set(compact('data'));
>
> $this->set('users', $this->User->findAll());
>
>}
>
>function view($id) {
>$this->User->id = $id;
>$this->set('user', $this->User->read());
>
>}
>
>function delete($id) {
>$this->User->del($id);
> $this->flash('The user with id: '.$id.' has been deleted.', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
> }
>
>function add() {
>if (!empty($this->data)) {
>if ($this->User->save($this->data)) {
>$this->flash('Your detail has been saved.','/users/
> index');
>}
>
>}
>}
>
>function edit($id = null) {
>$this->User->id = $id;
>if (empty($this->data)) {
>$this->data = $this->User->read();
>} else {
>if ($this->User->save($this->data['User'])) {
>$this->flash('Your detail has been updated.','http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
>}
>}
> }
>
> }
> ?>
>
>
>
> when i execute /users/addThis gives me an error :
>
> undefined variable $from. I don't know why this error occurs.same case
> occurs in editing .
>
>
>
> Is there any other way to create a form
>
>
>
>
>
> Thanks, in advance 
>
>
>
> Vishal
>
> >


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



Re: Custom SQL queries, binding and organizing results

2008-05-19 Thread David Christopher Zentgraf

Sorry for being a bit short there. :-)

I think I get this kind of array when using finderQueries.
Cake seems to organize the data to a certain extend, but not quite  
right.
What I need would be:

Array
(
[0] => Array
(
[Transaction] => Array
(
[id] .
[Intermediator] => Array
(
[0] => Array
(
[id] 


[Account] => Array
)
)
)
)
)

And so on.
The models are all "chained", not all belonging to one model.
So that's "flatter" than I need.


On 19 May 2008, at 20:15, the_woodsman wrote:

>
> Sorry, I don't understand - the output you posted
>
> Array
> (
> [0] => Array
> (
> [Transaction] => Array (...)
> [Intermediator] => Array (...)
> [Account] => Array (...)
> [User] => Array (...)
> )
>
> [1] => Array ...
> )
>
> Has been modified from a normal mysql query result... in what way is
> this a "flat" array?
> What output are you trying to achieve?
>
>
>
>
> On May 19, 11:39 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> I see, thanks!
>>
>> I played around with finderQueries a bit more and got them to work to
>> some extend, but not perfectly.
>> Depending on which model I'm querying from, Cake throws away part of
>> the results I'd like to keep, as it doesn't seem to think the result
>> is related enough to the querying model.
>>
>> Is there a recommended/best way to implement custom queries?
>> I'd hate to do it in the controller, so I was thinking about defining
>> a bunch of custom Model functions and using raw SQL which I'll have  
>> to
>> sort through. How does that work with table prefixes, for example?
>> Will Cake still prefix my tables or how would I take care of that
>> myself?
>>
>> Chrs,
>> Dav
>>
>> On 19 May 2008, at 17:13, Filip Camerman wrote:
>>
>>
>>
>>> I don't think and wouldn't expect Cake to have any functionality  
>>> to do
>>> that; when you're rolling your own queries you've got to live with  
>>> the
>>> flat result. If you sort your query right (e.g. by user) then it
>>> should be easy to rearrange the result in a hierarchical structure
>>> though.
> >


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



Re: Custom SQL queries, binding and organizing results

2008-05-19 Thread David Christopher Zentgraf

I see, thanks!

I played around with finderQueries a bit more and got them to work to  
some extend, but not perfectly.
Depending on which model I'm querying from, Cake throws away part of  
the results I'd like to keep, as it doesn't seem to think the result  
is related enough to the querying model.

Is there a recommended/best way to implement custom queries?
I'd hate to do it in the controller, so I was thinking about defining  
a bunch of custom Model functions and using raw SQL which I'll have to  
sort through. How does that work with table prefixes, for example?  
Will Cake still prefix my tables or how would I take care of that  
myself?

Chrs,
Dav

On 19 May 2008, at 17:13, Filip Camerman wrote:

>
> I don't think and wouldn't expect Cake to have any functionality to do
> that; when you're rolling your own queries you've got to live with the
> flat result. If you sort your query right (e.g. by user) then it
> should be easy to rearrange the result in a hierarchical structure
> though.
>
> >


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



Re: HABTM search entries help

2008-05-19 Thread David Christopher Zentgraf

Well, nothing's being deleted in those queries, only SELECTed.
Of the top of my head I'd say there are two possibilities:

1) Some really weird problem with your database engine that causes it  
to forget selected data. *
2) There's some logic in your application that deletes entries which  
is accidentally triggered.
*unlikely

What you usually do to select related model data is just this:
- You define your two models very simply, as in 
http://book.cakephp.org/view/66/models#introduction-67
- You set up associations between your two models as in 
http://book.cakephp.org/view/66/models#associations-78
- In your controller you do something like $this->User->find(), which  
returns an array like:

Array
(
 [User] => Array
 (
 ...
 )
 [Conversation] => Array
 (
 ...
 )
)

If you want to search for a specific entry in "Conversation" you'd do  
something like this:
$this->User->Conversation->find(array('topic' => 'How to bake  
cookies'));

If your code is anymore complicated than that you're probably not  
doing it right.
If you paste some more of your code (relevant controller actions,  
model definitions etc.) into the bin (http://bin.cakephp.org/) we  
might be able to tell where the problem is.

On 19 May 2008, at 16:35, oana wrote:

>
> These are the queries related concerning users, conversations, and the
> join table.
>
> If it isn't too much trouble, maybe you can point me to a complete
> piece of code  for the users cotroller, to select a certain user's
> conversations. Because i have tried several, and i think this is my
> problem.
>
> Thanks for helping,
> Oana
>
> SELECT `Conversation`.`id`, `Conversation`.`availability`,
> `Conversation`.`created`, `Conversation`.`modified`,
> `Conversation`.`description`, `Conversation`.`title`,
> `Conversation`.`postscount`, `Conversation`.`ideascount`,
> `ConversationsUser`.`conversation_id`, `ConversationsUser`.`user_id`
> FROM `conversations` AS `Conversation` JOIN `conversations_users` AS
> `ConversationsUser` ON (`ConversationsUser`.`user_id` IN (1) AND
> `ConversationsUser`.`conversation_id` = `Conversation`.`id`)
>
> SELECT COUNT(*) AS `count` FROM `conversations_users` AS
> `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
> (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
> JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
> `User`.`id`) WHERE `User`.`id` = 1
>
> SELECT `ConversationsUser`.`conversation_id`,
> `ConversationsUser`.`user_id`, `Conversation`.`id`,
> `Conversation`.`availability`, `Conversation`.`created`,
> `Conversation`.`modified`, `Conversation`.`description`,
> `Conversation`.`title`, `Conversation`.`postscount`,
> `Conversation`.`ideascount`, `User`.`id`, `User`.`username`,
> `User`.`email`, `User`.`password`, `User`.`group`,
> `User`.`first_name`, `User`.`last_name` FROM `conversations_users` AS
> `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
> (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
> JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
> `User`.`id`) WHERE `User`.`id` = 1 LIMIT 20
>
> On May 18, 11:53 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> Can you post the SQL queries generated by Cake?
>> Sounds really weird.
>>
>> On 18 May 2008, at 16:04, oana wrote:
>>
>>
>>
>>> Hi Keith,
>>
>>> Your summary is very accurate, that is exactly what's happening.
>>
>>> This is how i select the conversations for an user, in the user
>>> controller:
>>
>>> $this->set('conversations',$this->paginate('ConversationsUser',
>>> array('User.id' => $userId)));
>>
>>> Thank you for replying.
>>
>>> On May 18, 6:48 am, Keith <[EMAIL PROTECTED]> wrote:
>>>> Hi Oana,
>>
>>>> Can you post some code?
>>
>>>> What do you mean by "extract?"
>>
>>>> It sounds like you've got your HABTM working properly, but when you
>>>> try to create a view that shows conversations for a specific user  
>>>> the
>>>> join table rows associated with that user are deleted.  Is this an
>>>> accurate summary of your problem?
>>
>>>> On May 17, 4:34 am, oana <[EMAIL PROTECTED]> wrote:
>>
>>>>> I know it has been posted a lor about this topic...but i can't
>>>>> figure
>>>>> it out. Maybe someone with some experience in cake may help me,
>>>>> because i am a newbie.
>>

Re: HABTM search entries help

2008-05-18 Thread David Christopher Zentgraf

Can you post the SQL queries generated by Cake?
Sounds really weird.

On 18 May 2008, at 16:04, oana wrote:

>
> Hi Keith,
>
> Your summary is very accurate, that is exactly what's happening.
>
> This is how i select the conversations for an user, in the user
> controller:
>
> $this->set('conversations',$this->paginate('ConversationsUser',
> array('User.id' => $userId)));
>
> Thank you for replying.
>
>
>
> On May 18, 6:48 am, Keith <[EMAIL PROTECTED]> wrote:
>> Hi Oana,
>>
>> Can you post some code?
>>
>> What do you mean by "extract?"
>>
>> It sounds like you've got your HABTM working properly, but when you
>> try to create a view that shows conversations for a specific user the
>> join table rows associated with that user are deleted.  Is this an
>> accurate summary of your problem?
>>
>> On May 17, 4:34 am, oana <[EMAIL PROTECTED]> wrote:
>>
>>> I know it has been posted a lor about this topic...but i can't  
>>> figure
>>> it out. Maybe someone with some experience in cake may help me,
>>> because i am a newbie.
>>
>>> I have 2 classes, Users and Conversations, between them it's habtm
>>> relationship, and i have the join table ConversationsUser.
>>
>>> In the Users controller i have a function which extracts all the
>>> conversations of an user give by it's id. Whenever i try to do this,
>>> the fields in the join table are deleted.
>>
>>> Can anyone please help me? I didn't post this right away, i tried a
>>> lot to make it work, but i think it's something big i am missing.
>>
>>> Thanks,
>>> Oana
> >


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



Custom SQL queries, binding and organizing results

2008-05-16 Thread David Christopher Zentgraf

Hi,

I've read many posts on this topic, but I haven't figured out how to  
do it right yet.

I have four models linked together (Transaction hasMany Intermediators  
belongsTo Account belongsTo User), and I want to run a query on a  
"removed cousin", like $this->Account->Intermediator->Transaction- 
 >find('Account.id = xx').
Also, I need to optimize queries with LEFT JOINS, since Cake is  
creating hundreds of queries for a simple $this->paginate() for  
Transactions.
In a nutshell, I need to write my own SQL. A simple $this->query()  
works great, but I'm only getting a "flat" array back:

Array
(
 [0] => Array
 (
 [Transaction] => Array (...)
 [Intermediator] => Array (...)
 [Account] => Array (...)
 [User] => Array (...)
 )

 [1] => Array ...
)

What I want of course is a proper hierarchy of all my models in the  
result array.
How would I go about doing that, without doing it all manually in an  
afterFind()?

I've tried using the finderQuery property without any success, Cake  
just doesn't seem to use the finderQuery at all.
Any insight would be much appreciated.

(Cake 1.2 recent SVN checkout)

Chrs,
Dav

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



Re: Defining more than one hasMany relationship

2008-05-16 Thread David Christopher Zentgraf

foreach() does neither modify nor unset the original array unless  
explicitly told to.
Maybe you're having issues with the array pointer?

http://jp2.php.net/foreach
> foreach has some side effects on the array pointer. Don't rely on  
> the array pointer during or after the foreach without resetting it.

http://jp2.php.net/manual/en/function.reset.php


$numbers = array(1, 2, 3, 4);

foreach ($numbers as $number) {
$number = null; // does nothing to $numbers
}

print_r(current($numbers)); // prints nothing

reset($numbers);
print_r(current($numbers)); // prints '1'

print_r($numbers);  // prints 'array([0] => 1, [1] => 2 
...)'

On 16 May 2008, at 22:26, Tony Thomas wrote:

>
> No. It's simply looping through and echoing the array, but once it
> does, the contents of the array are no longer available. As soon as I
> looped through using while(list($key, $value) = each($array) instead
> of a foreach loop, I was able to loop through it twice to create the
> second table. Please correct me if I'm wrong, but I presume it's
> because foreach() operates from a copy of the array, which is then
> unset after looping through the data. At least, that's what my results
> suggest. As soon as I switched methods as noted above, the data
> remained available to loop through again to create a second table from
> separate data in the array.
>
> On May 15, 4:20 pm, Dovdimus Prime <[EMAIL PROTECTED]> wrote:
>> Are you saying that this foreach loop is modifying the contents of  
>> the
>> array?
>
> >


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



Re: Auth/Acl, limited accounts and endless redirects

2008-05-14 Thread David Christopher Zentgraf

Done: http://bin.cakephp.org/view/579746692
Please have a look.

On 14 May 2008, at 19:41, Marcin Domanski wrote:

>
> post your app_controller  and routes.php to the bin
>
> On Wed, May 14, 2008 at 10:03 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I ran into this situation:
>> I'm using the Auth and Acl components to lock down my system.
>> Really limited accounts basically have no right besides viewing and
>> editing their own profile page.
>> I disabled autoforwarding in the Auth component and set up some
>> customized redirects:
>>
>> a) if the user is not logged in and tries to access anything, Auth
>> component sends him to /users/login
>> e.g. /users/list -> /users/login
>>
>> b) if the user is logged in and tries to access something he's not
>> allowed to, Auth sends him to /users/login which then sends him to  
>> his
>> own profile page, a "safe" place the user definitely has access to.
>> e.g. /users/list -> /users/login -> /users/profile/username
>>
>> The problem is when I try to access the root directory, simply /.
>> Cake tries to forward the user to the root over and over in circles.
>>
>> $ curl -I -b cookie= http://localhost/myroot/
>> HTTP/1.1 301 Moved Permanently
>> Location: http://localhost/myroot/
>>
>> I set up routes.php with this:
>> Router::connect('/', array('controller' => 'users', 'action' =>
>> 'index'));
>>
>> Users with sufficient privileges get to see the index page, limited
>> accounts are being re-routed in circles.
>> If I try to access /users/ or /users/index directly it works great,
>> the user is redirected to his own profile page.
>>
>> Any ideas...?
>>
>> Chrs,
>> Dav
>>
>>>
>>
>
>
>
> -- 
> Marcin Domanski
> http://kabturek.info
>
> >


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



Auth/Acl, limited accounts and endless redirects

2008-05-14 Thread David Christopher Zentgraf

Hi,

I ran into this situation:
I'm using the Auth and Acl components to lock down my system.
Really limited accounts basically have no right besides viewing and  
editing their own profile page.
I disabled autoforwarding in the Auth component and set up some  
customized redirects:

a) if the user is not logged in and tries to access anything, Auth  
component sends him to /users/login
e.g. /users/list -> /users/login

b) if the user is logged in and tries to access something he's not  
allowed to, Auth sends him to /users/login which then sends him to his  
own profile page, a "safe" place the user definitely has access to.
e.g. /users/list -> /users/login -> /users/profile/username

The problem is when I try to access the root directory, simply /.
Cake tries to forward the user to the root over and over in circles.

$ curl -I -b cookie= http://localhost/myroot/
HTTP/1.1 301 Moved Permanently
Location: http://localhost/myroot/

I set up routes.php with this:
Router::connect('/', array('controller' => 'users', 'action' =>  
'index'));

Users with sufficient privileges get to see the index page, limited  
accounts are being re-routed in circles.
If I try to access /users/ or /users/index directly it works great,  
the user is redirected to his own profile page.

Any ideas...?

Chrs,
Dav

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



Re: Current Id - wie bekomme ich diese heraus

2008-05-13 Thread David Christopher Zentgraf

Ich weiß net genau wie's mit 1.1 steht, aber in Cake 1.2 sollte $this- 
 >Model->id eigentlich immer die aktuelle ID enthalten. Notfalls mal  
unter $this->Model->data['Model']['id'] nachschauen?

Seriously, write English, will ya?

Gruß.

On 13 May 2008, at 20:45, grobald wrote:

>
> sIst sicher trivialst, aber ich steh wieder mal auf der Leitung. ich
> habe eine Funktion mit der ich ein bestimmtes Feld (url) aus dem
> derzeitigen Record rausholen will:
> $post = $this->Post->read('url', $this->Post->id);
>
> Aber wie komme ich auf die id des Posts den ich gerade offen hab
>
> grüße
>
> >


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



Re: file_get_contents() to get response from Cake app?

2008-05-13 Thread David Christopher Zentgraf

No, I'm explicitly allowing the remote action.
I thought about the being-logged-in scenario as well, but that's not it.

As written before, when setting the Debug level to 0 it stays quiet,  
when setting it to 1 it works as it's supposed to.

And I always got a HTTP/1.1 200 OK.

I'm still baffled.

On 13 May 2008, at 16:14, [EMAIL PROTECTED] wrote:

> I do exactly what you describe. calling one CakeApp from another using
> file_get_contents() and... it work perfectly.
>
> General advice:
> Security? have you set it to anything other than the defaults? Is the
> remote action login-protected?
>
> I ask since you say it works in the browser... and your browser will
> probably already be logged in, accepted as a UA with a running
> session. Curling to the url and you will be a fresh session.
>
> Try
> curl -I http://example.com/controller/action
> You should see http status 200. If you see anything else 302 (probably
> login redirect), 401 (authentication needed). Anyway, you should see
> something other than an OK 200 response.
>
>
>
> On May 13, 6:31 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> Okay, that's weird.
>> Setting Debug to 1 in core.php suddenly gives me an output.
>> Even though in my remote action I explicitly call:
>>
>> $this->layout = 'ajax';
>> Configure::write('debug', 0);
>>
>> Interestingly, if I set debug to 0 in core.php and try to turn it  
>> back
>> on in my action, it doesn't work either.
>>
>> Now I have even more questions. ;-)
>> Why is the debug level suppressing my output,
>> and how can I get it to output something without turning debug on for
>> the whole app?
>>
>> Chrs,
>> Dav
>>
>> On 13 May 2008, at 13:15, Dr. Tarique Sani wrote:
>>
>>> I am presuming that you have set Debug to 0 - what happens when you
>>> turn the
>>> debug level up?
>>
>>> T
>>
>>> --
>>> =
>>> Cheesecake-Photoblog:http://cheesecake-photoblog.org
>>> PHP for E-Biz:http://sanisoft.com
>>> =
> >


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



Re: Validation on Update in Cake using VALID_UNIQUE

2008-05-12 Thread David Christopher Zentgraf

Actually, you may run into problems with this:

var $validate = array(
array(
'rule' => array('validateUnique', 'email')
),
);

function validateUnique($fieldValue, $fieldName) {
if (!$this->isUnique($fieldName)) {
return false;
} else {
return true;
}
}

When you have multiple models linked that have the same field names  
with validation rules (e.g. two models with 'name', both of which have  
validation rules), using this method doesn't properly prefix the field  
names and you may get an SQL error about ambiguous column names in  
certain circumstances.

Here's what I ended up using:

var $validate = array(
'name'  => array(
'minlength' => array('rule' => array('minLength', 2)),
'unique'=> array('rule' => array('isUnique')),
'required'  => array('rule' => array('custom', '/.*/'), 
'required' =>  
true, 'on' => 'create'),
'nonEmpty'  => array('rule' => array('custom', '/.*/'), 
'allowEmpty'  
=> false)
)
);

Thanks to Grant Cox for that.

Chrs,
Dav

On 12 May 2008, at 20:49, gmwebs wrote:

>
> I have posted what I have in my User model (running 1.2.x.x) at
> http://bin.cakephp.org/view/646962640
>
>
>
> >


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



Re: file_get_contents() to get response from Cake app?

2008-05-12 Thread David Christopher Zentgraf

Okay, that's weird.
Setting Debug to 1 in core.php suddenly gives me an output.
Even though in my remote action I explicitly call:

$this->layout = 'ajax';
Configure::write('debug', 0);

Interestingly, if I set debug to 0 in core.php and try to turn it back  
on in my action, it doesn't work either.

Now I have even more questions. ;-)
Why is the debug level suppressing my output,
and how can I get it to output something without turning debug on for  
the whole app?

Chrs,
Dav

On 13 May 2008, at 13:15, Dr. Tarique Sani wrote:

> I am presuming that you have set Debug to 0 - what happens when you  
> turn the
> debug level up?
>
> T
>
> -- 
> =
> Cheesecake-Photoblog: http://cheesecake-photoblog.org
> PHP for E-Biz: http://sanisoft.com
> =
>
> >


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



file_get_contents() to get response from Cake app?

2008-05-12 Thread David Christopher Zentgraf

Hi,

I have a rather peculiar problem:
I have a CakePHP app that external apps need to query some data from.  
Any app can basically send a request to a special controller action  
with a few encoded parameters in the URL, and the action will return a  
blank page with only the words true or false on it. Testing it in the  
browser works each time, I always get so see the expected result:

http://mysite.com/mycontroller/myremoteaction/KHBAKFNV3A/KJB909/OU9 ->
true

I need to query this URL from other PHP apps, and am using  
file_get_contents() to do so. On my local test system this method  
works, on my server it doesn't. I only get blank responses (HTTP  
headers come back, even with a Cake cookie, but no page content). Both  
have identical PHP versions and all. Curl-ing the address on the  
command line also only gives me a blank page.

I have no idea what's going on, any ideas anybody?
Do I need to send something using context streams or so that browsers  
do but PHP/curl don't for Cake to respond to me?

Chrs,
Dav

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



Re: hasAndBelongsToMany and belongsTo on same model

2008-05-11 Thread David Christopher Zentgraf

Hi,

I have a similar setup, where a user has many Accounts, but also has a  
default account.
My model looks like this:

class User extends AppModel {

var $name = 'User';

var $belongsTo = array(
'DefaultAccount' => array(
'className' => 'Account',
'foreignKey'=> 'default_account_id'
)
);

var $hasMany = array(
'Account' => array(
'className' => 'Account',
'foreignKey'=> 'user_id',
'dependent' => true
)
);
}


I have the same again in Groups, with each group having an Admin user  
but also many users:

class Group extends AppModel {

var $name = 'Group';

var $belongsTo = array(
'Admin' => array(
'className' => 'User',
'foreignKey'=> 'admin_id'
)
);

var $hasAndBelongsToMany = array(
'User' => array(
'className' => 'User',
'joinTable' => 'groups_users',
'foreignKey'=> 'group_id',
'associationForeignKey' => 'user_id',
'unique'=> true
)
);
}

Works perfectly fine for me.

Hope that helps somewhat...
Chrs,
Dav

On 11 May 2008, at 06:59, b logica wrote:

>
> I have a model, Artist, that HABTM Discipline (eg. Visual Arts,
> Theatre, etc.) The client has decided that they want each artist to
> have a "primary" discipline. I've changed the model, then, to have one
> Discipline in belongsTo and added a discipline_id column to the DB. So
> far, so sort of good. However, updates on the model are not going so
> well because the HABTM array will always include the primary. I have
> some ideas for dealing with this but thought I'd see if anyone has run
> into this before.
>
> Here's what I have:
>
> Artist
>
> var $belongsTo = array('Discipline');
> var $hasAndBelongsToMany = array(
>   'Discipline' => array(
>   'with' => 'ArtistsDiscipline',
>   'className' => 'Discipline',
>   'joinTable' => 'artists_disciplines',
>   'foreignKey' => 'artist_id',
>   'associationForeignKey' => 'discipline_id',
>   'unique' => true
>   )
> );
>
> Initially, the Artist looks something like this:
>
> Array
> (
>[Artist] => Array
>   (
>   [id] => 1
>   [created] => 2008-05-10 17:02:56.155567
>   [modified] => 2008-05-10 17:02:56.155567
>   [discipline_id] => 2
>   // other stuff ...
>   )
>[Discipline] => Array
>   (
>   [id] => 2
>   [name_en] => Visual Arts
>   [name_fr] => Arts Visuels
>   [name_es] => Artes Visuales
>   [0] => Array
>   (
>   [id] => 3
>   [name_en] => Film / Television
>   [name_fr] => Cinéma / Télévision
>   [name_es] => Cine / Televisión
>   )
>   [1] => Array
>   (
>   [id] => 9
>   [name_en] => Theatre
>   [name_fr] => Théâtre
>   [name_es] => Teatro
>   )
>   )
> )
>
> Already, the Discipine array looks like it needs some fixing. I figure
> I could do something in afterFind() here.
>
> The edit.ctp has:
>
> $form->label('Artist.discipline_id', __('* Primary Artistic
> Discipline', true), array('class' => 'Required'))
>
> $form->error('Artist.discipline_id', __('Please select a primary
> discipline', true)) ?>
> $form->select('Artist.discipline_id', $disciplines, null, array(),  
> true)
>   
> $form->label('Discipline.Discipline', __('Other Disciplines', true))
> $habtm->checkboxMultiple('Discipline.Discipline', $disciplines, null,
> array('class' => 'Required', 'multiple' => 'checkbox'))
>
>
> No surprises, the "Visual Arts" checkbox will be checked. After an
> update, the Discipline array looks like:
>
> [Discipline] => Array
> (
>   [id] => 2
>   [name_en] => Visual Arts
>   [name_fr] => Arts Visuels
>   [name_es] => Artes Visuales
>   [0] => Array
>   (
>   [id] => 2
>   [name_en] => Visual Arts
>   [name_fr] => Arts Visuels
>   [name_es] => Artes Visuales
>   )
>   [1] => Array
>   (
>   [id] => 3
>   [name_en] => Film / Television
>   [name_fr] => Cinéma / Télévision
>  

Re: IE7 Export XLS Problem

2008-05-08 Thread Christopher E. Franklin, Sr.

Okay, I got it thanks to some guidance from _psychic_  thank you!

So, the problem here was that the headers were all wrong.

They went from:

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=
$file_name");
header("Pragma: no-cache");
header("Expires: 0");

To:

$mm_type="application/octet-stream";

header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
//header("Content-Length: " .(string)(filesize($fullpath)) );
//header('Content-Disposition: attachment; filename="'.
$filename.'"');
header("Content-Transfer-Encoding: binary\n");

//header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file_name");
// header("Pragma: no-cache");
header("Expires: 0");

I think what did it was the "application.octet-stream" and the
"Content-Transfer-Encoding: binary\n"

Thanks again _psychic_

Here was where I found these headers:

http://us2.php.net/header

A post by : blinki bill

On May 8, 12:14 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> Hello wonderful group!
>
> I have written some code that in essence, takes a date range and
> serves up two different formats depending what button you click.
>
> Firstly, is the "View" button.  So, for example, I select a date range
> and click view, I get a table on the same page with the information I
> need.  This works fine in IE7 and Firefox.
>
> Secondly, I have another button called "Export".  Basically, it is the
> same form with the date ranges except, when I click the button, it
> calls a different function in my controller.  The controller gets the
> data from the model and packages it via a component as comma separated
> values (CSV).  It then just echos out the PHP headers and the CSV
> data.
>
> My problem is, it works fine in Firefox.  When I click export, the
> date range is submitted, and I get a download window for the xls
> file.  But, when I do the same thing in IE7 and IE6, I get an error
> stating that:
>
> "Internet Explorer cannot download renewals_certificate_export from
> subdomain.domain.com"
>
> "Internet Explorer was not able to open this Internet site. The
> requested site is either unavailable or cannot be found. Please try
> again later."
>
> So, while this error message is being displayed, I see the download
> box in the background, like it is ready to download.  So, that tells
> me that the headers for php are correct but, I cannot figure out why
> IE7 has a problem downloading variable data on the fly.
>
> I have tried changing the headers to something else to no avail.  I
> have tried making the URL different by including the full URL, with an
> ending slash (/) and also by including a file name on the end and
> accepting it in my controller function (/text.xls).
>
> I am at a loss here.  So, I know it's a problem with IE7, not CakePHP
> or with the PHP headers.  Just wondering if anyone has had a similar
> problem?  If so, were you able to resolve the issue?
>
> Here is my code:
>
> Controller
> -
>
>         function renewals_certificate_export($name = null) {
>                 Configure::write('debug', 0);
>                 if(!empty($this->data)) {
>                         $from = date('Y-m-d', strtotime($this->data['Report']
> ['from_month']."/".$this->data['Report']['from_day']."/".$this->data['Report']['from_year']))."
>  00:00:00";
>
>                         $to = date('Y-m-d', 
> strtotime($this->data['Report']['to_month']."/".
> $this->data['Report']['to_day']."/".$this->data['Report']
> ['to_year']))." 23:59:59";
>                         $not = '';
>                         if($this->data['Report']['stager'] == 0) {
>                                 $not .= "AND type != 'Stager' ";
>                         }
>                         if($this->data['Report']['master'] == 0) {
>                                 $not .= "AND type != 'Master' ";
>   

IE7 Export XLS Problem

2008-05-08 Thread Christopher E. Franklin, Sr.

Hello wonderful group!

I have written some code that in essence, takes a date range and
serves up two different formats depending what button you click.

Firstly, is the "View" button.  So, for example, I select a date range
and click view, I get a table on the same page with the information I
need.  This works fine in IE7 and Firefox.

Secondly, I have another button called "Export".  Basically, it is the
same form with the date ranges except, when I click the button, it
calls a different function in my controller.  The controller gets the
data from the model and packages it via a component as comma separated
values (CSV).  It then just echos out the PHP headers and the CSV
data.

My problem is, it works fine in Firefox.  When I click export, the
date range is submitted, and I get a download window for the xls
file.  But, when I do the same thing in IE7 and IE6, I get an error
stating that:

"Internet Explorer cannot download renewals_certificate_export from
subdomain.domain.com"

"Internet Explorer was not able to open this Internet site. The
requested site is either unavailable or cannot be found. Please try
again later."

So, while this error message is being displayed, I see the download
box in the background, like it is ready to download.  So, that tells
me that the headers for php are correct but, I cannot figure out why
IE7 has a problem downloading variable data on the fly.

I have tried changing the headers to something else to no avail.  I
have tried making the URL different by including the full URL, with an
ending slash (/) and also by including a file name on the end and
accepting it in my controller function (/text.xls).

I am at a loss here.  So, I know it's a problem with IE7, not CakePHP
or with the PHP headers.  Just wondering if anyone has had a similar
problem?  If so, were you able to resolve the issue?

Here is my code:

Controller
-

function renewals_certificate_export($name = null) {
Configure::write('debug', 0);
if(!empty($this->data)) {
$from = date('Y-m-d', strtotime($this->data['Report']
['from_month']."/".$this->data['Report']['from_day']."/".$this-
>data['Report']['from_year']))." 00:00:00";
$to = date('Y-m-d', 
strtotime($this->data['Report']['to_month']."/".
$this->data['Report']['to_day']."/".$this->data['Report']
['to_year']))." 23:59:59";
$not = '';
if($this->data['Report']['stager'] == 0) {
$not .= "AND type != 'Stager' ";
}
if($this->data['Report']['master'] == 0) {
$not .= "AND type != 'Master' ";
}
if($this->data['Report']['realtor'] == 0) {
$not .= "AND type != 'Realtor' ";
}
if($this->data['Report']['iahsp'] == 0) {
$not .= "AND type != 'Iahsp'";
}
$results = $this->Report->findAll("date >= '$from' AND 
date <=
'$to' $not");
foreach($results as $key => $value) {
$user = 
$this->Asp->findByUid($value['Report']['uid']);
$results[$key]['Report']['first_name'] = 
$user['Asp']['fname'];
$results[$key]['Report']['last_name'] = 
$user['Asp']['lname'];
$results[$key]['Report']['email'] = 
$user['Asp']['email'];
$results[$key]['Report']['expiration_date'] = 
$user['Asp']
['anniversary'];
}
$this->Excel->addRow(array("ID", "First Name", "Last 
Name", "Type",
"Email", "Expiration Date"));
foreach($results as $key => $value) {

$this->Excel->addRow(array($value['Report']['uid'],
$value['Report']['first_name'], $value['Report']['last_name'],
$value['Report']['type'], $value['Report']['email'], date('Y-m-d',
strtotime($value['Report']['expiration_date'];
}
$this->Excel->download(date('Y-m-d', 
strtotime($this->data['Report']
['from_month']."/".$this->data['Report']['from_day']."/".$this-
>data['Report']['from_year']))."_".date('Y-m-d', strtotime($this-
>data['Report']['to_month']."/".$this->data['Report']['to_day']."/".
$this->data['Report']['to_year'])).".xls");
}
}

Excel Component
--

class ExcelComponent extends Object {
var $lines;

function addRow($data) {
if(is_array($data)) {
foreach($data as $key => $value) {
$this->lines .= trim($value)."\t";
}
$this->lines = str_replace("\r","",$this->lines);

Re: Bug: Saving HABTM relationship, "Column in where clause is ambiguous"

2008-05-07 Thread David Christopher Zentgraf

Since I'm manually specifying the table name I can call it whatever I  
want actually.
No, the problem turned out to be in one of my validation functions,  
the checkUnique() function I just took straight from the manual.
For some reason it only came up as a problem in the context of HABTM  
saves.

Chrs,
Dav

On 8 May 2008, at 01:56, NOSLOW wrote:

>
> I see one problem in that you're not following the Cake conventions
> when naming your HABTM join table. The convention is to join the table
> names in alphabetical order (keeping both table names plural):
>
> 'joinTable' => 'user_friends',
>
> should be
>
> 'joinTable' => 'friends_users',
>
> Fix that and let us know if that helps out.
> >


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



Re: Bug: Saving HABTM relationship, "Column in where clause is ambiguous"

2008-05-06 Thread David Christopher Zentgraf

That just makes it throw another error:
SQL Error: 1054: Unknown column 'UserFriend.User.user_id' in 'on clause'

And it's not the HABTM relationship that's causing the problem.
I don't know why, but before saving a HABTM relationship Cake seems to  
do a lot of SELECTs for every related model, to make sure it's got the  
right users‽

It's tripping over the hasMany relationship between Users and  
Accounts, since both have a column with the same name.


On 7 May 2008, at 15:39, Grant Cox (Gmail) wrote:

> Change your HABTM to:
>
>   var $hasAndBelongsToMany = array(
>   'Group' => array(
>   'className'=> 'Group',
>   'joinTable'=> 'groups_users',
>   'foreignKey'=> 'user_id',
>   'associationForeignKey' => 'group_id',
>   'unique'=> true
>   ),
>   'Friend' => array(
>   'className'=> 'User',
>   'joinTable'=> 'user_friends',
>   'foreignKey'=> 'User.user_id',
>   'associationForeignKey' => 'Friend.friend_id',
>   'unique'=> true
>   )
>   );
>
> So you are specifying that in the join of the two tables, 'user_id'  
> is the left and 'friend_id' is the right.  This should avoid any  
> confusion.
>
> Grant
>
>
> David Christopher Zentgraf wrote:
>> Not quite sure what you're getting at, but please have a look:
>>
>>
>> class User extends AppModel {
>>
>>var $name = 'User';
>>
>>var $belongsTo = array(
>>'DefaultAccount' => array(
>>'className'=> 'Account',
>>'foreignKey'=> 'default_account_id'
>>)
>>);
>>
>>var $hasMany = array(
>>'Account' => array(
>>'className'=> 'Account',
>>'foreignKey'=> 'user_id',
>>'dependent'=> true
>>)
>>);
>>
>>var $hasAndBelongsToMany = array(
>>'Group' => array(
>>'className'=> 'Group',
>>'joinTable'=> 'groups_users',
>>'foreignKey'=> 'user_id',
>>'associationForeignKey' => 'group_id',
>>'unique'=> true
>>),
>>'Friend' => array(
>>'className'=> 'User',
>>'joinTable'=> 'user_friends',
>>'foreignKey'=> 'user_id',
>>'associationForeignKey' => 'friend_id',
>>'unique'=> true
>>)
>>);
>> }
>>
>> On 7 May 2008, at 15:22, Grant Cox wrote:
>>
>>>
>>> Can you post your $hasAndBelongsToMany variable definition?  I think
>>> you'll be able to fix your issue by just using the model alias
>>> prefixes in the 'foreignKey' and/or 'associationForeignKey' values.
>>>
>>>
>>> On May 7, 2:25 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
>>> wrote:
>>>> Hi,
>>>>
>>>> I'm stumbling across bug number 4194.https://trac.cakephp.org/ticket/4194
>>>>
>>>> I have a User model, which has a `name` field.
>>>> This User hasMany Accounts, which also have a `name` field.
>>>> The User also hasAndBelongsToMany other Users as a friend  
>>>> relationship.
>>>>
>>>> User (`name`, ...)
>>>> |
>>>> |- hasMany
>>>> |  |- Accounts (`name`, ...)
>>>> |
>>>> |- hasAndBelongsToMany
>>>>   |- User
>>>>
>>>> When I try to save such a User-User HABTM relationship, Cake is  
>>>> doing
>>>> all sorts of lookups, apparently for every linked model.
>>>> What it fails at is this query:
>>>>
>>>> SELECT COUNT(*) AS `count` FROM `users` AS `User`
>>>> LEFT JOIN `accounts` AS `DefaultAccount`
>>>>  ON (`User`.`default_account_id` = `DefaultAccount`.`id`)
>>>> WHERE ((`name` = '')) AND `User`.`id` != 1
>>>>
>>>> 1052: Column 'name' in where clause is ambiguous
>>>>
>>>> The WHERE clause would need to be extended to query for  
>>>> `User`.`name`
>>>> instead of just `name`, since both tables have a column called  
>>>> `name`.
>>>> I'm not quite sure why Cake is doing all these queries in the first
>>>> place, guess it's just being extra paranoid.
>>>>
>>>> Anyway, the above mentioned bug seems to be very related, but nate
>>>> insists on a test case.
>>>> I have no idea how to write test cases for something like this, so
>>>> could a kind soul jump in?
>>>>
>>>> Chrs,
>>>> Dav
>>> >>>
>>
>>


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



Re: Bug: Saving HABTM relationship, "Column in where clause is ambiguous"

2008-05-06 Thread David Christopher Zentgraf

Not quite sure what you're getting at, but please have a look:


class User extends AppModel {

var $name = 'User';

var $belongsTo = array(
'DefaultAccount' => array(
'className' => 'Account',
'foreignKey'=> 'default_account_id'
)
);

var $hasMany = array(
'Account' => array(
'className' => 'Account',
'foreignKey'=> 'user_id',
'dependent' => true
)
);

var $hasAndBelongsToMany = array(
'Group' => array(
'className' => 'Group',
'joinTable' => 'groups_users',
'foreignKey'=> 'user_id',
'associationForeignKey' => 'group_id',
'unique'=> true
),
'Friend' => array(
'className' => 'User',
'joinTable' => 'user_friends',
'foreignKey'=> 'user_id',
'associationForeignKey' => 'friend_id',
    'unique'=> true
)
);
}

On 7 May 2008, at 15:22, Grant Cox wrote:

>
> Can you post your $hasAndBelongsToMany variable definition?  I think
> you'll be able to fix your issue by just using the model alias
> prefixes in the 'foreignKey' and/or 'associationForeignKey' values.
>
>
> On May 7, 2:25 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>
>> I'm stumbling across bug number 4194.https://trac.cakephp.org/ticket/4194
>>
>> I have a User model, which has a `name` field.
>> This User hasMany Accounts, which also have a `name` field.
>> The User also hasAndBelongsToMany other Users as a friend  
>> relationship.
>>
>> User (`name`, ...)
>> |
>> |- hasMany
>> |  |- Accounts (`name`, ...)
>> |
>> |- hasAndBelongsToMany
>>|- User
>>
>> When I try to save such a User-User HABTM relationship, Cake is doing
>> all sorts of lookups, apparently for every linked model.
>> What it fails at is this query:
>>
>> SELECT COUNT(*) AS `count` FROM `users` AS `User`
>> LEFT JOIN `accounts` AS `DefaultAccount`
>>   ON (`User`.`default_account_id` = `DefaultAccount`.`id`)
>> WHERE ((`name` = '')) AND `User`.`id` != 1
>>
>> 1052: Column 'name' in where clause is ambiguous
>>
>> The WHERE clause would need to be extended to query for `User`.`name`
>> instead of just `name`, since both tables have a column called  
>> `name`.
>> I'm not quite sure why Cake is doing all these queries in the first
>> place, guess it's just being extra paranoid.
>>
>> Anyway, the above mentioned bug seems to be very related, but nate
>> insists on a test case.
>> I have no idea how to write test cases for something like this, so
>> could a kind soul jump in?
>>
>> Chrs,
>> Dav
> >


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



Bug: Saving HABTM relationship, "Column in where clause is ambiguous"

2008-05-06 Thread David Christopher Zentgraf

Hi,

I'm stumbling across bug number 4194. https://trac.cakephp.org/ticket/4194

I have a User model, which has a `name` field.
This User hasMany Accounts, which also have a `name` field.
The User also hasAndBelongsToMany other Users as a friend relationship.

User (`name`, ...)
|
|- hasMany
|  |- Accounts (`name`, ...)
|
|- hasAndBelongsToMany
|- User

When I try to save such a User-User HABTM relationship, Cake is doing  
all sorts of lookups, apparently for every linked model.
What it fails at is this query:

SELECT COUNT(*) AS `count` FROM `users` AS `User`
LEFT JOIN `accounts` AS `DefaultAccount`
   ON (`User`.`default_account_id` = `DefaultAccount`.`id`)
WHERE ((`name` = '')) AND `User`.`id` != 1

1052: Column 'name' in where clause is ambiguous

The WHERE clause would need to be extended to query for `User`.`name`  
instead of just `name`, since both tables have a column called `name`.
I'm not quite sure why Cake is doing all these queries in the first  
place, guess it's just being extra paranoid.

Anyway, the above mentioned bug seems to be very related, but nate  
insists on a test case.
I have no idea how to write test cases for something like this, so  
could a kind soul jump in?

Chrs,
Dav

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



Integrating CakePHP app into another app

2008-04-22 Thread David Christopher Zentgraf

Hi,

I wrote a user/login/permission management app in Cake 1.2.
I'm now looking for ways to integrate that into other (non-Cake) apps,  
so their permissions and users can be centrally managed.
My idea is to have a small .php file which could be included() from  
apps, providing them with an object to do basic things like checking  
permissions and outputting some information about the current user.

Any advice on how to best pull this off? Where would I best place this  
file to be included by other apps? The webroot directory?

Chrs,
Dav

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



Re: I18n, is this correct way? Configure::write('Config.language', "en");

2008-04-22 Thread David Christopher Zentgraf

I just had that same issue the other day, see thread:
http://groups.google.com/group/cake-php/browse_thread/thread/3ada672bf5a86b6b/cf386c0d99eca0bf

Basically, all you do is this in your core.php config file:
Configure::write('Config.language', "eng");

This establishes the default language for your app.

Then as the very first thing in beforeFilter, probably best in  
AppController::beforeFilter,
you do the same again to temporarily change the language to something  
else.

Forget about $this->L10n altogether.


On 23 Apr 2008, at 10:07, robert123 wrote:

>
> In the cakephp 1.2 cookbook 
> http://book.cakephp.org/view/161/localization-internationalizat
>
> There is a section
>
> $this->L10n = new L10n();
> $this->L10n->get("en");
> Configure::write('Config.language', "en");
>
> I read  that configure will change the whole application settings. Is
> this correct way to implement i18n, since every user have different
> locale, and if every user execute the statement above, than it will
> change the locale for other user also.
>
> I have tried $this->Session->write('Config.language','en-gb');
>
> but the function __() just will not take any locale from there. Any
> help will be deeply appreciated,
>
>
> www.generics.ws
> www.genericsmed.com
>
> --~--~-~--~~~---~--~~
> 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 [EMAIL PROTECTED]
> For more options, visit this group at http://groups.google.c


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



Re: Cause for l10n/i18n not working?

2008-04-22 Thread David Christopher Zentgraf

On 22 Apr 2008, at 16:28, [EMAIL PROTECTED] wrote:

> A few things that may cause a change in beforeFilter not to work is
> that you have to set it to eng, fra or swe... not en_us, se_sv or
> something similar (just checking). You should try this with all
> caching off for a start (see above). Also remember, you have to set it
> before using i18n.

I'm setting it to "jpn", the default was "eng".
What's the correct one to use anyway? I've seen different codes used  
throughout the i18n/l10n modules. Sometimes it seems to use 'ja',  
sometimes 'jpn'. It's pretty confusing/inconsistent.

> The main problem with changing the language is that i18n loads the
> locale once and looking at the code now I am not sure there is a
> simple way to change it once it has been loaded. You would have to
> make i18n drop its current instance and create a new one. There is no
> public method for doing this.

Okay, that fixed the problem. There was a call to __() in my  
beforeFilter before the language was switched.
Sorry, my fault then.

Another question though: the manual states that:
> Any Controller that uses localized content should include the use of  
> the L10n CakePHP utility class.
> uses('L10n');

This doesn't seem to be necessary. Additionally, isn't var $uses =  
array('L10n') the preferred method?

Chrs,
Dav

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



Re: Cause for l10n/i18n not working?

2008-04-21 Thread David Christopher Zentgraf

Unfortunately, this doesn't seem to work.

> Configure::write('Config.language', 'eng'); <- sets the language. This
> value is used by i18n.

I've tried this in my app_controller's beforeFilter, but it doesn't  
change anything.
The problem persists as described before, i18n only seems to pick up  
the initial setting in core.php, any subsequent changes don't register.

> App::import('Core', 'i18n');
> $i18n = I18n::getInstance();
> $i18n->l10n->get($lang);

This didn't work either. My debugging log showed that the locale  
actually did change in the i18n/l10n instance, it still output the  
language initially set in core.php though.

> I hope we are all talking about Cake 1.2 here?

Sorry, yes, we are, a very recent SVN checkout even. I double checked  
that I have the latest version of both i18n.php and l10n.php available.

Chrs,
Dav

On 21 Apr 2008, at 21:20, [EMAIL PROTECTED] wrote:

>
> I hope we are all talking about Cake 1.2 here?
>
> I am not sure that you should mess with l10n directly at all.
> When you do, you are effectively setting the language at different
> "levels" in the locale classes. This is what I believe is causing your
> problems. If you set the language in l10n, then i18n will not pick
> this up.
>
> define('DEFAULT_LANGUAGE', 'eng');  <- deprecated, use
> Configure::write()
> Configure::write('Config.language', 'eng'); <- sets the language. This
> value is used by i18n.
>
> I can switch languages in my app by resetting this value in
> beforeFilter. No need to call up an instance of l10n.
>
> If you want to switch it "on the fly" during rendering (don't know why
> really, but)... then it is another matter since i18n does not recheck
> the config once it has been setup. Then you need to get the current
> instance of i18n and set the language there:
> App::import('Core', 'i18n');
> $i18n = I18n::getInstance();
> $i18n->l10n->get($lang);
>
> hope this helps.
> /Martin
>
> On Apr 21, 12:28 pm, francky06l <[EMAIL PROTECTED]> wrote:
>> I use the l10n/i18n to set language, my method is close to yours
>> except that I set the language using :
>> $l10n = & new L10n();
>> $l10n->__setLanguage($lang)
>>
>> hth
>>
>> On Apr 21, 8:51 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
>> wrote:
>>
>>> This seems to be the cause of a lot of complaints about l10n/i18n  
>>> not
>>> working.
>>
>>> I set up two languages in my app: 'eng' and 'jpn'.
>>
>>> In core.php I added:
>>> define('DEFAULT_LANGUAGE', 'eng');
>>> Configure::write('Config.language', 'en');
>>
>>> In my app_controller beforeFilter:
>>> $lang = $this->Auth->user('pref_lang');  // user pref saved in  
>>> the
>>> DB
>>> $this->L10n->get($lang);  // Config.language gets set to 'ja'  
>>> here
>>
>>> I put a debug on line 124 of i18n.php:
>>> Debugger::log('l10n instance: '.$_this->l10n->locale.', Configure:
>>> '.Configure::read('Config.language'));
>>
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: en"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> ...
>>
>>> The very first instance of l10n seems to get the default language  
>>> from
>>> core.php, but afterwards my beforeFilter is changing it. i18n  
>>> holds on
>>> to just one instance of l10n though, which causes it to continue to
>>> use the default value.
>>
>>> I opened a ticket for it:https://trac.cakephp.org/ticket/4509
> >


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



Re: Cause for l10n/i18n not working?

2008-04-21 Thread David Christopher Zentgraf

Thanks.

If this is the case, the documentation seriously needs an update,  
because it's all over the place on how to actually switch languages.
I can only try your advise tomorrow though...

Chrs,
Dav

On 21 Apr 2008, at 21:20, [EMAIL PROTECTED] wrote:

>
> I hope we are all talking about Cake 1.2 here?
>
> I am not sure that you should mess with l10n directly at all.
> When you do, you are effectively setting the language at different
> "levels" in the locale classes. This is what I believe is causing your
> problems. If you set the language in l10n, then i18n will not pick
> this up.
>
> define('DEFAULT_LANGUAGE', 'eng');  <- deprecated, use
> Configure::write()
> Configure::write('Config.language', 'eng'); <- sets the language. This
> value is used by i18n.
>
> I can switch languages in my app by resetting this value in
> beforeFilter. No need to call up an instance of l10n.
>
> If you want to switch it "on the fly" during rendering (don't know why
> really, but)... then it is another matter since i18n does not recheck
> the config once it has been setup. Then you need to get the current
> instance of i18n and set the language there:
> App::import('Core', 'i18n');
> $i18n = I18n::getInstance();
> $i18n->l10n->get($lang);
>
> hope this helps.
> /Martin
>
> On Apr 21, 12:28 pm, francky06l <[EMAIL PROTECTED]> wrote:
>> I use the l10n/i18n to set language, my method is close to yours
>> except that I set the language using :
>> $l10n = & new L10n();
>> $l10n->__setLanguage($lang)
>>
>> hth
>>
>> On Apr 21, 8:51 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
>> wrote:
>>
>>> This seems to be the cause of a lot of complaints about l10n/i18n  
>>> not
>>> working.
>>
>>> I set up two languages in my app: 'eng' and 'jpn'.
>>
>>> In core.php I added:
>>> define('DEFAULT_LANGUAGE', 'eng');
>>> Configure::write('Config.language', 'en');
>>
>>> In my app_controller beforeFilter:
>>> $lang = $this->Auth->user('pref_lang');  // user pref saved in  
>>> the
>>> DB
>>> $this->L10n->get($lang);  // Config.language gets set to 'ja'  
>>> here
>>
>>> I put a debug on line 124 of i18n.php:
>>> Debugger::log('l10n instance: '.$_this->l10n->locale.', Configure:
>>> '.Configure::read('Config.language'));
>>
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: en"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> 2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
>>> ...
>>
>>> The very first instance of l10n seems to get the default language  
>>> from
>>> core.php, but afterwards my beforeFilter is changing it. i18n  
>>> holds on
>>> to just one instance of l10n though, which causes it to continue to
>>> use the default value.
>>
>>> I opened a ticket for it:https://trac.cakephp.org/ticket/4509
> >


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



Cause for l10n/i18n not working?

2008-04-20 Thread David Christopher Zentgraf

This seems to be the cause of a lot of complaints about l10n/i18n not  
working.

I set up two languages in my app: 'eng' and 'jpn'.

In core.php I added:
define('DEFAULT_LANGUAGE', 'eng');
Configure::write('Config.language', 'en');

In my app_controller beforeFilter:
$lang = $this->Auth->user('pref_lang');  // user pref saved in the  
DB
$this->L10n->get($lang);  // Config.language gets set to 'ja' here

I put a debug on line 124 of i18n.php:
Debugger::log('l10n instance: '.$_this->l10n->locale.', Configure:  
'.Configure::read('Config.language'));

2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: en"
2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
2008-04-21 15:34:44 Debug: "l10n instance: eng, Configure: ja"
...

The very first instance of l10n seems to get the default language from  
core.php, but afterwards my beforeFilter is changing it. i18n holds on  
to just one instance of l10n though, which causes it to continue to  
use the default value.

I opened a ticket for it: https://trac.cakephp.org/ticket/4509

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



Re: ACL: ACOs inherit permission settings backwards?

2008-04-10 Thread David Christopher Zentgraf

Awesome. Seems to work for me, with just a quick test.
I'll continue scrutinizing it to see if anything turns up, but so far  
so good.
No real performance hit or anything to speak of either.

On 10 Apr 2008, at 17:01, aranworld wrote:
>
> I have just updated the ticket with something that appears to solve
> the problem.
>
> At least the solution now allows the test case to pass.  And in my own
> application, things seem to be working out correctly.
>
> But the logic of these inheritance trees gets pretty tricky, so I
> wouldn't be surprised if I missed something in my solution.
>
> Check it out, and see if it works for you as well.
>
> Since the solution relies on lft and rght values, it will work no
> matter what order the ACO and ARO nodes were created in.
>
> -Aran
>
> On Apr 9, 9:10 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>> I'm currently trying to figure out the best way of dealing with  
>> rather
>> complex ACLs myself...
>>
>> I have different "modules" (controllers) in my application, and while
>> a user may be allowed to administer one module, he might be very
>> restricted in another. So I either have to be able to set very
>> specific permissions on a per-action basis for each user, or I have  
>> to
>> be able to assign a user to more than one group. The latter is not
>> possible with the current Cake ACL system, and the former only works
>> with restrictions... :-/
>>
>> On 10 Apr 2008, at 12:41, aranworld wrote:
>>
>>
>>
>>> Thanks for the clarification.  That does make sense to me.
>>
>>> I didn't notice the problem, because I am using the following in my
>>> app_controller.php to solve the same problem.  I will admit is not  
>>> the
>>> most elegant solution, but it does work:
>>
>>> function beforeFilter() {
>>>   $this->Auth->allowedActions = array('index', 'view', 'display');
>>>   $this->checkAuth();
>>> }
>>
>>> In controllers where I want to be more restrictive, I override this
>>> function.
>>
>>> On Apr 9, 7:39 pm, "David Zentgraf" <[EMAIL PROTECTED]> wrote:
>>>> Thanks aranworld, saw your message just now.
>>
>>>> I think the use case is when you're not using groups, and you  
>>>> have a
>>>> lot of children. In that case it's a lot easier to generally allow
>>>> access to the parent, but deny access to a few selected children,  
>>>> for
>>>> example.
>>
>>>> Additionally it's just expected behaviour IMHO.
>>>> If I explicitly state
>>>> $ cake acl deny deceze Users/delete all
>>
>>>> then
>>>> $ cake acl check deceze Users/delete all
>>
>>>> should never yield an Allowed.
>>
>>>> On Thu, Apr 10, 2008 at 3:50 AM, aranworld <[EMAIL PROTECTED]>
>>>> wrote:
>>
>>>>> The idea of basing inheritance on id order is really not going to
>>>>> work, because over the course of usage, ACO nodes are bound to be
>>>>> added in a non-linear fashion.  This is why lft and rght values  
>>>>> are
>>>>> used instead to determine inheritance.
>>
>>>>> I am able to reproduce this bug as described.
>>
>>>>> However, if you have the following:
>>
>>>>> ==
>>>>> ACO Table
>>
>>>>> Site
>>>>> ---Articles
>>
>>>>> ==
>>
>>>>> ARO Table
>>
>>>>> Users
>>>>> ---Frank
>>
>>>>> ==
>>
>>>>> And you do:
>>
>>>>> cake acl grant Users Site delete
>>>>> cake acl deny Frank Articles delete
>>
>>>>> Then you get the following
>>
>>>>> cake acl check Users Articles delete
>>>>> Users are allowed
>>
>>>>> cake acl check Frank Articles delete
>>>>> Frank is not allowed
>>
>>>>> The issue only seems to apply to situations in which the  
>>>>> overlapping
>>>>> permissions are from the same ARO node.  I'm not sure this is
>>>>> going to
>>>>> be considered buggy behavior by the developers.
>>
>>>>> Instead, it seems like the framework is set up so that parent
>>>>> permissions override child permissions when the same 

Re: ACL: ACOs inherit permission settings backwards?

2008-04-09 Thread David Christopher Zentgraf

I'm currently trying to figure out the best way of dealing with rather  
complex ACLs myself...

I have different "modules" (controllers) in my application, and while  
a user may be allowed to administer one module, he might be very  
restricted in another. So I either have to be able to set very  
specific permissions on a per-action basis for each user, or I have to  
be able to assign a user to more than one group. The latter is not  
possible with the current Cake ACL system, and the former only works  
with restrictions... :-/

On 10 Apr 2008, at 12:41, aranworld wrote:
>
> Thanks for the clarification.  That does make sense to me.
>
> I didn't notice the problem, because I am using the following in my
> app_controller.php to solve the same problem.  I will admit is not the
> most elegant solution, but it does work:
>
> function beforeFilter() {
>$this->Auth->allowedActions = array('index', 'view', 'display');
>$this->checkAuth();
> }
>
> In controllers where I want to be more restrictive, I override this
> function.
>
>
>
>
> On Apr 9, 7:39 pm, "David Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Thanks aranworld, saw your message just now.
>>
>> I think the use case is when you're not using groups, and you have a
>> lot of children. In that case it's a lot easier to generally allow
>> access to the parent, but deny access to a few selected children, for
>> example.
>>
>> Additionally it's just expected behaviour IMHO.
>> If I explicitly state
>> $ cake acl deny deceze Users/delete all
>>
>> then
>> $ cake acl check deceze Users/delete all
>>
>> should never yield an Allowed.
>>
>> On Thu, Apr 10, 2008 at 3:50 AM, aranworld <[EMAIL PROTECTED]>  
>> wrote:
>>
>>> The idea of basing inheritance on id order is really not going to
>>> work, because over the course of usage, ACO nodes are bound to be
>>> added in a non-linear fashion.  This is why lft and rght values are
>>> used instead to determine inheritance.
>>
>>> I am able to reproduce this bug as described.
>>
>>> However, if you have the following:
>>
>>> ==
>>> ACO Table
>>
>>> Site
>>> ---Articles
>>
>>> ==
>>
>>> ARO Table
>>
>>> Users
>>> ---Frank
>>
>>> ==
>>
>>> And you do:
>>
>>> cake acl grant Users Site delete
>>> cake acl deny Frank Articles delete
>>
>>> Then you get the following
>>
>>> cake acl check Users Articles delete
>>> Users are allowed
>>
>>> cake acl check Frank Articles delete
>>> Frank is not allowed
>>
>>> The issue only seems to apply to situations in which the overlapping
>>> permissions are from the same ARO node.  I'm not sure this is  
>>> going to
>>> be considered buggy behavior by the developers.
>>
>>> Instead, it seems like the framework is set up so that parent
>>> permissions override child permissions when the same user is
>>> involved.  As long as I understand that this is the behavior in  
>>> play,
>>> then I think I can live with things as is.
>>
>>> But maybe I'm not thinking of the situation in which you would  
>>> want to
>>> give a user ALL permissions on parent node and then try to deny a
>>> permission on a subnode?
>>
>>> On Apr 8, 11:34 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
>>> wrote:
>>
>>>> Ignore my previous fix, only works under certain conditions.
>>>> This fix is more robust:
>>
>>>> Insert:
>>>> // === WORKAROUND =
>>>> $perms = Set::sort($perms, '{n}.Aco.id', 'desc');
>>>> // =
>>
>>>> before:
>>>> $perms = Set::extract($perms, '{n}.' . $this->Aro->Permission- 
>>>> >alias);
>>
>>>> The checking algorithm still needs some revisitation.
>>
>>>> On 9 Apr 2008, at 13:15, David Christopher Zentgraf wrote:
>>
>>>>> Posted a possible fix inhttps://trac.cakephp.org/ticket/4450.
>>
>>>>> Replace the loop on line 313 of cake/libs/controller/components/
>>>>> acl.php:
>>
>>>>> foreach ($perms as $perm) {
>>>>>  // The inner part stays, only the enclosing loop can go!
>>>>> }
>>
>>>>> wi

Re: ACL: ACOs inherit permission settings backwards?

2008-04-09 Thread David Christopher Zentgraf

1) Ticket was posted earlier in this thread: 
https://trac.cakephp.org/ticket/4450

2) Somebody generously wrote a test and attached it to above ticket.

3) I wouldn't consider this an official fix, it's more of a workaround  
hack.
If ACOs are supposed to inherit permissions as well, the check loop  
would need to be revised IMHO.

On 10 Apr 2008, at 04:06, Chris Hartjes wrote:
>
> On Wed, Apr 9, 2008 at 2:34 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> Ignore my previous fix, only works under certain conditions.
>> This fix is more robust:
>>
>> Insert:
>> // === WORKAROUND =
>> $perms = Set::sort($perms, '{n}.Aco.id', 'desc');
>> // =
>>
>> before:
>> $perms = Set::extract($perms, '{n}.' . $this->Aro->Permission- 
>> >alias);
>>
>
> 1) please file a ticket with trac about this
> 2) post proof that your fix will work by writing a test for it
>
>
> -- 
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>
> >


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



Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

Ignore my previous fix, only works under certain conditions.
This fix is more robust:

Insert:
// === WORKAROUND =
$perms = Set::sort($perms, '{n}.Aco.id', 'desc');
// =

before:
$perms = Set::extract($perms, '{n}.' . $this->Aro->Permission->alias);

The checking algorithm still needs some revisitation.


On 9 Apr 2008, at 13:15, David Christopher Zentgraf wrote:
> Posted a possible fix in https://trac.cakephp.org/ticket/4450 .
>
> Replace the loop on line 313 of cake/libs/controller/components/ 
> acl.php:
>
> foreach ($perms as $perm) {
>   // The inner part stays, only the enclosing loop can go!
> }
>
> with:
>
> $perm = $perms[count($perms) - 1];
>
> Feedback would be appreciated.
>
> On 9 Apr 2008, at 11:56, David Christopher Zentgraf wrote:
>> Tried with the latest Nightly (08.04.08), dumped all my tables,
>> set everything up again, still the same.
>> Opened a ticket for it: https://trac.cakephp.org/ticket/4450
>>
>> On 8 Apr 2008, at 22:23, Dardo Sordi Bogado wrote:
>>>
>>> It's looks exactly as the bug described.
>>>
>>> Look in cake/libs/controller/components/acl.php
>>>
>>> method check,
>>>
>>> look for  === -1, change to  == -1. If it isn't there, probably you
>>> need to put a couple of pr() and start debugging :(.
>>>
>>> Before that, try with an fresh install of the latest svn.
>>>
>>> On Tue, Apr 8, 2008 at 9:12 AM, David Christopher Zentgraf
>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
>>>> `Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
>>>> `aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght`  
>>>> >=
>>>> `Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND  
>>>> `Aro0`.`foreign_key`
>>>> = 3 ORDER BY `Aro`.`lft` DESC
>>>>
>>>> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
>>>> `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
>>>> `acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') LEFT JOIN `acos` AS
>>>> `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
>>>> `Aco0`.`rght` AND `Aco1`.`alias` = 'index') WHERE ((`Aco`.`lft` <=
>>>> `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <=
>>>> `Aco1`.`lft` AND `Aco`.`rght` >= `Aco1`.`rght`)) ORDER BY  
>>>> `Aco`.`lft`
>>>> DESC
>>>>
>>>> SELECT `Permission`.`id`, `Permission`.`aro_id`,
>>>> `Permission`.`aco_id`, `Permission`.`_create`,  
>>>> `Permission`.`_read`,
>>>> `Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,
>>>> `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`,  
>>>> `Aro`.`alias`,
>>>> `Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,
>>>> `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,
>>>> `Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS
>>>> `Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS
>>>> `Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE
>>>> `Permission`.`aro_id` = 6 AND `Permission`.`aco_id` IN (4, 3, 2)
>>>>
>>>>
>>>> The result of that last call even looks pretty good to me:
>>>>
>>>> ++++-+---+-+- 
>>>> +--
>>>> +---+---+-++--+--+--
>>>> +---+---+-+---+--+--+
>>>> | id | aro_id | aco_id | _create | _read | _update | _delete |  
>>>> id   |
>>>> parent_id | model | foreign_key | alias  | lft  | rght | id   |
>>>> parent_id | model | foreign_key | alias | lft  | rght |
>>>> ++++-+---+-+- 
>>>> +--
>>>> +---+---+-++--+--+--
>>>> +---+---+-+---+--+--+
>>>> |  1 |  6 |  3 | 1   | 1 | 1   | 1   |6
>>>> |  NULL | User  |   3 | deceze |   11 |   12 |3
>>>> | 2 | NULL  |NULL | Users |2 |   13 |
>>>> |  3 |  6 |  4 | -1  | -1| -1  | -1  |6
>>>> |  NULL | User  |   3 | deceze |   11 |   12 |4
>>>&g

Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

Posted a possible fix in https://trac.cakephp.org/ticket/4450 .

Replace the loop on line 313 of cake/libs/controller/components/acl.php:

foreach ($perms as $perm) {
// The inner part stays, only the enclosing loop can go!
}

with:

$perm = $perms[count($perms) - 1];

Feedback would be appreciated.

On 9 Apr 2008, at 11:56, David Christopher Zentgraf wrote:
> Tried with the latest Nightly (08.04.08), dumped all my tables,
> set everything up again, still the same.
> Opened a ticket for it: https://trac.cakephp.org/ticket/4450
>
> On 8 Apr 2008, at 22:23, Dardo Sordi Bogado wrote:
>>
>> It's looks exactly as the bug described.
>>
>> Look in cake/libs/controller/components/acl.php
>>
>> method check,
>>
>> look for  === -1, change to  == -1. If it isn't there, probably you
>> need to put a couple of pr() and start debugging :(.
>>
>> Before that, try with an fresh install of the latest svn.
>>
>> On Tue, Apr 8, 2008 at 9:12 AM, David Christopher Zentgraf
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
>>> `Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
>>> `aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=
>>> `Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND  
>>> `Aro0`.`foreign_key`
>>> = 3 ORDER BY `Aro`.`lft` DESC
>>>
>>> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
>>> `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
>>> `acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') LEFT JOIN `acos` AS
>>> `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
>>> `Aco0`.`rght` AND `Aco1`.`alias` = 'index') WHERE ((`Aco`.`lft` <=
>>> `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <=
>>> `Aco1`.`lft` AND `Aco`.`rght` >= `Aco1`.`rght`)) ORDER BY  
>>> `Aco`.`lft`
>>> DESC
>>>
>>> SELECT `Permission`.`id`, `Permission`.`aro_id`,
>>> `Permission`.`aco_id`, `Permission`.`_create`, `Permission`.`_read`,
>>> `Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,
>>> `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`,  
>>> `Aro`.`alias`,
>>> `Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,
>>> `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,
>>> `Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS
>>> `Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS
>>> `Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE
>>> `Permission`.`aro_id` = 6 AND `Permission`.`aco_id` IN (4, 3, 2)
>>>
>>>
>>> The result of that last call even looks pretty good to me:
>>>
>>> ++++-+---+-+-+--
>>> +---+---+-++--+--+--
>>> +---+---+-+---+--+--+
>>> | id | aro_id | aco_id | _create | _read | _update | _delete |  
>>> id   |
>>> parent_id | model | foreign_key | alias  | lft  | rght | id   |
>>> parent_id | model | foreign_key | alias | lft  | rght |
>>> ++++-+---+-+-+--
>>> +---+---+-++--+--+--
>>> +---+---+-+---+--+--+
>>> |  1 |  6 |  3 | 1   | 1 | 1   | 1   |6
>>> |  NULL | User  |   3 | deceze |   11 |   12 |3
>>> | 2 | NULL  |NULL | Users |2 |   13 |
>>> |  3 |  6 |  4 | -1  | -1| -1  | -1  |6
>>> |  NULL | User  |   3 | deceze |   11 |   12 |4
>>> | 3 | NULL  |NULL | index |3 |4 |
>>> ++++-+---+-+-+--
>>> +---+---+-++--+--+--
>>> +---+---+-+---+--+--+
>>> 2 rows in set (0.00 sec)
>>>
>>>
>>> And just for completeness:
>>>
>>> $ cake acl view aco
>>>
>>> ---
>>> Aco tree:
>>> ---
>>>  [2]ROOT
>>>
>>>[3]Users
>>>
>>>  [4]index
>>>
>>>  [5]edit
>>>
>>>  [6]register
>>>
>>>  [7]profile
>

Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

Tried with the latest Nightly (08.04.08), dumped all my tables,
set everything up again, still the same.
Opened a ticket for it: https://trac.cakephp.org/ticket/4450

On 8 Apr 2008, at 22:23, Dardo Sordi Bogado wrote:
>
> It's looks exactly as the bug described.
>
> Look in cake/libs/controller/components/acl.php
>
> method check,
>
> look for  === -1, change to  == -1. If it isn't there, probably you
> need to put a couple of pr() and start debugging :(.
>
> Before that, try with an fresh install of the latest svn.
>
> On Tue, Apr 8, 2008 at 9:12 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
>> `Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
>> `aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=
>> `Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND `Aro0`.`foreign_key`
>> = 3 ORDER BY `Aro`.`lft` DESC
>>
>> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
>> `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
>> `acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') LEFT JOIN `acos` AS
>> `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
>> `Aco0`.`rght` AND `Aco1`.`alias` = 'index') WHERE ((`Aco`.`lft` <=
>> `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <=
>> `Aco1`.`lft` AND `Aco`.`rght` >= `Aco1`.`rght`)) ORDER BY `Aco`.`lft`
>> DESC
>>
>> SELECT `Permission`.`id`, `Permission`.`aro_id`,
>> `Permission`.`aco_id`, `Permission`.`_create`, `Permission`.`_read`,
>> `Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,
>> `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias`,
>> `Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,
>> `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,
>> `Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS
>> `Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS
>> `Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE
>> `Permission`.`aro_id` = 6 AND `Permission`.`aco_id` IN (4, 3, 2)
>>
>>
>> The result of that last call even looks pretty good to me:
>>
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> | id | aro_id | aco_id | _create | _read | _update | _delete | id   |
>> parent_id | model | foreign_key | alias  | lft  | rght | id   |
>> parent_id | model | foreign_key | alias | lft  | rght |
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> |  1 |  6 |  3 | 1   | 1 | 1   | 1   |6
>> |  NULL | User  |   3 | deceze |   11 |   12 |3
>> | 2 | NULL  |NULL | Users |2 |   13 |
>> |  3 |  6 |  4 | -1  | -1| -1  | -1  |6
>> |  NULL | User  |   3 | deceze |   11 |   12 |4
>> | 3 | NULL  |NULL | index |3 |4 |
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> 2 rows in set (0.00 sec)
>>
>>
>> And just for completeness:
>>
>> $ cake acl view aco
>>
>> ---
>> Aco tree:
>> ---
>>   [2]ROOT
>>
>> [3]Users
>>
>>   [4]index
>>
>>   [5]edit
>>
>>   [6]register
>>
>>   [7]profile
>>
>>   [8]delete
>>
>>
>>
>> But:
>>
>> $cake acl check deceze Users/index all
>> deceze is allowed.
>>
>>
>>
>>
>> On 8 Apr 2008, at 20:49, Dardo Sordi Bogado wrote:
>>>
>>> Can you post the SQL generated?
>>>
>>> On Tue, Apr 8, 2008 at 8:47 AM, David Christopher Zentgraf
>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Those URLs are not loading for me right now,
>>>> but I'm experiencing this on a Nightly from April 5th (I think).
>>>>
>>>> cake/libs/controller/components/acl.php:
>>>> /* SVN FILE: $Id: acl.php 6491 2008-03-01 03:12:12Z nate $ */
>>>>

Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

No '=== -1' in there. :(

I'll look over it tomorrow and will probably reopen the ticket.
(What's up with cakephp.org right now? It's not loading... Is it just  
me?)

Chrs,
Dav

On 8 Apr 2008, at 22:23, Dardo Sordi Bogado wrote:
>
> It's looks exactly as the bug described.
>
> Look in cake/libs/controller/components/acl.php
>
> method check,
>
> look for  === -1, change to  == -1. If it isn't there, probably you
> need to put a couple of pr() and start debugging :(.
>
> Before that, try with an fresh install of the latest svn.
>
> On Tue, Apr 8, 2008 at 9:12 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
>> `Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
>> `aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=
>> `Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND `Aro0`.`foreign_key`
>> = 3 ORDER BY `Aro`.`lft` DESC
>>
>> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
>> `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
>> `acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') LEFT JOIN `acos` AS
>> `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
>> `Aco0`.`rght` AND `Aco1`.`alias` = 'index') WHERE ((`Aco`.`lft` <=
>> `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <=
>> `Aco1`.`lft` AND `Aco`.`rght` >= `Aco1`.`rght`)) ORDER BY `Aco`.`lft`
>> DESC
>>
>> SELECT `Permission`.`id`, `Permission`.`aro_id`,
>> `Permission`.`aco_id`, `Permission`.`_create`, `Permission`.`_read`,
>> `Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,
>> `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias`,
>> `Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,
>> `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,
>> `Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS
>> `Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS
>> `Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE
>> `Permission`.`aro_id` = 6 AND `Permission`.`aco_id` IN (4, 3, 2)
>>
>>
>> The result of that last call even looks pretty good to me:
>>
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> | id | aro_id | aco_id | _create | _read | _update | _delete | id   |
>> parent_id | model | foreign_key | alias  | lft  | rght | id   |
>> parent_id | model | foreign_key | alias | lft  | rght |
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> |  1 |  6 |  3 | 1   | 1 | 1   | 1   |6
>> |  NULL | User  |   3 | deceze |   11 |   12 |3
>> | 2 | NULL  |NULL | Users |2 |   13 |
>> |  3 |  6 |  4 | -1  | -1| -1  | -1  |6
>> |  NULL | User  |   3 | deceze |   11 |   12 |4
>> | 3 | NULL  |NULL | index |3 |4 |
>> ++++-+---+-+-+--
>> +---+---+-++--+--+--
>> +---+---+-+---+--+--+
>> 2 rows in set (0.00 sec)
>>
>>
>> And just for completeness:
>>
>> $ cake acl view aco
>>
>> -------
>> Aco tree:
>> ---
>>   [2]ROOT
>>
>> [3]Users
>>
>>   [4]index
>>
>>   [5]edit
>>
>>   [6]register
>>
>>   [7]profile
>>
>>   [8]delete
>>
>>
>>
>> But:
>>
>> $cake acl check deceze Users/index all
>> deceze is allowed.
>>
>>
>>
>>
>> On 8 Apr 2008, at 20:49, Dardo Sordi Bogado wrote:
>>>
>>> Can you post the SQL generated?
>>>
>>> On Tue, Apr 8, 2008 at 8:47 AM, David Christopher Zentgraf
>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Those URLs are not loading for me right now,
>>>> but I'm experiencing this on a Nightly from April 5th (I think).
>>>>
>>>> cake/libs/controller/components/acl.php:
>>>> /* SVN FILE: $Id: acl.php 6491 2008-03-01 0

Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,  
`Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN  
`aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=  
`Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND `Aro0`.`foreign_key`  
= 3 ORDER BY `Aro`.`lft` DESC

SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,  
`Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN  
`acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') LEFT JOIN `acos` AS  
`Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <  
`Aco0`.`rght` AND `Aco1`.`alias` = 'index') WHERE ((`Aco`.`lft` <=  
`Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <=  
`Aco1`.`lft` AND `Aco`.`rght` >= `Aco1`.`rght`)) ORDER BY `Aco`.`lft`  
DESC

SELECT `Permission`.`id`, `Permission`.`aro_id`,  
`Permission`.`aco_id`, `Permission`.`_create`, `Permission`.`_read`,  
`Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,  
`Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias`,  
`Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,  
`Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,  
`Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS  
`Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS  
`Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE  
`Permission`.`aro_id` = 6 AND `Permission`.`aco_id` IN (4, 3, 2)


The result of that last call even looks pretty good to me:

++++-+---+-+-+-- 
+---+---+-++--+--+-- 
+---+---+-+---+--+--+
| id | aro_id | aco_id | _create | _read | _update | _delete | id   |  
parent_id | model | foreign_key | alias  | lft  | rght | id   |  
parent_id | model | foreign_key | alias | lft  | rght |
++++-+---+-+-+-- 
+---+---+-++--+--+-- 
+---+---+-+---+--+--+
|  1 |  6 |  3 | 1   | 1 | 1   | 1   |6  
|  NULL | User  |   3 | deceze |   11 |   12 |3  
| 2 | NULL  |NULL | Users |2 |   13 |
|  3 |  6 |  4 | -1  | -1| -1  | -1  |6  
|  NULL | User  |   3 | deceze |   11 |   12 |4  
| 3 | NULL  |NULL | index |3 |4 |
++++-+---+-+-+-- 
+---+---+-++--+--+-- 
+---+---+-+---+--+--+
2 rows in set (0.00 sec)


And just for completeness:

$ cake acl view aco

---
Aco tree:
---
   [2]ROOT

 [3]Users

   [4]index

   [5]edit

   [6]register

   [7]profile

   [8]delete



But:

$cake acl check deceze Users/index all
deceze is allowed.


On 8 Apr 2008, at 20:49, Dardo Sordi Bogado wrote:
>
> Can you post the SQL generated?
>
> On Tue, Apr 8, 2008 at 8:47 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> Those URLs are not loading for me right now,
>> but I'm experiencing this on a Nightly from April 5th (I think).
>>
>> cake/libs/controller/components/acl.php:
>> /* SVN FILE: $Id: acl.php 6491 2008-03-01 03:12:12Z nate $ */
>> ...
>>
>>
>>
>> On 8 Apr 2008, at 20:17, Dardo Sordi Bogado wrote:
>>>
>>> Bug #3851,
>>>
>>> https://trac.cakephp.org/ticket/3851
>>> https://trac.cakephp.org/changeset/6342
>>>
>>> It's fixed in current versions.
>>>
>>> On Tue, Apr 8, 2008 at 6:01 AM, David Christopher Zentgraf
>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Am I getting this right? With the ACL component, AROs inherit their
>>>> permissions like this:
>>>>
>>>> Group [denied something]
>>>> |- User [allowed something]
>>>>
>>>> In this case, the explicitly granted permission on the User  
>>>> overrides
>>>> the general Group setting, allowing the User something  
>>>> specifically.
>>>> With ACOs the opposite seems to be the case:
>>>>
>>>> Controller [allowing user]
>>>> |- Action [denying user]
>>>>
>>>> In this case, the general permission on the Controller seems to
>>>> override the explicitly forbidden Action.
>>>>
>>>> $ cake acl grant deceze Users all
>>>> $ cake acl deny deceze Users/delete all
>>>>
>>>> $ cake acl check deceze Users/delete all
>>>> deceze is allowed.
>>>>
>>>> Is this by design or a bug?
>>>>
>>>> Chrs,
>>>> Dav
>>>>
>>>>>
>>>>
>>>
>>>>
>>
>>
>>>
>>
>
> >


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



Re: ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

Those URLs are not loading for me right now,
but I'm experiencing this on a Nightly from April 5th (I think).

cake/libs/controller/components/acl.php:
/* SVN FILE: $Id: acl.php 6491 2008-03-01 03:12:12Z nate $ */
...

On 8 Apr 2008, at 20:17, Dardo Sordi Bogado wrote:
>
> Bug #3851,
>
> https://trac.cakephp.org/ticket/3851
> https://trac.cakephp.org/changeset/6342
>
> It's fixed in current versions.
>
> On Tue, Apr 8, 2008 at 6:01 AM, David Christopher Zentgraf
> <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> Am I getting this right? With the ACL component, AROs inherit their
>> permissions like this:
>>
>> Group [denied something]
>> |- User [allowed something]
>>
>> In this case, the explicitly granted permission on the User overrides
>> the general Group setting, allowing the User something specifically.
>> With ACOs the opposite seems to be the case:
>>
>> Controller [allowing user]
>> |- Action [denying user]
>>
>> In this case, the general permission on the Controller seems to
>> override the explicitly forbidden Action.
>>
>> $ cake acl grant deceze Users all
>> $ cake acl deny deceze Users/delete all
>>
>> $ cake acl check deceze Users/delete all
>> deceze is allowed.
>>
>> Is this by design or a bug?
>>
>> Chrs,
>> Dav
>>
>>>
>>
>
> >


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



ACL: ACOs inherit permission settings backwards?

2008-04-08 Thread David Christopher Zentgraf

Hi,

Am I getting this right? With the ACL component, AROs inherit their  
permissions like this:

Group [denied something]
|- User [allowed something]

In this case, the explicitly granted permission on the User overrides  
the general Group setting, allowing the User something specifically.
With ACOs the opposite seems to be the case:

Controller [allowing user]
|- Action [denying user]

In this case, the general permission on the Controller seems to  
override the explicitly forbidden Action.

$ cake acl grant deceze Users all
$ cake acl deny deceze Users/delete all

$ cake acl check deceze Users/delete all
deceze is allowed.

Is this by design or a bug?

Chrs,
Dav

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



$useTable not working

2008-03-04 Thread Christopher Hazlett

I need to base a model on a SQL View so I've set $useTable=false.  All
I really want to do is pull this multi-join view from the DB instead
of using the application to try and build a very custom query.  Even
though I've set the $useTable variable to false, Cake still looks for
the table underneath (or at least that's what it says it's doing).

I've attached the model code below. Obviously, It's quite a simple
operation, but it just won't work.

I'm new to Cake but not PHP, so I may be missing something
fundamental.  Any help would be greatly appreciated.

-Chris

--
class EventCalendar extends AppModel
{
var $name = 'EventCalendar';
var $useTable = false;

function index(){
$this->query('SELECT id, account_id, company_name, event_name,
start_date, end_date, lead_name, days_to_event, open_tasks,
overdue_tasks FROM vw_eventscalendar WHERE account_id=1');
}
}
---

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



Bakery Login Problems

2008-01-10 Thread Christopher E. Franklin, Sr.

Anyone else having problems logging into bakery.cakephp.org?  It told
me invalid username or password, which is a lie lol, so I try to reset
my password but, no email has ever showed up about resetting it.

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



Re: Need help with data relations and controlers

2007-11-30 Thread Christopher E. Franklin, Sr.

You can always add stuff to the array and re-save it with the same
id.  This overwrites the old data.  Is this what you are looking for?

$this->data['User']['new_field'] = 2;
$this->User->save($this->data);

On Nov 30, 4:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I'm very new to cakephp and I'm trying to figure out how related
> tables work. Here's my question. Say I have a list of message boards
> that have users connected to them in the Calendar model with the
> $hasMany variable. Now, say each calendar has a contact field that
> holds an email address. Whenever I add a new calendar, I want to also
> add a new user from a calendars_controller.php function with the email
> address from the contact field of the calendar and the calendar's id
> in the calendar_id field of a user. How do I do this?
>
> I can figure out how to read all of the users associated with a
> calendar in the calendars_controller, but I can't for the life of me,
> figure out how to add new data in the users table from the
> calendar_controller. Anyone have any insight?
>
> Thanks, Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $ajax->submit and JavaScript

2007-11-30 Thread Christopher E. Franklin, Sr.

Why don't you do the validation on the same page using javascript if
you're going that route. Otherwise, you will have to use the model
validation and let the controller method complete what it needs to.
if($this->Model->create($this->data) && $this->Model->validates()) {
 if($this->Model->save($this->data)) {
   $this->redirect('/somewhere');
   exit;
 } else {
  throw new Exception("Could not save the user data!");
 }
} else {
 $this->render();
 exit;
}

On Nov 30, 3:45 pm, peterhf <[EMAIL PROTECTED]> wrote:
> How does one execute a JS script before the html request is made and
> halt the request based on some condition in the JS? For instance, I
> wish to check that required fields are correctly populated; if any
> required field is not correctly populated, I want to show an alert and
> return to the page without completing the http request. I am using the
> 'before' option in the submit but have not discovered how to stop the
> request from completing.
>
> Thanks in advance for your suggestions.
>
> Peter -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Accessing data stored on other server

2007-11-30 Thread Christopher E. Franklin, Sr.

Well, what I am thinking is this: You know how you can display an
image on your page from another site?  Why not try that? I know it
works as long as the folder on the other site is not protected.  If it
is, and you must get the file through a php page, just put the swf
source url as the php page as long as the php page sends the headers
to you as the correct mime type.

I do this with images all the time to protect them.   and in the php page I check
the referrer and then send the headers: header("Content-type:
{$sql['mime']}");

On Nov 30, 3:01 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello guys,
>
> actually i have stored some SWFs on one web server...but the index page of
> the site is not on that server...
> the php page where these swfs will be embedded is on some other server..
> what are the possibilities of using the swfs on other server from this one..
> I guess i can't directly accesses files on the other server directly. Can
> some one help?
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Christopher E. Franklin, Sr.

My bad, it's at the very end of helpers section which makes no sense
to me since it should be at the very top.  It is also in the
controllers section:
---
$helpers

Use this variable to have your controller load helpers into its views.
The HTML helper is automatically loaded, but you can use this variable
to specify a few others:
var $helpers = array('Html','Ajax','Javascript');

Remember that you will need to include the HtmlHelper in the $helpers
array if you intend to use it. It is normally available by default,
but if you define $helpers without it, you'll get error messages in
your views.
---
On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote:
> Thanks for the answer, one more thing though, should i use it in every
> controller or just the main app controller?
>
> Christopher E. Franklin, Sr. : i will check again, though i checked
> several times.maybe it slipped :)
>
> On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
>
> > G'day
>
> > Hopefully I'm not misunderstanding.
>
> > In your controller, make sure you have it defined. "var $helpers =
> > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> > for context.
> > That will work for just Javascript.
> > If you use any helpers that are not built in, just make sure you put a
> > copy of the helper is in "app/views/helpers" and then add the name,
> > just like you did with 'Javascript'.
>
> > You should now have access.:-)
>
> > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > Sorry to ask such a newbie question, but i didnt find anything about
> > > it in the manual. Maybe i missed it, but anyway:
>
> > > how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Input field read only

2007-11-30 Thread Christopher E. Franklin, Sr.

I just noticed by your code that you are using 1.1 of cake.  Dunno
what changes have been made since I have been in that branch but, the
array('disabled' => true); works in 1.2...
Sorry I didn't notice sooner

On Nov 30, 10:48 am, Brian <[EMAIL PROTECTED]> wrote:
> I just noticed that none of the parameters being passed in the array
> are being used? What would cause that?
>
> On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote:
>
> > >  this doesn't work either:
>
> > >  inputTag('Employee/start_date', array('size' => '4
> > > 0', 'disabled' => true)) ?>
>
> > Have you thought about using a hidden field and simply displaying the data?
>
> > --
> > Chris Hartjes
>
> > My motto for 2007:  "Just build it, damnit!"
>
> > @TheKeyboard -http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Input field read only

2007-11-30 Thread Christopher E. Franklin, Sr.

'disabled' => true (without the single quotes)

On Nov 30, 9:30 am, Brian <[EMAIL PROTECTED]> wrote:
> How do I get an input field to be readonly?
>
> I have tried
>  inputTag('Employee/start_date', array('size' => '4
> 0', 'READONLY' => 'readonly')) ?>
> and
>  inputTag('Employee/start_date', array('size' => '4
> 0', 'disabled' => 'true')) ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Christopher E. Franklin, Sr.

It is in the helpers section of the manual ;)

On Nov 30, 8:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
> Sorry to ask such a newbie question, but i didnt find anything about
> it in the manual. Maybe i missed it, but anyway:
>
> how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: can't upload

2007-11-30 Thread Christopher E. Franklin, Sr.

Well, I guess my first question would be, are you using a browse
control to browse for the image on your comp or is it already on the
hard drive of the server some where?

Second, can you post the upload function as well?

On Nov 30, 8:34 am, Dilbert <[EMAIL PROTECTED]> wrote:
> I have an article model with an image field(I don't want to create
> another model).
> This is the code for admin_add
>
> function admin_add() {
> if (!empty($this->data)) {
> $this->cleanUpFields();
> $this->Article->create();
> if ($this->Article->save($this->data)) {
> if (!empty($this->data['Article']['image']))
> {
> $fileup=$this->data['Article']['image'];
> $this->Upload->upload('$fileup','../webroot/img/
> uploads/');
>  }
> $this->Session->setFlash('Article
> saved');
> $this->redirect(array('action'=>'index'), null, true);*/
>
> } else {
> $this->Session->setFlash('Article not saved');
> }
> }
> }
>
> The folder uploads is 777.
> Where is the problem?
> Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search box

2007-11-30 Thread Christopher E. Franklin, Sr.

I have always had favorable results making a searches_controller model
and view.  This way, if you want to search for different things, say,
search the website, search the documentation, search the code, then it
scales very well because all your searches are pointed at one
controller.  This makes it very scalable for me.  I can have advanced
search page, search boxes etc. Plus you get to use the highlighter and
if you are using mysql, you can make it return the search ranking so
you can replace it with stars (or sprinkles if you prefer).

On Nov 30, 9:47 am, José Pablo Orozco Marín <[EMAIL PROTECTED]>
wrote:
> Cool! im a newbee too :)
>
> sendami escribió:
>
>
>
> > I'm using cake 1.1.  Are there big differences between 1.1 and 1.2?
> > I'm totally a newbee. I just started cake two weeks ago.
> > I recognized that many people are using cake 1.2.
> > I'll try the version and your code.
> > Anyway, thank you very much for your reply.
>
> > On Nov 29, 7:50 pm, José Pablo Orozco Marín <[EMAIL PROTECTED]>
> > wrote:
>
> >> Which version of cakephp are you using?
> >> Normally for me works the following 3 lines of code using cakephp 1.2
>
> >>  uses('sanitize');
> >>  $sanitize = new Sanitize();
> >>  $this->cleanData = $sanitize->clean( $this->data );
>
> >> sendami escribió:
>
> >>> I got an error message like below.
>
> >>> Fatal error: Call to undefined method Sanitize::clean() in C:\AppServ
> >>> \www\app\controllers\cms_categories_controller.php on line 18
>
> >>> ant the line 18 is below.
>
> >>>  $this->cleanData = $sanitize->clean( $this->data );
>
> >>> What I have to do?
>
> >>> On Nov 27, 5:26 pm, Josoroma <[EMAIL PROTECTED]> wrote:
>
>  I clean a little bit the code :)
>  This works for me, but my question is:
>  Where do i have toi clean the data for thissearch, here in the
>  controller or inside the model?
>
>  function index() {
>
>  $this->Benchlink->recursive = 0;
>
>  uses('sanitize');
>  $sanitize = new Sanitize();
>
>  $this->set('findUrlNotCleaned', 
>  trim($this->data['formFind']
>  ['find']) );
>
>  $this->cleanData = $sanitize->clean( $this->data );
>
>  $findUrl = low( 
>  trim($this->cleanData['formFind']['find']) );
>
>  if ( $findUrl != '' ) {
>
>  $this->set('benchlinks', 
>  $this->paginate('Benchlink',
>  array("LOWER(`Benchlink`.`url`) LIKE '%" . $findUrl . "%'")));
>
>  } else {
>
>  $this->set('benchlinks', $this->paginate());
>
>  }
>
>  }
>
> >> --
>
> >> -
>
> >> José Pablo Orozco Marín
> >> [EMAIL PROTECTED]
>
> >> Tel. +506 820-7280
>
> >> Por favor, visite mi pasión:http://www.SukiaLogic.com/-Hide quoted text -
>
> >> - Show quoted text -
>
> --
>
> -
>
> José Pablo Orozco Marín
> [EMAIL PROTECTED]
>
> Tel. +506 820-7280
>
> Por favor, visite mi pasión:http://www.SukiaLogic.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: a lot of the features that make rails so cool are totally missing in cake :(

2007-11-28 Thread Christopher E. Franklin, Sr.

>The developers are people and you will get a lot
> further if you treat them that way.

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



Re: How do I access variables set in App Controller in View?

2007-11-28 Thread Christopher E. Franklin, Sr.

In the app_controller.php you must either do var $uses =
array('User'); or in the beforeRender() do an App::import('Model',
'User');

On Nov 28, 3:35 pm, skoggins <[EMAIL PROTECTED]> wrote:
> Thanks!  beforeRender works but now I get this error:
>
> Notice: Undefined property: AppController::$User in C:\accounts
> \placeholder\app\app_controller.php on line 48
>
> Fatal error: Call to a member function findById() on a non-object in C:
> \accounts\placeholder\app\app_controller.php on line 48
>
> Any ideas why?
>
> On Nov 26, 5:54 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > beforeRender is usually better for that stuff than beforeFilter
> > because its possible that you are overwriting user somewhere in you
> > controllers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Am I trying to do the impossible (or impractical)?

2007-11-28 Thread Christopher E. Franklin, Sr.

Well, if you already have the default_address_id field in the table,
you can just do some array magic to pull out the one with that Id or,
you can make another call once you have the user array (for a single
user).

Your best bet is to use the array magic goodness with sprinkles and
pluck out what you need.

On Nov 28, 3:02 pm, FrenchEscapes <[EMAIL PROTECTED]> wrote:
> I have a customers table and an addresses table, customers hasMany
> addresses, that bit's easy.
>
> But I want each customer to have a default address in the addresses
> table. I have a field 'default_address_id' in the customer table. I
> just can't get my head around how to use associations to link them.
>
> Thank you in advance.
>
> Duncan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Okay, that worked.  Removed the whole cake folder and dropped in the
new nightly and it recognizes them now.  Thanks for the help

On Nov 28, 12:14 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> I think I see a problem. When I grabbed the latest source, I pasted
> into the cake folder instead of deleting the cake folder.  So, I have
> left over app_controllers and stuff in the cake root dir. In the new
> sources, app_controller moved to the cake/libs/controllers directory.
> Will delete and paste a new source into there and see what happens.
>
> Just hate doing that because the SVN code then says that the new cake
> folders are blockers and I have to fix all of the svn again.
>
> On Nov 28, 11:06 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Nov 28, 6:52 pm, "Christopher E. Franklin, Sr."
>
> > <[EMAIL PROTECTED]> wrote:
> > > Doesn't work for me =/  Talking to Gwoo on IRC, dunno if he is hunting
> > > anything down or not.
>
> > I bet if you delete the files in your cache/persistent folder it
> > starts working.
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Didn't work, I deleted the entire cake folder, dropped in the latest
nightly and still won't work for me, I cleaned out the tmp again.

On Nov 28, 12:14 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> I think I see a problem. When I grabbed the latest source, I pasted
> into the cake folder instead of deleting the cake folder.  So, I have
> left over app_controllers and stuff in the cake root dir. In the new
> sources, app_controller moved to the cake/libs/controllers directory.
> Will delete and paste a new source into there and see what happens.
>
> Just hate doing that because the SVN code then says that the new cake
> folders are blockers and I have to fix all of the svn again.
>
> On Nov 28, 11:06 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Nov 28, 6:52 pm, "Christopher E. Franklin, Sr."
>
> > <[EMAIL PROTECTED]> wrote:
> > > Doesn't work for me =/  Talking to Gwoo on IRC, dunno if he is hunting
> > > anything down or not.
>
> > I bet if you delete the files in your cache/persistent folder it
> > starts working.
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

I think I see a problem. When I grabbed the latest source, I pasted
into the cake folder instead of deleting the cake folder.  So, I have
left over app_controllers and stuff in the cake root dir. In the new
sources, app_controller moved to the cake/libs/controllers directory.
Will delete and paste a new source into there and see what happens.

Just hate doing that because the SVN code then says that the new cake
folders are blockers and I have to fix all of the svn again.

On Nov 28, 11:06 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Nov 28, 6:52 pm, "Christopher E. Franklin, Sr."
>
> <[EMAIL PROTECTED]> wrote:
> > Doesn't work for me =/  Talking to Gwoo on IRC, dunno if he is hunting
> > anything down or not.
>
> I bet if you delete the files in your cache/persistent folder it
> starts working.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Didn't work.  I got rid of all files in the tmp/cache directories,
cleared the browser cache, cleared the sessions in the db, restarted
my comp and the server, reopened the browser and na-da.

On Nov 28, 11:06 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Nov 28, 6:52 pm, "Christopher E. Franklin, Sr."
>
> <[EMAIL PROTECTED]> wrote:
> > Doesn't work for me =/  Talking to Gwoo on IRC, dunno if he is hunting
> > anything down or not.
>
> I bet if you delete the files in your cache/persistent folder it
> starts working.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Doesn't work for me =/  Talking to Gwoo on IRC, dunno if he is hunting
anything down or not.

On Nov 28, 9:27 am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> Well, the folder name has no influence on the url. If you have for
> example a BannersController with an index function in a folder named
> "hello", then you still call it like yourdomain.com/banners. Folders
> are only there for organizational purposes.
>
> HTH
>
> --
> Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Yet another typo, I hate that I cannot edit posts! argh!
> function.  For giggles, I tried browsing tohttp://localhost/banner/banners/.
> I received the error that I needed to create a controller named Banner/
> BannersController <--exactly.

This was not the error, I get confused, cake tells me to make a
BannerController (my bad)

On Nov 28, 9:10 am, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> Sorry.
>
> I made the folder controllers/banners/ and added the controller
> controllers/banner/banners_controller.php and added an index
> function.  For giggles, I tried browsing tohttp://localhost/banner/banners/.
> I received the error that I needed to create a controller named Banner/
> BannersController <--exactly.
>
> So, I tried just with the controller,http://localhost/banners/and it
> said I needed to make a BannersController.
>
> So, I triedhttp://localhost/banner.bannersand it said I needed to
> create a controller named Banner.bannersController.
>
> So, I tried adding a route with Router::connect('/banners',
> array('controller' => 'banner/banners', 'action' => 'index')); which
> returned create a controller named Banner/BannersController
>
> So, I tried changing the route to Router::connect('/banners',
> array('controller' => 'banner.banners', 'action' => 'index')); which
> returned create a controller named Banner.bannersController
>
> I also tried all manner of capital B's.
>
> But, change set 6001 says I can now have controllers in sub-folders...
>
> On Nov 28, 8:53 am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
>
> > Hi Christopher,
>
> > What doesn't work? What did you try?
>
> > --
> > Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controllers/Sub-Folder/Controller not working

2007-11-28 Thread Christopher E. Franklin, Sr.

Oops, the folder is singular /controllers/banner/

There is not other controller anywhere named banner or banners

On Nov 28, 9:10 am, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> Sorry.
>
> I made the folder controllers/banners/ and added the controller
> controllers/banner/banners_controller.php and added an index
> function.  For giggles, I tried browsing tohttp://localhost/banner/banners/.
> I received the error that I needed to create a controller named Banner/
> BannersController <--exactly.
>
> So, I tried just with the controller,http://localhost/banners/and it
> said I needed to make a BannersController.
>
> So, I triedhttp://localhost/banner.bannersand it said I needed to
> create a controller named Banner.bannersController.
>
> So, I tried adding a route with Router::connect('/banners',
> array('controller' => 'banner/banners', 'action' => 'index')); which
> returned create a controller named Banner/BannersController
>
> So, I tried changing the route to Router::connect('/banners',
> array('controller' => 'banner.banners', 'action' => 'index')); which
> returned create a controller named Banner.bannersController
>
> I also tried all manner of capital B's.
>
> But, change set 6001 says I can now have controllers in sub-folders...
>
> On Nov 28, 8:53 am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
>
> > Hi Christopher,
>
> > What doesn't work? What did you try?
>
> > --
> > Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   3   >