Re: Poll: what do you hate about CakePHP?

2009-05-20 Thread GreyCells

> The reason is primarily that link URLs
> would be lost

I currently use html2text by Jon Abernathy, which retains links as
footnotes.

> it's possible to
> send an HTML-only email. That's really bad form

100% agree - which is why Cake should default to best practice by
automatically creating a text version (if text template is undefined).
If you're creating a plain text email, you probably don't want/need an
html version.

On May 19, 8:13 pm, brian  wrote:
> On Tue, May 19, 2009 at 12:21 PM, GreyCells  
> wrote:
>
> > 4. Having to provide text and html bodies for email. (Should be able
> > to create html mail and have Cake write the text version
> > automatically).
>
> I disagree with this. I prefer to create 2 versions of the content and
> echo each variable in its view. The reason is primarily that link URLs
> would be lost if the content is simply run through strip_tags() for
> the plaintext version. What I do is run it through a RegExp to append
> the URL in brackets after the word(s) that would have had the link. I
> also like to add in newlines where certain headers are so everything
> isn't jumbled together. And then there's the question of layouts,
> which will generally be very different.
>
> One big annoyance I see in Email, though, is that it's possible to
> send an HTML-only email. That's really bad form, IMHO. Obviously, this
> isn't a frustration I'm *subjected to* but I don't think the Cake devs
> should be encouraging HTML-only email. My SwiftMailer component (much
> modified from a very old one found at Bakery) defaults to text and
> creates an HTML version in addition to the plaintext if requested.
--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-19 Thread GreyCells

Not so much hates, but frustrations when coding new apps (I'm sure
you've heard them all before, Nate:)

1. Auth, Session and Email should all be fat models with a thin
component interface if required.

2. More callbacks in Auth, Session and Email to allow logging + App
specific behaviour. (via App[Auth|Session|Email])

3. Http Basic/Digest Auth should be in Auth, not Security, so acl etc
can be shared easily.

4. Having to provide text and html bodies for email. (Should be able
to create html mail and have Cake write the text version
automatically).

5. Me, not be disciplined enough with my time to contribute back
fully...
--~--~-~--~~~---~--~~
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: Perfomance in CakePHP

2009-04-28 Thread GreyCells

Hi Keyur

You need to define define 'big application' -  Number of tables, rows,
users, connections (bandwidth) or all of the above?

For large numbers of tables, Containable is your friend. For the
others, Cake is unlikely to be your primary cause of concern. Good
database design and a replication strategy would be great places to
start.

Apologies, I can't remember who's sig it is, but the best advice I've
heard on the topic is: "Just build it, damnit!"

~GreyCells

On Apr 28, 12:06 pm, keyurvaghani  wrote:
> Hello folks,
> Can anybody please let me know what should be taken care for better
> perfomance for site becuase it seems for developing large application
> there might perfomance issue arise with cake 1.2.  As i m going to
> develop big application in and i m really wanted to know more
> regarding perfomance for working with cake.
>
> Likewise somewhere i have read that it not to use $uses instead of use
> model chain or loadmodel() if it requre. so i m seeking more and more
> tips.
>
> Thanks a lot in adavance !
>
> Best regards
> Keyur
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Apache segmentation fault on r7597

2008-09-18 Thread GreyCells

I'm experiencing a segmentation fault on Apache2 (LAMP) for r7597, but
only if debug is set to 0. r7596 is fine. I've checked all file
permissions that I can think of. I /think/ it's something to do with
the require'd (rather than uses(...)) files being require'd more than
once but I can't see anything in the changeset that would be altered
by debug = 0...

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



Re: TIP :: checkUnique on Update solution

2008-01-25 Thread GreyCells

For 1.2 this functionality exists in Model->isUnique() and was updated
to deal with updates.

See http://api.cakephp.org/1.2/class_model.html#e631f2cba7ec7fff079d3a7b62c46f0e

and https://trac.cakephp.org/ticket/2032

~GreyCells

On Jan 25, 7:17 pm, Josoroma <[EMAIL PROTECTED]> wrote:
> I started to have problems when i was trying to checkDuplicate entries
> of fields in my models validations. I used on = create to check the
> unique value only in the creation but i need to check it in the update
> too. The problem with update is that the value already exist then your
> validation sucks.
>
> My solution to this problem is:http://cakephp.pastebin.com/f7a7a9894
>
> Any help, comment or improvement is welcome.
>
> Thanks in advance.
--~--~-~--~~~---~--~~
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: Propagating validationErrors from Behavior to View

2008-01-25 Thread GreyCells

Hi grigri

The way I thought of is assign any Behaviour validationErrors to a
controller instance of that particular model (via a model-
>getBehaviourErrors() method) - but it sorta defeats the idea of
having a behaviour acting at the model level... hence the question -
the implementation seems a bit kludgy, even though the two-model
concept 'feels' right.

~GreyCells

On Jan 25, 12:47 pm, grigri <[EMAIL PROTECTED]> wrote:
> Controller, Model, View and Helper all have a class variable called
> 'validationErrors';
>
> When Model::invalidFields() is called (e.g. from Model::save()), the
> model's $validationErrors is set.
> This array is field-keyed, like `array( 'title' => ..., 'description'
> => ...)
>
> When the controller goes to render, it constructs the view and then
> (for each model it knows) passes that model's
> $validationErrors to the View in a modelname-keyed array, so $View-
>
> >validationErrors looks like
>
> array(
>   'Ham' => array('title' => ..., 'description' => ...),
>   'Eggs' => array('foo' => ..., 'bar' => ...)
> )
>
> Then the View passes this array on to each of the helpers it loads.
>
> So, from within the Behavior, the only object you have access to is
> the parent model. You cannot directly influence the view (it doesn't
> exist yet) or the controller (that would be terrible MVC).
>
> Your best bet would be to set the model's validationErrors array, with
> a prefixed key (like $Model->invalidate('attachment_' . $fieldName,
> '...'). This will then get propagated to the view and then the
> helpers.
>
> You'd then be able to access this directly in the view by using $form-
>
> >error('Model.attachment_whatever');
>
> On Jan 25, 12:14 pm, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > I have a model that has a behavior.
>
> > e.g. Post var $actsAs = array('Attachment');
>
> > When the Post model is saved, the behaviour->beforeSave callback is
> > fired to save or update the Attachment model.
>
> > My question is: How do I cleanly propagate any errors raised by the
> > Attachment model back to the View/form? I know I need to populate the
> > View->validationErrors, but I don't want to interfere with the
> > automagic error handling of the primary model.
>
> > ~GreyCells
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Propagating validationErrors from Behavior to View

2008-01-25 Thread GreyCells

I have a model that has a behavior.

e.g. Post var $actsAs = array('Attachment');

When the Post model is saved, the behaviour->beforeSave callback is
fired to save or update the Attachment model.

My question is: How do I cleanly propagate any errors raised by the
Attachment model back to the View/form? I know I need to populate the
View->validationErrors, but I don't want to interfere with the
automagic error handling of the primary model.

~GreyCells


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



$View->renderLayout and $scripts_for_layout

2007-10-02 Thread GreyCells

I have a component that uses $View->renderLayout() in a similar
fashion to the EmailComponent->__renderTemplates() function.

However, whenever I create a new view instance ( $View =& new
View($this->Controller); ) in my component, any css or javascript in
$scripts_for_layout does not get included when the browser page is
rendered - even if they are added afterwards. This may be because the
component's view gets registered in the ClassRegistry as 'view' in
it's constructor.

The only workaround I can find is the call
ClassRegistry::removeObject('view'); after I have finished with the
view instance in my component. Cake will then automatically create a
new view instance for the browser rendering...

When I get chance, I'll try to test the EmailComponent, but would be
interested in the views (pardon the pun) of anyone who has experienced
this and has found a different workaround.

~GreyCells


--~--~-~--~~~---~--~~
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: About cakephp's performance

2007-07-11 Thread GreyCells

Just to add my  0.01 (~$0.02 these days).

If you're using mysql, I find the following additions to my.conf
invaluable:

log_slow_queries= /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

Also, don't forget, the sql optimizer will change it's path as your
data grows - just because it's not using an index on your dev data
does not mean it will not on your prod data. In other words, make sure
your volume test data reflects the distribution and cardinality of
records in your prod data.

~GreyCells

On Jul 11, 8:35 am, Marcus <[EMAIL PROTECTED]> wrote:
> On 11 Jul., 00:49, Langdon Stevenson <[EMAIL PROTECTED]> wrote:
>
> > My approach: make it work, then make it fast.
>
> Right!
>
> You can get an impressive performance gain for your CakePHP
> application with:
>
> - setting DEBUG to 0
> - activating persistent models in your AppController (especially when
> you have lots of models with many associations)
> - using CakePHP's Cache class for model data (Memcache!)
> - using view caching
>
> When your application hit your machine's limits, you should:
>
> - look for needless queries (use the Model->expects() method -- it
> saves you a lot of database load! (http://bakery.cakephp.org/articles/
> view/an-improvement-to-unbindmodel-on-model-side))
> - look at every query against the database an check if it's using the
> right indexes etc. MySQL has a lot of possibilities to speed up
> queries (with a factor of 10 to 1 or even more)
> - look for needless use of $this->log() in your code - it can have an
> impact to the performance of your app
> - other optimizations, e. g. denormalization of data
>
> If you still reach the limits of your machine: Congratulations, you've
> built a very successful web app! Now it's time for scaling up ...
>
> Marcus


--~--~-~--~~~---~--~~
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: Generating unique TokenFields for SecurityComponent

2007-07-10 Thread GreyCells

Well, I'm not going to trac it, 'cos it appears to have 'gone away' -
I've just svn'd from r5417 to r5436, but I can't see anything in the
timeline relating to this. Not sure it was me either - been writing
jQuery plugins all morning, so don't think I've changed anything
significant. If it comes back as I apply security to other pages, I'll
dig a bit deeper.

The magic of cake casts it's spell on me again :)

~GreyCells


On Jul 10, 1:38 pm, GreyCells <[EMAIL PROTECTED]> wrote:
> I appear yo be able to submit all forms in various combinations (i.e.
> 3 forms on a page, two to one controller, the other to another) - its
> just a validation thing I think. All controllers for the page must
> have the SecurityComponent.
>
> Probably should raise a trac, but I haven't had time to investigate
> all the options yet.
>
> ~GreyCells
>
> On Jul 10, 11:50 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jul 10, 10:53 am, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > > I'm starting to use the SecurityComponent in 1.2 mainly to ensure
> > > integrity of hidden fields and/or additional fields. All works well
> > > but when there is more than one $form->create() per page, the same
> > > value is used for the hidden TokenFieldsnnn id attribute. Although
> > > this workd functionally, it obviously means the document fails
> > > validation.
>
> > > Is this expected behaviour SecurityComponent, or have I missed (yet
> > > another) trick?
>
> > Hi GreyCells,
>
> > Don't think it's deliberate but i noticed that too, and would also
> > like it to not do that :).
>
> > Were you not finding that if using the security component only the
> > first form created (or maybe even neither, don't remember what I
> > found) was possible to submit successfully?
>
> > Cheers,
>
> > AD
>
> > > ~GreyCells


--~--~-~--~~~---~--~~
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: Generating unique TokenFields for SecurityComponent

2007-07-10 Thread GreyCells

I appear yo be able to submit all forms in various combinations (i.e.
3 forms on a page, two to one controller, the other to another) - its
just a validation thing I think. All controllers for the page must
have the SecurityComponent.

Probably should raise a trac, but I haven't had time to investigate
all the options yet.

~GreyCells

On Jul 10, 11:50 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jul 10, 10:53 am, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > I'm starting to use the SecurityComponent in 1.2 mainly to ensure
> > integrity of hidden fields and/or additional fields. All works well
> > but when there is more than one $form->create() per page, the same
> > value is used for the hidden TokenFieldsnnn id attribute. Although
> > this workd functionally, it obviously means the document fails
> > validation.
>
> > Is this expected behaviour SecurityComponent, or have I missed (yet
> > another) trick?
>
> Hi GreyCells,
>
> Don't think it's deliberate but i noticed that too, and would also
> like it to not do that :).
>
> Were you not finding that if using the security component only the
> first form created (or maybe even neither, don't remember what I
> found) was possible to submit successfully?
>
> Cheers,
>
> AD
>
>
>
> > ~GreyCells


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



Generating unique TokenFields for SecurityComponent

2007-07-10 Thread GreyCells

I'm starting to use the SecurityComponent in 1.2 mainly to ensure
integrity of hidden fields and/or additional fields. All works well
but when there is more than one $form->create() per page, the same
value is used for the hidden TokenFieldsnnn id attribute. Although
this workd functionally, it obviously means the document fails
validation.

Is this expected behaviour SecurityComponent, or have I missed (yet
another) trick?

~GreyCells


--~--~-~--~~~---~--~~
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: Flay and Other Markup Translation Tools

2007-07-05 Thread GreyCells

Thanks Geoff

I had considered bbcode but (apparently) our target audience would be
more familiar with a wiki-style markup (thanks Wikipedia:) The bakery
helper is certainly good to know about tho'.

~GreyCells

On Jul 5, 12:25 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
> BBCode is a well known alternative, this is from a recent thread
>
> 
> Here is the Bakery's implementation as a helper 
> :-https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/bakery/views/h...
>
> Basically in the view you call $bbcode->format($this->data['ModelName']
>
> ['bbcode']);
> 
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Jul 5, 3:42 am, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > I'm investigating 'markup translation tools' to allow untrusted users
> > to create content -Flayseems an obvious choice, but I cannot seem to
> > find any documentation on it - just four article in this group, one of
> > which casts doubt on it's longevity.
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/2c8d5d9c...
>
> > I haven't yet found the trac reference at the end of that thread.
>
> > If it's around for the long haul, I'd like to get my hands on some
> > docs and put together an article for the bakery.
>
> > Textile is another obvious choice, but by default allows raw html (and
> > my implementation/fix for that feels like a bit of a kludge).
>
> > So... any recommendations for implementing a clean cake-ish solution
> > for allowing untrusted users to enter content?
>
> > Many thanks
>
> > ~GreyCells


--~--~-~--~~~---~--~~
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: Render view without layout

2007-07-04 Thread GreyCells

I'd suggest you create an element containing the common markup from
the first page and call $this->renderElement('my/element') from both
pages.

There may be other solutions, but this worksforme.


On Jul 4, 5:07 pm, Contrid <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> Within my current view, I want to include another view.
> I tried using :
>
>  render('view_name'); ?>
>
> ...but it renders the entire layout.
> I just want the content inside of the view file.
>
> How can I accomplish this?
> Thank you for your help.


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



Flay and Other Markup Translation Tools

2007-07-04 Thread GreyCells

I'm investigating 'markup translation tools' to allow untrusted users
to create content - Flay seems an obvious choice, but I cannot seem to
find any documentation on it - just four article in this group, one of
which casts doubt on it's longevity.

http://groups.google.com/group/cake-php/browse_thread/thread/2c8d5d9c83901436/dec610597fdf9bda?lnk=gst&q=flay&rnum=1#dec610597fdf9bda

I haven't yet found the trac reference at the end of that thread.

If it's around for the long haul, I'd like to get my hands on some
docs and put together an article for the bakery.

Textile is another obvious choice, but by default allows raw html (and
my implementation/fix for that feels like a bit of a kludge).

So... any recommendations for implementing a clean cake-ish solution
for allowing untrusted users to enter content?

Many thanks

~GreyCells


--~--~-~--~~~---~--~~
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: My view cache do not work?

2007-07-04 Thread GreyCells

The article linked above is spot on. Caching views is really a
misnomer - it's the *data* used by the views that usually needs
caching, and that should be handled by the controller (the place where
all  the business logic is implemented). As usual, cake is heading in
the right direction with it's multiple cache engines - I've only used
the file cache engine so far and it does exactly what it says on the
tin. If you /really/ want to cache views, then transform the data
before caching it.

~GreyCells



On Jul 4, 12:31 pm, Fordnox <[EMAIL PROTECTED]> wrote:
> cache works using this 
> articlehttp://jirikupiainen.com/2007/05/21/cakephp-cache/
> , but still, is it the same cahe ? DB queries cahe and views cache ?
>
> On Jul 4, 1:54 pm, Fordnox <[EMAIL PROTECTED]> wrote:
>
> > I have the same problem as hi and hello, but setting debug to 0,
> > doesnt help.
> > what i'm missing here ?
> > cakephp 1.2.0.5146alpha
>
> > On Jul 4, 1:09 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > > Caching only works when DEBUG is set to 0
>
> > > Geoff
> > > --http://lemoncake.wordpress.com
>
> > > On Jul 4, 7:07 pm, hi and hello <[EMAIL PROTECTED]> wrote:
>
> > > >   At core.php I have:
> > > > define('CACHE_CHECK', true);
>
> > > >   At the controller file I have:
> > > > var $helpers = array('Html', 'Form', 'Javascript', 'Ajax',
> > > > 'Cache' );
> > > > var $cacheAction = true;
>
> > > >  But when I visit the url to call the controller I found theview
> > > >cachedoesnot work and in the app/tmp/cache/views directory there is
> > > > nothing.
>
> > > >Is something wrong?


--~--~-~--~~~---~--~~
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: thread created count for cakephp sites

2007-05-02 Thread GreyCells

Hmmm. I thought the article answered the question 'why do I have so
many Threads_created?' perfectly - and how to fix it (if indeed, it
needs fixing), because Threads_created has nothing to do with cake
hanging on to connections (or not).

Threads_created is the number of times mysql has had to create a new
connection/thread since the server was started - if your Uptime is
high, this can be a very large number. It is *not* the number of
currently active threads. Restart mysql and it'll drop to single
figures (as will Uptime).

You only have 5 connections cached, 3 of which are idle (connected)
and two are in use (running). If you are concerned about the
Threads_created then the above article will demonstrate how to 'fix'
it.

I cannot see anything that suggests there is an issue with cake (or
php, or mysql) hanging on to connections. Now if you had
'Threads_running   1098' on a small site...

~GreyCells

@Chris It appears connections are not always closed at end of script:
http://uk2.php.net/mysql_connect (top comment) :) but cake seems to
behave impecably.


On May 2, 1:56 pm, redhex <[EMAIL PROTECTED]> wrote:
> GaryCells:
> My questions was not to know about what those number means or to know
> more about mysql status. This is a cakephp forum and hence I am asking
> does cakephp closes connections when the script dies.
>
> So any other takers?
> Question again:
>
> Does cakephp close all connection when the script finish running?
> Current I am using mysql_connect.
>
> Post your http://www.ablewise.com/";>Free Classifieds at
> Ablewise.com
>
> On May 2, 4:09 pm, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > Google is your friend:
>
> >http://www.google.co.uk/search?q=mysql+threads_created
>
> > First hit:
>
> >http://jeremy.zawodny.com/blog/archives/000173.html
>
> > ...might help.
>
> > ~GreyCells
>
> > On May 2, 7:21 am, redhex <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
> > > I am doing monitoring for my site which is cake based and found the
> > > following:
>
> > > mysql "show global status"
>
> > > [158] Threads_cached 5
> > > [159] Threads_connected 3
> > > [160] Threads_created   1098
> > > [161] Threads_running   2
>
> > > I am concern with the threads_created count. I guess it is a little on
> > > the high side.
> > > I am requesting my host to increase the thread_cache_size value at the
> > > meantime from 8 to 32.
>
> > > My question here is this:
> > > Does cakephp close all connection when the script finish running?
> > > Current I am using mysql_connect.
>
> > > My mysql queries are done via the model interface. i.e. $this-
>
> > > >modelname->query( );
>
> > > All input and comments are welcomed.


--~--~-~--~~~---~--~~
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: thread created count for cakephp sites

2007-05-02 Thread GreyCells

Google is your friend:

http://www.google.co.uk/search?q=mysql+threads_created

First hit:

http://jeremy.zawodny.com/blog/archives/000173.html

...might help.

~GreyCells


On May 2, 7:21 am, redhex <[EMAIL PROTECTED]> wrote:
> Hi all,
> I am doing monitoring for my site which is cake based and found the
> following:
>
> mysql "show global status"
>
> [158] Threads_cached 5
> [159] Threads_connected 3
> [160] Threads_created   1098
> [161] Threads_running   2
>
> I am concern with the threads_created count. I guess it is a little on
> the high side.
> I am requesting my host to increase the thread_cache_size value at the
> meantime from 8 to 32.
>
> My question here is this:
> Does cakephp close all connection when the script finish running?
> Current I am using mysql_connect.
>
> My mysql queries are done via the model interface. i.e. $this-
>
> >modelname->query( );
>
> All input and comments are welcomed.


--~--~-~--~~~---~--~~
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: Saving empty fields to the DB.

2007-04-20 Thread GreyCells

$this->Person->set('name', null); before saving.

~GreyCells

On Apr 20, 8:25 pm, Leandro Lucarella <[EMAIL PROTECTED]> wrote:
> Hi! I'm having a problem when editing data. Let's say I have a persons
> table, with id and name columns. I create a new row (id, 'Peter') using a
> form, all great there. Then I edit the row, erasing the form field for
> 'name'.
>
> My controller's $this->data looks like this:
> array(1) {
>   ["Person"]=>
> array(22) {
> ["id"]=>
> string(1) "1"
> ["name"]=>
> string(0) ""
> }
>
> }
>
> When I do the $this->Person->save($this->data), it works (returns true)
> but the field in the DB stills say 'Peter'. It looks like save() ignores
> the empty fields.
>
> Is there a way to avoid this? I want the name to be empty. I'm doing
> something wrong?
>
> CakePHP 1.1.x ($Id: VERSION.txt 4450 2007-02-05 05:18:05Z phpnut $)
>
> PS: Please Cc me. Thanks!
>
> --
> LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
> 
> E-Mail / JID: [EMAIL PROTECTED]
> GPG Fingerprint:  D9E1 4545 0F4B 7928 E82C  375D 4B02 0FE0 B08B 4FB2
> GPG Key:  gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
> 
> Home, home again.
> I like to be here when I can.
> When I come home cold and tired
> It's good to warm my bones beside the fire.


--~--~-~--~~~---~--~~
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: Manual invalidate in 1.2

2007-04-19 Thread GreyCells

Rather than fighting the framework, why not use two non database
fields in your form - new_passwd and confirm_passwd. Validate these
fields if they are set in validates() - raising validation errors
($this->invalidate('new_passwd', 'error_msg'))  if they don't match/
too short/weak etc. Then (again) if new_passwd and confirm_passwd
fields are not empty, set the database passwd field to your hash in
beforeSave().

~GreyCells

On Apr 19, 9:31 pm, hepper <[EMAIL PROTECTED]> wrote:
> If some could explain hove to invalidate a field manual in the
> controller in 1.2.
> In 1.1 you could invalidate a field and then call save without
> parameters, then set wouldn't be called and the invalidated fields
> didn't get erased as nate explains 
> herehttp://groups.google.com/group/cake-php/browse_thread/thread/354a677b...
> But in 1.2 it changed so set() always will be called.
>
> I'm trying to create a user register action and if password =
> password2 then password will be transformed to a md5 hash.
> If the user name already registered then the password should be reset
> to the unhashed saved in a temp var.
>
> I know that I could invalidate in the beforeValidate() callback but I
> can't change the data back there (I think at least)
>
> Thankful for the help


--~--~-~--~~~---~--~~
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: allowEmpty in validate

2007-04-19 Thread GreyCells

This makes it nice an easy to filter (i.e. remove) empty fields Nate,
but it would be great to see Cake help developers maintain proper
database state. i.e.:

- change #2092 from allowBlank to allowNull

- in save() set any empty (as in they are set to an empty string)
fields to null, so the database column is set to NULL

I know this can all be done manually with regexp and beforeSave() -
but it really should be default behaviour.

Sorry if that sounds a bit rantish - but empty strings vs null (and
the lack of understanding thereof) cause me sooo many problems on
clients' legacy databases...

~GreyCells (aka TheDatabasePedant)

On Apr 18, 11:59 pm, nate <[EMAIL PROTECTED]> wrote:
> As of 1.2 current SVN:
>
> function beforeValidate() {
>$this->data[$this->name] = Set::filter($this->data[$this->name],
> true);
>return true;
>
> }
>
> Works for me.
>
> On Apr 18, 5:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Wow did you pick an ambiguous name for that then. Holy misleading
> > batman.
>
> > So how the heck do I do what I want to do? I can't help but think
> > enhancement/bug # 2092 is a "must have". I can't even think of a
> > workaround at the moment.
>
> > On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > > It technically means "allowNotPresent" as in "not present in the array
> > > of data to be saved", but I felt that was too cumbersome.
>
> > > rtconner wrote:
> > > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > > alowEmpty should be in the validate array in a model?
>
> > > > You would think it would set the behavior to allow you to submit an
> > > > empty string that passes validation. For example, you may either pass
> > > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > > not count as a phone number, but the phone number is not a required
> > > > field also.
>
> > > > ..but this is not the behavior I am seeing. As far as I can tell
> > > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > > the code in model and yes the code does not implement this behavior
> > > > either. I'm trying to determine if this is a bug or not.
>
> > > > So... how should allowEmpty cause things to behave?


--~--~-~--~~~---~--~~
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: allowEmpty in validate

2007-04-19 Thread GreyCells

You should care about empty strings. An empty string is not null, so
SELECT ... WHERE col IS NULL; will return a different record set to
SELECT ... WHERE col = ''; It will also effectively invalidates any
NOT NULL constraints on your database - an empty string is not null.

~GreyCells

On Apr 18, 11:13 pm, rtconner <[EMAIL PROTECTED]> wrote:
> Good call GreyCells. Thanks.
>
> I dont care if DB has NULL or an empty string. So that will work in
> this situation.
> Still would like to see bug 2092 implemented though.
>
> On Apr 18, 3:43 pm, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > A possible workaround is to unset any empty fields in
> > beforeValidates() - validate will then ignore them if allowBlank is
> > set.
>
> > However, there is a conflict if you're also using beforeValidates() to
> > set blank fields to null (so they are null rather than an empty string
> > in the database) - depends if you're a pedantic db developer or not :)
>
> > ~GreyCells.
>
> > On Apr 18, 10:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > Wow did you pick an ambiguous name for that then. Holy misleading
> > > batman.
>
> > > So how the heck do I do what I want to do? I can't help but think
> > > enhancement/bug # 2092 is a "must have". I can't even think of a
> > > workaround at the moment.
>
> > > On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > > > It technically means "allowNotPresent" as in "not present in the array
> > > > of data to be saved", but I felt that was too cumbersome.
>
> > > > rtconner wrote:
> > > > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > > > alowEmpty should be in the validate array in a model?
>
> > > > > You would think it would set the behavior to allow you to submit an
> > > > > empty string that passes validation. For example, you may either pass
> > > > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > > > not count as a phone number, but the phone number is not a required
> > > > > field also.
>
> > > > > ..but this is not the behavior I am seeing. As far as I can tell
> > > > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > > > the code in model and yes the code does not implement this behavior
> > > > > either. I'm trying to determine if this is a bug or not.
>
> > > > > So... how should allowEmpty cause things to behave?


--~--~-~--~~~---~--~~
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: allowEmpty in validate

2007-04-18 Thread GreyCells

A possible workaround is to unset any empty fields in
beforeValidates() - validate will then ignore them if allowBlank is
set.

However, there is a conflict if you're also using beforeValidates() to
set blank fields to null (so they are null rather than an empty string
in the database) - depends if you're a pedantic db developer or not :)

~GreyCells.


On Apr 18, 10:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
> Wow did you pick an ambiguous name for that then. Holy misleading
> batman.
>
> So how the heck do I do what I want to do? I can't help but think
> enhancement/bug # 2092 is a "must have". I can't even think of a
> workaround at the moment.
>
> On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > It technically means "allowNotPresent" as in "not present in the array
> > of data to be saved", but I felt that was too cumbersome.
>
> > rtconner wrote:
> > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > alowEmpty should be in the validate array in a model?
>
> > > You would think it would set the behavior to allow you to submit an
> > > empty string that passes validation. For example, you may either pass
> > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > not count as a phone number, but the phone number is not a required
> > > field also.
>
> > > ..but this is not the behavior I am seeing. As far as I can tell
> > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > the code in model and yes the code does not implement this behavior
> > > either. I'm trying to determine if this is a bug or not.
>
> > > So... how should allowEmpty cause things to behave?


--~--~-~--~~~---~--~~
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: composed primary key

2007-04-18 Thread GreyCells

That's far too pragmatic Nate :)

How am I going to earn my fee if you keep coming up with such easy
solutions? Oh wait a minute - I'm not being paid for this one...



On Apr 18, 8:04 pm, nate <[EMAIL PROTECTED]> wrote:
> Actually, I thought of one possible solution for that: move all the
> records to another (temp) table, truncate the table, and add the pre-
> existing records back.  That would reset the ID.
>
> GreyCells wrote:
> > I think you mean compund primary key. See:
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/4a3f44f8...
>
> > Especially Nate's comments. Coincidentally, I had a requirement for
> > one today - but only because mysql can't recycle sequences...
>
> > ~GreyCells
>
> > On Apr 18, 6:14 pm, "John David Anderson (_psychic_)"
> > <[EMAIL PROTECTED]> wrote:
> > > On Apr 18, 2007, at 10:08 AM, christianandradet wrote:
>
> > > > I don't know what to do, how do i define the composed primary key???
>
> > > Why do you need one? Is 'id' not unique?
>
> > > -- John


--~--~-~--~~~---~--~~
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: composed primary key

2007-04-18 Thread GreyCells

I think you mean compund primary key. See:

http://groups.google.com/group/cake-php/browse_thread/thread/4a3f44f8217435cc/255c641339eef6ac?lnk=gst&q=compound+primary+key&rnum=1#255c641339eef6ac

Especially Nate's comments. Coincidentally, I had a requirement for
one today - but only because mysql can't recycle sequences...

~GreyCells

On Apr 18, 6:14 pm, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Apr 18, 2007, at 10:08 AM, christianandradet wrote:
>
> > I don't know what to do, how do i define the composed primary key???
>
> Why do you need one? Is 'id' not unique?
>
> -- John


--~--~-~--~~~---~--~~
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: Your client and cakePHP

2007-04-18 Thread GreyCells

Golden Rule #243: Never let the client touch your code. If they don't
understand why it's 'complicated' they are going to break something.
Then they get to keep both parts.

None of my clients have access to the code base  it's mine,
all mine  but some can update their sites via forms. This is
sooo trivial to implement in Cake. I fact only one client even knows
why it's Cake running the show (they don't really care, but their old
spagetti site broke every time a change was made and I wouldn't take
on the maintenance without a re-write...)

I'd be very nervous allowing a third party to introduce potentially
exploitable code into a production site.

~GreyCells

On Apr 18, 5:55 pm, beetlecube <[EMAIL PROTECTED]> wrote:
> For those who have done PHP development for a client, and used cakePHP
> to build their sites, a question:
>
> Have you received complaints from the client, when they have tried to
> add a page on their own, ? like:
>
> "This cakephp stuff is complicated, and I just want to add another
> page that accesses the database, and I didn't know you have to create
> three different files for it.I can't get a php coder to help me,
> because they don't know cakephp or MVC"
>
> Just curious and thought I'd ask
>
> Steve


--~--~-~--~~~---~--~~
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: Model SubTypes & Database Design

2007-04-18 Thread GreyCells

Hi Laptop

Cake uses the active record model, so by convention, expects  a one to
one relationship between model and table. That said, it is possible
for multiple models to share the same table by specifying the useTable
attribute. If you're developing with 1.2, the actsAs could prove an
alternative to multiple levels of inheritance. (i.e.
OnlineAdvertisement actsAs Advertisement), although I must confess I
have not use actsAs in anger yet...

For models that share mostly the same attributes, a few redundant
columns in your table is a small price compared to the ease of
maintenance and that niggling overhead of an extra join. From the
information you've given, I'd probably treat the Online and/or Print
as attributes of an Advertisement rather than seperate models. This is
a bit like vi vs emacs - despite what many will tell you, there is no
'right way' from a pure design perspective - hence the multitude of
ORM tools/projects out there. Just pick the simplest route first and
refactor if it doesn't work out :)

@gwoo: Are there any technical reasons why PrintAdvertisement cannot
extend Advertisement? (i.e. framework complications rather that app
complications).

~GreyCells

On Apr 18, 4:46 am, gwoo <[EMAIL PROTECTED]> wrote:
> no, they woudl still exend AppModel.
>
> OnlineAdvertisment belongsTo Advertisement
>
> I was thinking of it like User and Profile where the Advertisement is
> like the User and the OnlineAdvertisment holds specifc details about
> the Ad, like a Profile would.


--~--~-~--~~~---~--~~
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: Problem with Model::afterSave() callback

2007-04-17 Thread GreyCells

Davide

Why not just build the path when selecting the record? (afterFind()
will do). You do not have to duplicate the record's id in the path
column.

If you must work around the framework lifecycle, then direct $model-
>execute('UPDATE blah, blah') calls will work.

~GreyCells

On Apr 17, 1:06 pm, "Davide" <[EMAIL PROTECTED]> wrote:
> Davide wrote:
> > ...
> > I'm trying to use the afterSave callback in order to update a field of a
> > just inserted record.
>
> > I have this code[1]. If I didn't comment the saveField() statement, the
> > browser (FireFox) will complain saying[2].
> > ...
>
> Finally after some logging I found what it is. It's a sort of loopback. If
> in afterSave I try to update a field, the lifecycle (before, save, after)
> restart. This until the pages goes to timeout.
>
> So actually it's not possible to update a record in the afterSave
> loopback. In order to solve it, I've moved the saveField() in the
> controller method after the if($this->Model->save()).
>
> Is this a framework bug/feature? Is this an application design mistake?
> With application I mean my application, not the framework. Will make it
> sense to be able to specify for example a parameter to the afterSave
> callback in order to tell to the framework to skip the natuaral save
> lifecycle?
>
> Thanks a lot
> Bye
> Davide


--~--~-~--~~~---~--~~
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: Writing a test case for controller->params (special characters truncate routes)

2007-04-16 Thread GreyCells

After much digging, I'm now able to sort of answer myself, in case
anyone else hits this. I don't think this is a cake issue - which is
why the router/dispatcher tests pass OK. The problem appears to stem
from the .htaccess - the 'url' is derived from the $1 (i.e. everything
after the domain name) which, because it has an '&' in it, gets split
into two elements in the params['url'] - despite the '&' being
encoded.

I thought adding 'NE' to the .htaccess RewriteRule might do the trick,
but no joy. Unless anyone can tell me otherwise, I think this means
'%26' cannot be used in cake urls unless they are in the query string.

~GreyCells

On Apr 16, 8:16 pm, "GreyCells" <[EMAIL PROTECTED]> wrote:
> When using urlencode (or rawurlencode), any keys set up in Routes
> appear to truncate at the first special character.
>
> This is my test case:
>
> Router::connect('/search/:searchName', array('controller' =>
> 'search', 'action' => 'saved'));
> $result = Router::parse('/search/Fred%20%26%20Barney');
> $expected = array('searchName' => 'Fred%20%26%20Barney',
> 'controller' => 'search', 'action' => 'saved', 'plugin' =>'');
> $this->assertEqual($result, $expected);
>
> which passes, but the following appears in $this->params:
>
>     [searchName] => Fred
> [url] => Array
> (
> [url] => search/Fred
> [Barney] =>
> )
>
> I expect the searchName to be 'Fred%20%26%20Barney' and the url to be
> '/search/Fred%20%26%20Barney', but can't work out how to write the
> test case to prove it:)
>
> ~GreyCells


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



Writing a test case for controller->params (special characters truncate routes)

2007-04-16 Thread GreyCells

When using urlencode (or rawurlencode), any keys set up in Routes
appear to truncate at the first special character.

This is my test case:

Router::connect('/search/:searchName', array('controller' =>
'search', 'action' => 'saved'));
$result = Router::parse('/search/Fred%20%26%20Barney');
$expected = array('searchName' => 'Fred%20%26%20Barney',
'controller' => 'search', 'action' => 'saved', 'plugin' =>'');
$this->assertEqual($result, $expected);

which passes, but the following appears in $this->params:

[searchName] => Fred
[url] => Array
(
[url] => search/Fred
[Barney] =>
    )

I expect the searchName to be 'Fred%20%26%20Barney' and the url to be
'/search/Fred%20%26%20Barney', but can't work out how to write the
test case to prove it:)

~GreyCells


--~--~-~--~~~---~--~~
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: routing: custom sitename before EACH controller

2007-04-08 Thread GreyCells

I think this may be what you're looking for:

http://groups.google.com/group/cake-php/browse_thread/thread/71be76876702c64d/268e6000dc8665d5?#268e6000dc8665d5

~GreyCells

On Apr 7, 10:41 pm, "gerbenzomp" <[EMAIL PROTECTED]> wrote:
> I've read the article on routing (http://bakery.cakephp.org/articles/
> view/86) and serached through this group, but couldn't really find an
> answer to this question:
>
> How can I enable users to have their custom sitename, like this:
>
> http://www.site.com/users_custom_sitename/controller/action/
>
> So each user has their own sitename, and ALL controllers and actions
> come after that in the URL.
>
> Is there a way to do this without having to make custom routes for
> every controller and action?


--~--~-~--~~~---~--~~
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 to generateList with more than more value per key?

2007-04-07 Thread GreyCells

http://groups.google.com/group/cake-php/browse_thread/thread/b32341e00a1324bb/916efdf548c20b68?lnk=gst&q=afterfind+fullname&rnum=1#916efdf548c20b68

On Apr 7, 12:43 pm, "zen" <[EMAIL PROTECTED]> wrote:
> Hi, Cake noob here...
>
> I've been searching for a while for this...
> but can't seem to find the solution...
>
> basicly what i'd like to do is to generate an array
> using generateList, then populate a dropdown using
> the result set. what i can't seem to do is to make
> it generate more than more value per key, here is the
> code:
>
> $this->set(
> 'Players',
> $this->Player->generateList(null, 'lastname ASC', null,
> '{n}.Player.id', '{n}.Player.lastname')
> );
>
> I's to make so that it becomes smth like this
> (obviously the following code doesn't work):
>
> $this->set(
> 'Players',
> $this->Player->generateList(null, 'lastname ASC', null,
> '{n}.Player.id', '{n}.Player.firstname'.' '.'{n}.Player.lastname')
> );
>
> so that the result set is smth like this:
> array(
> '1' => 'Kobe Bryant',
> '2' => 'D-Wade',
> '3' => 'Chien-Ming Wang',
> '4' => 'Dice-K Matsuzaka'
> );


--~--~-~--~~~---~--~~
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 to deal with $this->User->findById('3')['User']['name']

2007-04-07 Thread GreyCells

If you find you're writing the same old find($conditions, $fields)
time after time, why not encapsulate it as a method on your User model
class?

e.g. : User->findMyUserStuff($userId);

And you get extra 'DRY' points :)

If you're just fetching one field then use $model->field();

~GreyCells

On Apr 7, 8:33 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> when code in cake,I always encounter the situation $this->User-
>
> >findById('3')['User']['name'] ,something like that.
>
> but it doesn't work.I know.I used to coding like this :$foo = 
> $this->User->findById('3'); $foo['User']['name'],but I am really tired of
>
> that .
>
> so what really need to be done in php?


--~--~-~--~~~---~--~~
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: Dynamic Images

2007-04-05 Thread GreyCells

Create a cache dir in /img (off webroot) then create an ImgController
with a cache() function (or a diferently named controller/function and
set up a Route).

When a file is not found in /img/cache the ImgController->cache
function is called where you can create the image and place it in
your /img/cache directory. If successful, redirect back to the
original image or pipe the image straight back.

This works extremely well for me, so I hope the functionality doesn't
go away :)

HTH

~GreyCells

On Apr 5, 1:11 am, "rtconner" <[EMAIL PROTECTED]> wrote:
> It seems I'm going to have to work with a few dynamic images. I hate
> doing that, but it seems like it'll have to be done.
>
> >From searching, it seems there used to be a tutorial here:
>
> http://wiki.cakephp.org/tutorials:dynamic-image, which is no longer
> there. Can we recover this tutorial? I would like to look at it, even
> if it is old.
>
> Outside of that, I assume I'll have to do something along the lines of
>  and generate the image in the
> image controller. Anyone have any experience in this. Is there a
> better way to go. I'm certainly open to tips on best practices and
> all.
>
> Things I've figured out are to use the next to lines of code in my
> image controller to get rid of cake printing anything to the output.
>
> $this->autoRender = false;
> Configure::write('debug',0);


--~--~-~--~~~---~--~~
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: Curious incidence of infinitely nested recurring views

2007-04-03 Thread GreyCells

Trac now raised as an enhancement ('cos it works OK if you get the
datatypes right.. :)

https://trac.cakephp.org/ticket/2340

~GreyCells

On Apr 3, 4:18 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> https://trac.cakephp.org
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de GreyCells
> Enviado el: Martes, 03 de Abril de 2007 12:07 p.m.
> Para: Cake PHP
> Asunto: Curious incidence of infinitely nested recurring views
>
> This is a curious one. I'm using 1.2 r4746 and periodically get
> infinitely nested recurring views all with the error message shown
> below.


--~--~-~--~~~---~--~~
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: Curious incidence of infinitely nested recurring views

2007-04-03 Thread GreyCells

This disappears when reverting back past r4719 - which makes sense,
because r4719 refactors session flash stuff and I have customized that
area ( to give me $controller->flashWarning, flashError, flashInfo etc
with multiple messages).

I'm still unable to replicate the actual trigger (I'm able to use my
custom flashError OK most of the time), so it's probably time for me
to refactor my code...

I guess, Mariano, there's still a slim possibility I should raise a
trac - perhaps a check is needed before the array_merge in view.php to
ensure you don't end up with a big pile of pants on your screen when
passing a non-array (however it is that I'm managing to do that :)

~GreyCells


--~--~-~--~~~---~--~~
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: Curious incidence of infinitely nested recurring views

2007-04-03 Thread GreyCells

Hi Mariano

I have not raised a trac because I cannot replicate the issue. Once I
gather sufficient information to allow the devs to replicate, I will
raise a bug, enhancement or fix my code or whatever. Here, I am
looking for help to track down what triggers this - whether it is just
me or if it has occured in other installs.

Having been on the receiving end of many, many  'it doesn't work'
support calls, I prefer, at the very least, to work out how to
replicate the issue before logging a bug. (or at least try my hardest
to :)

~GreyCells

On Apr 3, 4:18 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> https://trac.cakephp.org
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de GreyCells
> Enviado el: Martes, 03 de Abril de 2007 12:07 p.m.
> Para: Cake PHP
> Asunto: Curious incidence of infinitely nested recurring views
>
> This is a curious one. I'm using 1.2 r4746 and periodically get
> infinitely nested recurring views all with the error message shown
> below.


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



Curious incidence of infinitely nested recurring views

2007-04-03 Thread GreyCells

This is a curious one. I'm using 1.2 r4746 and periodically get
infinitely nested recurring views all with the error message shown
below. I can't seem to replicate what triggers this, as it has only
happened a couple of times after extremely trivial code changes.
Reversing those changes out does not make the problem go away, in
fact, once 'triggered' the infinite recurring views appear for *every*
page of the application, which implies it's not the changes that I'm
making that are causing it.

There are no errors in the apache logs and the cake log does not show
any recursive calls (i.e. the recursion seems to be in the view
rendering, not the controller).

Clearing the cache directory has no effect, thus far the only way I
have been able to clear the issue is to revert cake to a previous
revision, then work forward to the current release (4746). But I have
not yet been able to find the specific release that trigger this, as I
can bring the libs bang up to date without any problems.

Next time it occurs, I'll work backwards, one release at a time...

Has anyone else experience this?

GreyCells


Warning (2): array_merge() [function.array-merge]: Argument #1 is not
an array [COREcake/libs/view/view.php, line 473]

Context | Code

$content_for_layout =   "<"
$layout_fn  =   "/path/to/my/app/views/layouts/<.ctp"
$debug  =   ""
$pageTitle  =   ""


'scripts_for_layout' => join("\n\t", $this-
>__scripts),


'cakeDebug'  => $debug


)


);



array_merge - [internal], line ??
View::renderLayout() - COREcake/libs/view/view.php, line 473
SessionHelper::flash() - COREcake/libs/view/helpers/session.php, line
128
include - APP/views/elements/flash.ctp, line 15
View::_render() - COREcake/libs/view/view.php, line 778
View::renderElement() - COREcake/libs/view/view.php, line 400
include - APP/views/layouts/default.ctp, line 30
View::_render() - COREcake/libs/view/view.php, line 778
View::renderLayout() - COREcake/libs/view/view.php, line 484
View::render() - COREcake/libs/view/view.php, line 347
Controller::render() - COREcake/libs/controller/controller.php, line
611
SearchController::index() - APP/controllers/search_controller.php,
line 44
Dispatcher::_invoke() - COREcake/dispatcher.php, line 346
Dispatcher::dispatch() - COREcake/dispatcher.php, line 328
[main] - APP/webroot/index.php, line 84


--~--~-~--~~~---~--~~
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: Foreign Keys and Cake Naming Conventions

2007-04-03 Thread GreyCells

As you have stated above, you only need to create a link table for
many-to-many relationships. If your table is joining to eight other
tables and they are one-to-one or many-to-one relationships, then the
table will simply have eight foreign keys.

'Link' tables should not be that common, it should often be a full
entity with other attributes (other than the two foreign keys) so
becomes part of many-to-one and one-to-many relationship with the
other two tables. In the unlikely event you really have a schema that
requires eight link tables off one table, you should perhaps revisit
your design - I work with schemas that have tens of thousands of
tables/views and cannot think of a true 'link' table amongst them.

HTH

GreyCells

On Apr 3, 3:18 am, "uk_maul" <[EMAIL PROTECTED]> wrote:
> Here is an example of what I was trying to ask:
>
> many-to-many join tables should be named:
> alphabetically_first_table_plural_alphabetically_second_table_plural
> ie: tags_users
>
> So if my table is joining to 8 other tables, with the 8 foreign keys,
> how do I get the table name? Will it just be the first fk join table
> that I will put in the name and ignore the others?
>
> Thanks
>
> On Apr 2, 7:21 pm, "uk_maul" <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I am new to CakePHP and need some help with the Cake database naming
> > conventions. Our ERD has over a 100 tables (its almost fully
> > normalized). Most tables have one or two foreign key relationships
> > with other tables, so we followed the Cake conventions fine for those
> > and named all the tables in plural and with underscores between the
> > related tables. There are a few tables however that have as many as 6
> > or 8 foreign keys. I would like to know how to follow the Cake naming
> > conventions for those tables and how can we set up the relationships
> > for those tables in the models and how it will impact the automagic
> > database functions that depend on the naming conventions.
>
> > Thanks in advance for help with this.


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



Re: Accessor like command in CakePHP

2007-03-22 Thread GreyCells

If I understand you correctly, you'd like to add model attributes that
can be used by the model internally (for validation etc), but not
persisted to the database?

All model data is stored as an associative array (a public attribute)
in the model as $this->data['ModelName']['field_name'], so you can
either directly insert into that array (from within a controller:
$this->Model->data['ModelName']['field_name'] = 'Some Value'; ) , or
use $this->Model->set('field_name', 'Some Value'); (again, assuming
you're setting from the controller). All of this data is available to
$model->validates().

You must create the model data array first: $this->Model-
>create([$modelData]) for a new record, and/or $this->Model-
>set($modelData) for an existing record (where $modelData has already
been retrieved via $this->Model->find() or comes from the controller-
>data ) . Note that model->set has two ways of being used.

If you create a form field 'Model/my_checkbox' this will be in the
controllers data array - which is the same structure as the model data
array so can be used as per the $modelData above.

HTH

~GreyCells

On Mar 21, 12:21 am, "Justin Hernandez" <[EMAIL PROTECTED]> wrote:
> How can I add variables to a model without having a corresponding
> field in the table?  I'm looking for something like the attr_accessor
> in RoR. Thanks.


--~--~-~--~~~---~--~~
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: bug on $html->charset()

2007-03-22 Thread GreyCells

Hi gui

Can I suggest you raise a bug report via https://trac.cakephp.org/ ?

I'd do it for you, but you have not provided version info etc.

~GreyCells

On Mar 22, 7:48 pm, "guigouz" <[EMAIL PROTECTED]> wrote:
> HtmlHelper's charset() method generates something like
>
> 
>
> that is recognized by Firefox, but not by Internet Explorer. Using
>
> 
>
> Solves the issue (notice the semicolon)
>
> See ya
>
> gui


--~--~-~--~~~---~--~~
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: Thank You for CakePHP

2007-03-16 Thread GreyCells

> It's been said before, but not nearly
> enough: Thanks to all the developers of CakePHP, I greatly appreciate
> your efforts, and will wait patiently new things to come out. Until
> then, I will live inhttp://api.cakephp.org/and learn as much as I
> can, and contribute where I can. I hope the community continues to
> grow in a positive way.

I'll second that.

~GreyCells


--~--~-~--~~~---~--~~
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: 1.2 Changes to $form->create()

2007-03-16 Thread GreyCells

Nate

I dug a little deeper on the notices - again, not raising a ticket
because this relates to checkboxes and a notice from HtmlHelper (which
I guess will move to FormHelper at some point). Currently:

$form->create('User'); $form->input('my_checkbox');

renders OK, but

$form->create('User'); $form->input('UserProfile/my_checkbox');

now raises a php Notice 'Undefined index:  value' from cake/libs/view/
helpers/html.php, line 401

i.e. if the field does not belong to the form's model, the notice is
raised. Manually setting the 'value' option stops the notice, but is
probably not the right solution :)

HTH

~GreyCells

On Mar 16, 2:53 pm, "nate" <[EMAIL PROTECTED]> wrote:
> Oh, to further clarify, you don't need to specify *both* 'action' and
> 'url'.  Just use 'action' if you are only specifying a controller
> action, and going with the default options for the rest of the URL
> (i.e. controller).  Use 'url' if you are specifying a completely
> custom URL, i.e. '/your/form/action'.  Also remember that 'url' works
> with array-based URLs as well.
>
> On Mar 16, 10:23 am, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > For those of us that are using/testing 1.2 bleeding edge, where you
> > used to specify:
>
> > $form->create('MyModel', array('action'=>'/your/form/action'));
>
> > You now need to specify:
>
> > $form->create('MyModel', array('action'=>'/your/form/action', 'url'=>'/
> > your/form/action'));
>
> > to stop your custom action being overwritten.
>
> > I think this change happened around r4617, so if all your custom
> > routes and auth suddenly fail, check this first :)
>
> > I've not created a ticket yet, because FormHelper appears to be
> > undergoing some major changes (as you would expect) & is also raising
> > a couple of php notices (for undefined 'id' and 'value'). If you'd
> > like a ticket, let me know.
>
> > ~GreyCells


--~--~-~--~~~---~--~~
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: 1.2 Changes to $form->create()

2007-03-16 Thread GreyCells

Sorry, that should've been "..'admin' has moved /from/ the middle of
the URL..."


On Mar 16, 3:20 pm, "GreyCells" <[EMAIL PROTECTED]> wrote:
> Thanks Nate
>
> I originally thought that 'url' replaced action, but couldn't get it
> to work that way in practice, e.g.;
>
> $form->create('Model', array('url'=>'/'.$myKey.'/admin/controller/
> action/'.$myId))
>
> translates to:
>
> 
>
> Note the 'admin' has moved to the middle of the URL (which breaks my
> routes expecting to see :myKey at the beginning), the form id has
> 'Edit' in the middle (which plays havoc with my JavaScript) and 'url'
> is displayed which (I don't think) is not a valid attribute for 'form'
> - OK I'm being niggly now :) Specifying both (for now) seems to do the
> trick.
>
> ~GreyCells
>
> On Mar 16, 2:53 pm, "nate" <[EMAIL PROTECTED]> wrote:
>
> > Oh, to further clarify, you don't need to specify *both* 'action' and
> > 'url'.  Just use 'action' if you are only specifying a controller
> > action, and going with the default options for the rest of the URL
> > (i.e. controller).  Use 'url' if you are specifying a completely
> > custom URL, i.e. '/your/form/action'.  Also remember that 'url' works
> > with array-based URLs as well.
>
> > On Mar 16, 10:23 am, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > > For those of us that are using/testing 1.2 bleeding edge, where you
> > > used to specify:
>
> > > $form->create('MyModel', array('action'=>'/your/form/action'));
>
> > > You now need to specify:
>
> > > $form->create('MyModel', array('action'=>'/your/form/action', 'url'=>'/
> > > your/form/action'));
>
> > > to stop your custom action being overwritten.
>
> > > I think this change happened around r4617, so if all your custom
> > > routes and auth suddenly fail, check this first :)
>
> > > I've not created a ticket yet, because FormHelper appears to be
> > > undergoing some major changes (as you would expect) & is also raising
> > > a couple of php notices (for undefined 'id' and 'value'). If you'd
> > > like a ticket, let me know.
>
> > > ~GreyCells


--~--~-~--~~~---~--~~
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: 1.2 Changes to $form->create()

2007-03-16 Thread GreyCells

Thanks Nate

I originally thought that 'url' replaced action, but couldn't get it
to work that way in practice, e.g.;

$form->create('Model', array('url'=>'/'.$myKey.'/admin/controller/
action/'.$myId))

translates to:



Note the 'admin' has moved to the middle of the URL (which breaks my
routes expecting to see :myKey at the beginning), the form id has
'Edit' in the middle (which plays havoc with my JavaScript) and 'url'
is displayed which (I don't think) is not a valid attribute for 'form'
- OK I'm being niggly now :) Specifying both (for now) seems to do the
trick.

~GreyCells


On Mar 16, 2:53 pm, "nate" <[EMAIL PROTECTED]> wrote:
> Oh, to further clarify, you don't need to specify *both* 'action' and
> 'url'.  Just use 'action' if you are only specifying a controller
> action, and going with the default options for the rest of the URL
> (i.e. controller).  Use 'url' if you are specifying a completely
> custom URL, i.e. '/your/form/action'.  Also remember that 'url' works
> with array-based URLs as well.
>
> On Mar 16, 10:23 am, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > For those of us that are using/testing 1.2 bleeding edge, where you
> > used to specify:
>
> > $form->create('MyModel', array('action'=>'/your/form/action'));
>
> > You now need to specify:
>
> > $form->create('MyModel', array('action'=>'/your/form/action', 'url'=>'/
> > your/form/action'));
>
> > to stop your custom action being overwritten.
>
> > I think this change happened around r4617, so if all your custom
> > routes and auth suddenly fail, check this first :)
>
> > I've not created a ticket yet, because FormHelper appears to be
> > undergoing some major changes (as you would expect) & is also raising
> > a couple of php notices (for undefined 'id' and 'value'). If you'd
> > like a ticket, let me know.
>
> > ~GreyCells


--~--~-~--~~~---~--~~
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 Changes to $form->create()

2007-03-16 Thread GreyCells

For those of us that are using/testing 1.2 bleeding edge, where you
used to specify:

$form->create('MyModel', array('action'=>'/your/form/action'));

You now need to specify:

$form->create('MyModel', array('action'=>'/your/form/action', 'url'=>'/
your/form/action'));

to stop your custom action being overwritten.

I think this change happened around r4617, so if all your custom
routes and auth suddenly fail, check this first :)

I've not created a ticket yet, because FormHelper appears to be
undergoing some major changes (as you would expect) & is also raising
a couple of php notices (for undefined 'id' and 'value'). If you'd
like a ticket, let me know.

~GreyCells


--~--~-~--~~~---~--~~
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: email form

2007-03-13 Thread GreyCells

This is not a bug - I thought it was too, but see:

https://trac.cakephp.org/ticket/2026

You need to override loadInfo() in the model..

~GreyCells


On Mar 6, 11:47 am, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Ok can you do us bakers a favour and report this tohttps://trac.cakephp.org
> ?
>
> This is what you should report:
>
> When using a model that has no table defined (with var $useTable = false)
> issuing:
>
> $this->Model->create($this->data);
>
> When $this->data is available and valid, throws:
>
> Notice: Undefined offset: 0 in
> /home/sajt/Projectek/mediabazar2/cake/libs/model/model.php on line 885
>
> Warning: array_key_exists() [function.array-key-exists]: The second
> argument should be either an array or an object in
> /home/sajt/Projectek/mediabazar2/cake/libs/model/model.php on line 885
>
> FIX:
>
> On line 885 of cake/libs/model/model.php change:
>
> if (array_key_exists('default', $cols->value[0])) {
>
> to:
>
> if (is_array($cols->value) && array_key_exists('default', $cols->value[0]))
> {
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de Ámon Tamás
> Enviado el: Martes, 06 de Marzo de 2007 08:34 a.m.
> Para: cake-php@googlegroups.com
> Asunto: Re: email form
>
> Yes. It is working :) The 1.2 is very good!


--~--~-~--~~~---~--~~
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: Flame On! DB recommendations

2007-03-10 Thread GreyCells

Given the information you have supplied, almost any database on the
market would suit your needs.

The influencing factors are not usually performance (that is
determined as much by application/schema design as by the RDBMS and
can be mitigated by a variety of caching and/or distributed
mechanisms), but features and availability. For example, you may want
some of the features offered by Oracle 10g - but try finding a hosting
provider in your price range!

MySql tends to be more widely supported by ISPs than Postgres or at a
lower cost but this is not always the case. Postgres has some nice
features that are missing or incomplete in MySql but these can be
often worked around in the application tier.

You should also be asking yourself about some of the essential user
requirements. For example: full text search is available for MyISAM
but not InnoDB, but you can mix and match table types in a single
database or use cake to read from different databases. I believe
Postgres relies on contrib modules to fulfill this requirement.

The great thing about cake is that you can swap in and out databases
with very little hassle (provided all your logic is in the application
tier), so take Chis' advice: "Just build it, damnit!"  :)

~GreyCells

On Mar 9, 7:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm in the planning stage of what will hopefully become my first non-
> trivial web app.  I'm trying to minimize future pain resulting from
> poor planning, and have been reading up on DB trivia.
>
> If I use MySQL, how do I choose between MyISAM and InnoDB?  What are
> the trade-offs?  It seems InnoDB is the way to go if I want to handle
> rollbacks and such, but MyISAM may produce considerably shorter query
> times.  Is this true?
>
> Should I use PostreSQL instead?  I find the popularity of MySQL
> comforting, but the PostreSQL crowd has some convincing zealots.
>
> At the end of the day, I'm not doing anything too complicated, and I
> just want to minimize DB-related stress in the long run.
>
> Thanks in advance.


--~--~-~--~~~---~--~~
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: best practice multiple checkboxes

2007-03-02 Thread GreyCells

I wrote the fomx helper as a proof of concept, although I am using it
in a development environment, I'll probably tidy it up before using it
in production. ('though there's always the hope it'll end up in the
core:). It is tightly tied to the 1.2 FormHelper and I have not even
looked at the 1.1 code (which I think is in HtmlHelper, not
FormHelper), but there is no reason why you couldn't do the same thing
in 1.1.

Once the 1.2 FormHelper stabilizes a bit, I'll clean up the
FormxHelper or better still, create a patch to integrate into the core
if the devs would like me to.

~GreyCells

On Mar 2, 11:14 am, "szeta" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> has anybody managed to use formx-helper (or something similar) on
> stable?
>
> I did not yet get formx-helper work on the version I use on the
> project:
> 1.1.11.4064
>
> Kind regards
> Ralph
>
> On 26 Feb., 18:29, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > excellent!
> > Thanks for all the hints!
>
> > On 23 Feb., 15:13, "bbuchs" <[EMAIL PROTECTED]> wrote:
>
> > > "GreyCells" also wrote a Helper for this purpose - I'm using it on a
> > > 1.2 project now, and it's great. I think the HTML it outputs could be
> > > a little cleaner, but it does what it should.
>
> > >https://trac.cakephp.org/ticket/1901
>
> > > I'm hoping something like this makes it into the source - from a
> > > usability perspective, multiple-select option lists are horrible.
>
> > > On Feb 23, 4:56 am, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > > Does anybody have an idea here?
>
> > > > Every hint is appreciated. :-)
> > > > Regards
> > > > Ralph
>
> > > > On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello,
>
> > > > > I'm using CakePHP now for a few months on a project and I really love
> > > > > the framework.
> > > > > It helped me to safe a lot of time!
>
> > > > > But one thing, I always run into is, that it's not so easy to generate
> > > > > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > > > > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > > > > better than the scroll-box baked by default.
>
> > > > > But I'd like to give more Information to the related items (not only
> > > > > the primary key, but also the name or something else..)
>
> > > > > How do you handle this? Is there a method I have overseen?
>
> > > > > Best wishes!
> > > > > Ralph


--~--~-~--~~~---~--~~
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: Switch Element On/Off

2007-03-01 Thread GreyCells

Determine the business logic in the controller and use controller->set
to communicate the decisions to the views/elements.

Don't get too hung up on strict seperation of M->V->C there's plenty
of grey across the boundaries... A pragmatic approach if generally
more productive :)

Interesting discussion here:

http://groups.google.com/group/cake-php/browse_thread/thread/7786024149ca244b/efeb2a04e537e6b1?lnk=gst&q=stutchbury+view&rnum=1#efeb2a04e537e6b1

~GreyCells

On Feb 28, 7:44 pm, "phirschybar" <[EMAIL PROTECTED]> wrote:
> Hey all..
>
> What if I have an element and I want to switch it on for some pages
> and off for others?
>
> I could easily pass it some data and do the logic to determine if it
> should be shown right within the element itself or even in the default
> layout but then I would have business logic right in the views,
> violating MVC...
>
> How can I do the logic in the controller where it should be and only
> call the element from there?


--~--~-~--~~~---~--~~
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: Include Js file in layouts

2007-02-28 Thread GreyCells

Hi CraZyLeGs

The HeadHelper /functionality/ is now in the core - not the code
itself.

Put: $javascript->link(array('jquery.js', app.js), false); in your
view.ctp and e($scripts_for_layout); in the head section of your
layout.ctp and you get the same functionality as HeadHelper. (Note the
second arg 'false' on $javascript->link).

~GreyCells


On Feb 21, 9:51 am, "CraZyLeGs" <[EMAIL PROTECTED]> wrote:
> The head helper isn't part of the  core.
> it was written by rossoft and it's available in his blog
>
> On Feb 20, 9:33 am, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > If you're using 1.2, then take a look here:
>
> >http://cake.insertdesignhere.com/posts/view/17
>
> > The HeadHelper functionality is implemented in the core.
>
> > ~GreyCells
>
> > On Feb 20, 8:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > I want to include javascript file in layout.It is possible? if it is,
> > > how to include javascript file.
>
> > > If i include like this
>
> > > app/views/layouts/index.thtml
>
> > > 
> > > Untitled-1
> > > 
> > > 
>
> > > 
>
> > > it is not working.


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



Re: findAll with NOT LIKE

2007-02-28 Thread GreyCells

There is also the function model->escapeField() e.g.:

$this->Article->escapeField('text')." NOT LIKE '%cheese%'"

A very useful function for those awkward SQL conditions.

~GreyCells

On Feb 28, 12:00 pm, "jyrgen" <[EMAIL PROTECTED]> wrote:
> i found the solution right after a posted my question !!
>
>  "and not" => array(
>
> array("Article.text" => "LIKE %cheese%"),
> ),
>
> thanks anyways :-)
>
> Jyrgen


--~--~-~--~~~---~--~~
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: 1.2: isUnique - beforeValidate only on add, not on edit?

2007-02-27 Thread GreyCells

https://trac.cakephp.org/ticket/2032 might help.

On Feb 27, 7:22 pm, "Cynthia" <[EMAIL PROTECTED]> wrote:
> I found the cool new model::isUnique. It works great with
> beforeValidate (as the example gave) but I can't get it to do anything
> when I update a record.
>
> Setting it to beforeSave doesn't help either.
>
> What I sort of patched is:
>
> if ( ! $this->Person->isUnique(array('name'=>$this->data['Person']
> ['name']))) {
>   etc. etc.
>
> That works good in that I can trap the duplicate error ... but Cake
> doesn't seem to know about that so no error message is set in the
> form.
>
> Now I've been trying to walk the whole trree of model and helpers to
> ($this->Person->validationErrors..., $this->Form->error... etc.) but
> for the life of it, that error message stays hidden, lol.
>
> Where does my logic go wrong?! :(


--~--~-~--~~~---~--~~
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: Model::save() and multicolumn primary key?

2007-02-27 Thread GreyCells


On Feb 27, 1:15 pm, "nate" <[EMAIL PROTECTED]> wrote:
> Yes, I've read the article, and have been slowly hacking away at a
> counter-article for a few months now.  Wake up people, it's 2007, and
> multi-column primary keys are *still* a dumb idea.
>

Here, here! compound primary key constraints are *business*
constraints not *application* keys. I for one am quite happy to add a
single integer column in order to make good use of Cake. I frequently
have this discussion with other Oracle devs who seem to think that
invoice_id and line_num are a primary key on invoice lines. Their
argument is that there are likely to be billions of invoice lines -
but so what? As you say: "Welcome to 2007..."

Keep us posted Nate on your article. It it helps, I think the guy is
confused between:

System Keys (ROWID in Oracle, Tupal [sp?] in PostGres etc - these
change on update or replication)
Application Keys (single column Primary Key constraints - in practice,
these are immutable)
Business Constraints (Unique Keys, Compound Primary Keys etc - these
frequently change on update)

Now, if you want to *know* which record you're manipulating, which are
you going to use?

~GreyCells


--~--~-~--~~~---~--~~
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: Model::save() and multicolumn primary key?

2007-02-27 Thread GreyCells



On Feb 27, 8:41 am, "AD7six" <[EMAIL PROTECTED]> wrote:
>
> Does it? I always thought not including a unique index on a table's
> data allowed duplicates.
>
> And I feel that's all the article proves. The PK is for identifying a
> row of data, a unique index is for preventing duplicates. There are
> times when the two can be one and the same, but in most cases they
> should not - if only because choosing something that seems to be
> unique which turns out not to be, or in some cases is null, is so
> difficult to rectify (quickly).
>

Primary Keys and Unique Keys are subtly different. A Unique Key will
allow nulls (and therefore duplicate records for that key) unless the
column is defined as not null whereas a primary key does not allow
nulls and the column is implicitly not nullable. Compound primary keys
will treat null columns as part of the key, so only one combination
can exist.
.
>
> All IMO of course :),
>
> AD

Ditto ~GreyCells


--~--~-~--~~~---~--~~
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: Include Js file in layouts

2007-02-20 Thread GreyCells

If you're using 1.2, then take a look here:

http://cake.insertdesignhere.com/posts/view/17

The HeadHelper functionality is implemented in the core.

~GreyCells

On Feb 20, 8:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I want to include javascript file in layout.It is possible? if it is,
> how to include javascript file.
>
> If i include like this
>
> app/views/layouts/index.thtml
>
> 
> Untitled-1
> 
> 
>
> 
>
> it is not working.


--~--~-~--~~~---~--~~
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: 1.2 validation - This field cannot be left blank

2007-02-18 Thread GreyCells

allowEmpty actually translates to 'not set' i.e. if the field is not
set in the model then don't fail validation. I think what you're
looking for is similar to me - i.e.  'allowBlank' - ala
https://trac.cakephp.org/ticket/2092  Use at your own risk as this
patch may not be accepted and 1.2 is still under serious development.

A better alternative at this stage (rather than patching the core) is
to either a) unset blank fields in beforeValidate() or b) manually
validate optional fields in validates() then call parent::validates()
and return the result. I've taken option b - with a //TODO note to
refactor once allow blank functionality comes into the core - which
I'm sure it will, just maybe not as the above patch :)

On Feb 18, 12:39 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote:
> I was hoping something like allowEmpty would be implemented soon so i could
> really start using 1.2 but, using the latest dev release, i still get 'this
> field cannot be left blank' errors even when i set allowEmpty to true. I
> tried several variants on the example you give but no dice.
>
> Validating non-required fields and integration of custom functions in the
> built in validation would allow me to switch to 1.2 completely. I'll take
> the random API changes for granted when i could do that now.
>
> Tijs
>
>
>
> GreyCells-2 wrote:
>
> > The way it appears to work now (I'm sure nate will correct me if I'm
> > wrong) is to put your error messages in the model. Here is an example
> > of an email validation:
>
> > var $validate = array(
> >  'email_address' => array( array('allowEmpty' => false
> >,'message' => 'Invalid email address format or unknown
> > domain')
> >, 'rule' => array('email', true)
> >),
> > );
>
> > Note the 'message' element in the array. It will also display the
> > second argument of $Model->invalidate('field_name', 'My custom
> > message'); if you happen to be doing stuff in $Model->validates()
>
> > Use the $form->input() 'wrapper' and the error messages will be
> > rendered automatically without having to call tagErrorMessage i.e.
> > this is all you need in your view:
>
> > input('email_address', array('class' =>
> > 'required'));?>
>
> > On Feb 18, 4:12 am, "gobblez" <[EMAIL PROTECTED]> wrote:
> >> Hello, in the latest 1.2 SVN,  I can't get validation to work.  Well,
> >> it is working, the empty fields are being flagged as they should be
> >> for not meeting cake's regex constants, but my tagErrorMsg definitions
> >> aren't spitting out their messages.
>
> >> I did a search, and found it on line 1685 of model.php  What I did, is
> >> changed 'This field cannot be left blank' to '1'.  It works now, but
> >> I'm thinking maybe tagErrorMsg is used differently now.
>
> >> Here is an example of how I've been using it, and it works when a
> >> flagged field is set to '1' instead of that 'this field cannot..."
> >> sentence.
>
> >> echo $html->tagErrorMsg('User/username', 'Please
> >> enter a username.');
>
> --
> View this message in 
> context:http://www.nabble.com/1.2-validation---This-field-cannot-be-left-blan...
> Sent from the CakePHP mailing list archive at Nabble.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: 1.2 validation - This field cannot be left blank

2007-02-18 Thread GreyCells

The way it appears to work now (I'm sure nate will correct me if I'm
wrong) is to put your error messages in the model. Here is an example
of an email validation:

var $validate = array(
 'email_address' => array( array('allowEmpty' => false
,'message' => 'Invalid email address format or unknown
domain')
, 'rule' => array('email', true)
),
);


Note the 'message' element in the array. It will also display the
second argument of $Model->invalidate('field_name', 'My custom
message'); if you happen to be doing stuff in $Model->validates()

Use the $form->input() 'wrapper' and the error messages will be
rendered automatically without having to call tagErrorMessage i.e.
this is all you need in your view:

input('email_address', array('class' =>
'required'));?>



On Feb 18, 4:12 am, "gobblez" <[EMAIL PROTECTED]> wrote:
> Hello, in the latest 1.2 SVN,  I can't get validation to work.  Well,
> it is working, the empty fields are being flagged as they should be
> for not meeting cake's regex constants, but my tagErrorMsg definitions
> aren't spitting out their messages.
>
> I did a search, and found it on line 1685 of model.php  What I did, is
> changed 'This field cannot be left blank' to '1'.  It works now, but
> I'm thinking maybe tagErrorMsg is used differently now.
>
> Here is an example of how I've been using it, and it works when a
> flagged field is set to '1' instead of that 'this field cannot..."
> sentence.
>
> echo $html->tagErrorMsg('User/username', 'Please
> enter a username.');


--~--~-~--~~~---~--~~
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: Sending emails

2007-02-13 Thread GreyCells

If you are using $this->Email->send('Simple email content'); then you
need to explicitly set the template to null.

See: https://trac.cakephp.org/ticket/2105

~GreyCells

(Thought I'd sent this earlier, but it didn't show up...?)


On Feb 13, 12:17 pm, "thequietlab" <[EMAIL PROTECTED]> wrote:
> @Felix : thanks, I'll try your snippet and I'll let you know
>
> @Sergei : oh man..using mail() is not really convenient when you want
> to send html + txt version, attachments etc. that's why soft like
> phpmailer or swiftmailer came out.. making our life easier :) Now I
> hope cakephp EmailComponent will make it easier as well..
>
> Thanks guys


--~--~-~--~~~---~--~~
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: Sending emails

2007-02-13 Thread GreyCells

If you are using $this->Email->send('Simple email content'); then you
need to explicitly set the template to null.

See: https://trac.cakephp.org/ticket/2105

~GreyCells

(Thought I'd sent this earlier, but it didn't show up)

On Feb 13, 12:17 pm, "thequietlab" <[EMAIL PROTECTED]> wrote:
> @Felix : thanks, I'll try your snippet and I'll let you know
>
> @Sergei : oh man..using mail() is not really convenient when you want
> to send html + txt version, attachments etc. that's why soft like
> phpmailer or swiftmailer came out.. making our life easier :) Now I
> hope cakephp EmailComponent will make it easier as well..
>
> Thanks guys


--~--~-~--~~~---~--~~
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: email component example

2007-02-13 Thread GreyCells

If you are using the send('simple text') then you must explicitly set
the template to null first.

See: https://trac.cakephp.org/ticket/2105

~GreyCells

On Feb 13, 10:55 am, Ámon Tamás <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I like to use the email component, but I get the following error:
>
> --
> Missing Layout
>
> You are seeing this error because the layout file can not be found or
> does not exist.
>
> Notice: If you want to customize this error message, create
> app/views/errors/missing_layout.thtml
>
> Fatal: Confirm you have created the file:
> --
>
> How can I use this email component? (I use the version 1.2)
>
> --
> Ámon Tamáshttp://linkfelho.amon.hu


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