Re: cake 1.3.2 wants to be too smart

2010-07-15 Thread Grzegorz Pawlik
to: - have two or more timestamp fields - name your timestamp field whatever you want On 13 jul, 04:11, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: That's not what I'm asking about. Lets say I NEED to use TIMESTAMP and CURRENT_TIMESTAMP as default value, and in that case cakePHP

Re: cake 1.3.2 wants to be too smart

2010-07-13 Thread Grzegorz Pawlik
documented in every book. Basically you crater a field called created or updated as a datetime, default null and cake will populate it automatically. On Jul 12, 5:02 pm, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: just switching from 1.3.0 to 1.3.2 got me into trouble, when I have field

cake 1.3.2 wants to be too smart

2010-07-12 Thread Grzegorz Pawlik
just switching from 1.3.0 to 1.3.2 got me into trouble, when I have field specified as: `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP and don't supply any value for that field in array I try to save , neither a key in 1.3.0 it's working as desired - I get current timestamp in that

Helper elements

2010-05-14 Thread Grzegorz Pawlik
I have an idea I want to to share with You. I made some fancy element called list (http://bin.cakephp.org/view/ 127456247). The implementation is not that important, it's just foreach You always do when listing stuff from db (putting them into tr/ td, marking odd tr's, adding some links at the

Re: Unit testing questions

2010-02-26 Thread Grzegorz Pawlik
saving to the db. My apologies for the wasted post. Thanks your time and help :) On Feb 25, 4:17 pm, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: Do You have fixtures defined? AFAIR I had similar problem, when no fixtures loaded. Try creating fixtures with var $import(model

Re: Unit testing questions

2010-02-25 Thread Grzegorz Pawlik
Please post contents of Your app/config/database.php file... On 24 Lut, 11:39, Nico ngev...@gmail.com wrote: Greetings I've run into something strange while testing my models. Here's a scenaro (names have been changed for simplicity). I have 2 models, Article and Comment. in the article

Re: Unit testing questions

2010-02-25 Thread Grzegorz Pawlik
',                 'prefix' = 'boost_',         );} ? for what its worth, it works the other way around .. ie if i write to the db in the test it picks it up in the code... but just not the other way round (as defined above) On Feb 25, 3:24 pm, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote

Re: CakePHP HABTM Plugin table naming conventions (for 1.3)

2010-01-13 Thread Grzegorz Pawlik
Is it hard to check? On 12 Sty, 20:06, Parris presid...@parrisstudios.com wrote: Would that not cause namespace issues if there were more than one controller with the same name in the entire app? Doesn't the model need to be named PollPoll not just Poll? On Jan 12, 12:32 am, Grzegorz Pawlik

Re: CakePHP HABTM Plugin table naming conventions (for 1.3)

2010-01-12 Thread Grzegorz Pawlik
In 1.2 I would name model Poll, and Tag, and in PollAppModel set $tablePrefix = poll_ So You would have poll_polls, poll_tags and poll_posts_tags. As fas as I remember - that worked :) Btw, when You define relations It would be for Poll model var $habtm = array(Poll.Tag); Good luck I'm not

Re: Conceptual problem Model on View ..

2010-01-07 Thread Grzegorz Pawlik
You should put the code in Your model. And in afterFind callback iterate through stuff You got, call can_close() and if true - add some virtual field to retrieved data (virtual = not in DB, but appears in results array after find()). It's similar to advice above, but keeps Fat Model, Skinny

Re: Make objects from model data

2010-01-07 Thread Grzegorz Pawlik
It has little to do with MVC, because You are referring to ORM. And it's working different in cake. You can call $this-SomeModel-read(null, 1); // 1 is an id Then You can read/write particular field this way: $this-SomeModel-data[SomeModel][name] = new_name; $this-SomeModel-save(); I don't this

Re: Are unit tests REALLY a unit tests?

2009-12-03 Thread Grzegorz Pawlik
are implemented by CakePHP.  This is mostly a side effect of PHP4 support and will be removed once autoloading of models can be achieved. -Mark On Dec 1, 9:00 am, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: Those should test single unit. I know, that sometimes it's convenient to test

Are unit tests REALLY a unit tests?

2009-12-01 Thread Grzegorz Pawlik
Those should test single unit. I know, that sometimes it's convenient to test model with (some close) associations. But I find quite odd that situation: Creating PackageTest, and including app.packages_appendix and app.appendix fixtures - it's reasonable for now. But why the heck I need to

Re: setting displayField to a custom field

2009-11-09 Thread Grzegorz Pawlik
Shouldn't be in afterFind? When data grabbed from DB, You iterate throug them and add do sth like this $this-data[$n]['User']['whole_name'] = $this-data[$n]['User'] ['name'] . . $this-data[$n]['User']['last_name']; right? On Nov 6, 7:12 pm, David Roda davidcr...@gmail.com wrote: Thanks

Re: Free Cake Ebook : How to build your own blog from scratch

2009-07-30 Thread Grzegorz Pawlik
It may be free, but not open :P Tried to copy text to google translate, but it seems to be protected ; ( So it's no use for lots of people right now. You probably should have post info about it on Malaysian cakePhp forum instead of teasing with us :P On Jul 29, 1:27 pm, Azril Nazli

Re: Need advice/tips for sending mass emails with CakePHP

2009-07-30 Thread Grzegorz Pawlik
Why using vendor when cake (1.2) have native email component? On Jul 30, 7:05 am, JamesF usaexportexpe...@gmail.com wrote: that's a good start, i am still trying to get a picture of how it will work together. thanks On Jul 29, 11:46 pm, brian bally.z...@gmail.com wrote: On Wed, Jul 29,

Re: Free Cake Ebook : How to build your own blog from scratch

2009-07-30 Thread Grzegorz Pawlik
For the record: I'm gr8tful for every publication about cake tipstricks. In most cases 90% of it I.m familiar with, but I like to read it because of this 10% that will be new, suprising, fresh and useful. So there's lots of stufff in english doesn't convince me - I just want to read this one too,

Re: How to inheirt form other controllers?

2009-07-28 Thread Grzegorz Pawlik
*Fatal error*: Class 'LocationController' not found in * C:\wamp\www\theinconnu\app\controllers\locationmanager_controller.php* on line *6 It seems You are importing LocationmanagerController (in app::import), but extending class by LocationController, or making some similar mistake. Plus,

Re: Poll: what do you hate about CakePHP?

2009-06-18 Thread Grzegorz Pawlik
I just came up with something, It's not something I hate - just an idea to improve Model (?): If Model could keep track of queries that it calls debugging would be simple, I think of something like this: //in controller: $this-Thing-clearQueryTrace(); //remove unimportant info //+ $a =

Re: How to set 301 redirect in htaccess for domain .com.pl to redirect to .pl

2009-06-09 Thread Grzegorz Pawlik
Isn't it easier to make domain .com.pl point at the same location as domain .pl ? I don't believe messing with .htaccess is what You need ;) On Jun 8, 10:58 am, Anna P apad...@o2.pl wrote: Thank you for suggestion, but that doesn't seem to work either. Still when I enter .com.pl it doesn't

Re: Feedback from TranslateBehavior creator needed

2009-06-09 Thread Grzegorz Pawlik
Ok, I'll suppress my 'general why questions compulsive behaviour' ;) About not existing callback - just a mistake. I meant beforeFind of course. But it's not the point. I Talk about ArticleVersion and ArticlePage, because those two models I want to have translatable, but that is not the problem

Re: Feedback from TranslateBehavior creator needed

2009-06-09 Thread Grzegorz Pawlik
And I'm fairly sure I don't need to do that trick in save method ;) On 9 Cze, 15:30, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: Ok, I'll suppress my 'general why questions compulsive behaviour' ;) About not existing callback - just a mistake. I meant beforeFind of course. But it's

Re: Feedback from TranslateBehavior creator needed

2009-06-09 Thread Grzegorz Pawlik
before I got certain that is the best way :D Thanks for Your time Jitka, a lot of time I suppose. And I hope my questions didn't make You bang Your head against a desk, or any other hard surface ;) Greg On 9 Cze, 15:33, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: And I'm fairly sure I don't need

Re: Feedback from TranslateBehavior creator needed

2009-06-05 Thread Grzegorz Pawlik
Once again: language and locale are different things and you should not mix language and locale codes together like that. Language is 2 characters string from Configure/Session 'Config.language', initialized by autodetection or forced by application code. Locale identifier used by

Re: Feedback from TranslateBehavior creator needed

2009-06-01 Thread Grzegorz Pawlik
Ok, now I'm even more confused than before ;) So I'll keep nagging You. Question: Why App.locales is better place for locales? I get it why Config.language is a bad place. But is App.locales because there's some convention I don't know about? Or maybe just Your ideaof place to store this stuff?

Re: Feedback from TranslateBehavior creator needed

2009-06-01 Thread Grzegorz Pawlik
'); //i18n + TranslateBehavior from beforeFind to __contruct did the trick. Does it have something to do with model chain? On 1 Cze, 12:38, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: Ok, now I'm even more confused than before ;) So I'll keep nagging You. Question: Why App.locales is better

Re: Feedback from TranslateBehavior creator needed

2009-05-31 Thread Grzegorz Pawlik
Hello Jitka :) I remember You from our discussion about my performance trick in cake.1.1 ;) On 30 Maj, 03:41, jitka (poLK) slunii...@gmail.com wrote: There's ArticleVersion model, which have this fields: id, name: varchar, introduction:text, created:datetime. I've defined to name and

Feedback from TranslateBehavior creator needed

2009-05-28 Thread Grzegorz Pawlik
Hello, I have some issues while working with TranslateBehavior. I'll try get to the point: There's ArticleVersion model, which have this fields: id, name: varchar, introduction:text, created:datetime. I've defined to name and introduction fields to be translatable: var $actsAs =

Re: Poll: what do you hate about CakePHP?

2009-05-27 Thread Grzegorz Pawlik
I just want to add one minor thing: I don't like that debug() is making print_r() instead of var_dump(), so when I want to debug some variable and see nothing - I know that there's null, false, true or empty string or string full white chars, so I need to make my own debugging with pre tags and

Re: Bake a Cake

2009-05-08 Thread Grzegorz Pawlik
Can You use php from command line? If yes, You could probably call console cake that way: php cake.php bake Have You tried that? On May 7, 7:47 pm, Beedge kbrads...@hbit.ie wrote: Thanks for that, but its not quite the same. Ive downloaded latest php and installed, but no joy. I wonder has

Re: Foreign Key

2009-05-08 Thread Grzegorz Pawlik
I can't tell why varchar couldn't be a FK? Are You experiencing any problems with that or just theoretically asking? On May 8, 4:08 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I had a thought because of unique slugs but it made no sense...was just wondering if was

Re: How to catch Controller::loadModel/ClassRegistry::init errors

2009-04-29 Thread Grzegorz Pawlik
You could probably get list of tables instead listing models, You could probably use that piece of code: $db = ConnectionManager::getDataSource('default'); $sources = $db-listSources(); Iterate through $sources and do Your stuff. It makes more sense too, becouse You need to do stuff

Re: Plugin architecture and plugin limitations

2009-04-17 Thread Grzegorz Pawlik
It's an idea that just came up. Probably You could set up some kind of PluginHandler, which will handle the plugins instalation process (which i describe below) and plugin interacting. Each plugin knows where it need to inject himself into (I'll just call it widgets for now). IE: - extend Dog

Re: Problem with linked models

2009-04-16 Thread Grzegorz Pawlik
here: (`StockItem`.`size_id` = `Size`.`id` AND `Size`.`size_type_id` = 'StockItem.Product.size_type_id') After 'AND' you have something that is not automatically generated by cake. You must have something extra in StockItem-find() passed, or in relation definition (ie. in conditions field).

Re: Reserved words in CakePHP?

2009-04-16 Thread Grzegorz Pawlik
Additionally You rather shouldn't name Your model/controller like Object/Objects and Page/Pages ;) On Apr 16, 12:52 pm, Mark (Germany) dereurom...@googlemail.com wrote: yeah i once proposed to change components into $this-FileComponent-foo() etc with Component attached to prevent this from

What CI tools does cake core use?

2009-04-16 Thread Grzegorz Pawlik
I'm doing some research and trying to find best tool set for projects I run. Because cake is my favourite application - CakeTeam is my favourite dev team and I probably could follow the example and find out if it suits for me. Anyway I'm wondering (or know but want to list all elements of this

Re: Little performance trick on cake 1.1.x

2009-03-19 Thread Grzegorz Pawlik
jitka, is there any possibility that You could provide some information about other php4 workarounds? I could really use this info. Not sure if I could track them down with xdebug profiling :) On 18 Mar, 13:09, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote: Ok, that's gr8 :D I don't need

Re: Little performance trick on cake 1.1.x

2009-03-18 Thread Grzegorz Pawlik
Ok, that's gr8 :D I don't need that to be changed globably in cake repo, but just for this one project, which is and will be only php5. Thanks for dissolving my doubts :) On 18 Mar, 13:06, jitka (poLK) slunii...@gmail.com wrote: You discovered one of many workarounds which are necessary for

Little performance trick on cake 1.1.x

2009-03-17 Thread Grzegorz Pawlik
Today I was playing with xdebug profiler and found probably not necessary bit of code which have been taking quite a lot of whole script execution time. The thing is in Model::setSource (files /cake/lib/model/model_php5.php: 523 and model_php4.php:529) [cake 1.1.16.5421 - I know that's little

Re: In controller using too many models hit the performance?

2008-10-12 Thread Grzegorz Pawlik
DESCRIBE happens only in debug0, when You switch to production mode, describe shouldn't happen. Only overhead may be in those models objects initialization. You may consider lazy initialization of models in controllers methods. On Oct 12, 4:42 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi

Re: To model or not to model

2008-09-25 Thread Grzegorz Pawlik
Still thinks that executing queries is needed? Yes. Sometimes You have uncommon database design, and You can't EFFECTIVELY receive data just by using standard, even magic, model functions. In that case you should create method in model that executes your custom query with inner, outer, left

Re: Model

2008-07-09 Thread Grzegorz Pawlik
I'll add my two cents ;) In Chris's advice (very good btw) maybe You'll need to define statistic model for statistics_controller, and in class Statistic set var $useTable = false; (because controller always expects to have a model) On Jul 9, 4:00 am, Chris Hartjes [EMAIL PROTECTED] wrote: On

Re: more fields in list function

2008-04-16 Thread Grzegorz Pawlik
grigri said: You can also use {1} {2} as the format string instead of the sprintf() format, if you like. Personally I prefer the sprintf format... Yeah, but if You have something like: Array ( [0] = Array ( [Company] = Array ( [name] =

Re: DBDesigner to CakePHP Scaffold Tool Release Candidate.

2007-09-01 Thread Grzegorz Pawlik
I think bake.php is amazing, but this is even better (faster and more comfortable) in use. Great job! On Aug 30, 7:14 pm, Dérico Filho [EMAIL PROTECTED] wrote: Hi All, I released the dbdesigner2cake 1.0.0RC1, it's available for download at

Re: using the php exec() function inside of a cake view

2007-08-29 Thread Grzegorz Pawlik
From what You wrote, I think that you forgot to actually call exec() function... On Aug 27, 6:02 pm, carSign [EMAIL PROTECTED] wrote: I am trying to execute a command from within a view. Something like: ?php $output = `perl cool_script.pl`; echo $output; ? And I get nothing. I get

mysql_connect client flags

2007-08-22 Thread Grzegorz Pawlik
is there a possibility, when using mysql_connect engine in database config, to force cake send client_flags param (fifth in mysql_connect). Especially im interested with sending MYSQL_CLIENT_SSL MYSQL_CLIENT_COMPRESS. TIA GP --~--~-~--~~~---~--~~ You received

Re: Extending AppController

2007-08-03 Thread Grzegorz Pawlik
. The ModuleController can't see AppController and extend that class, the actual error msg is: Class 'AppController' not found in module_controller.php on line 3. On Aug 2, 3:05 pm, Grzegorz Pawlik [EMAIL PROTECTED] wrote: Sorry if i just write 2nd time something- thread is long and i could

Re: Extending AppController

2007-08-02 Thread Grzegorz Pawlik
Sorry if i just write 2nd time something- thread is long and i could miss something. Have You tried something like: put in /app/vendors file called module_controller.php with definition class ModuleController extends AppController. Then in /config/bootstrap.php call vendor('module_controller');

Re: Random Image Helper

2007-07-29 Thread Grzegorz Pawlik
post it on bakery :) On Jul 28, 7:14 pm, Mike [EMAIL PROTECTED] wrote: Hi everyone, I made a helper for random images It's at http://mikeski.net/new/snippets/view/24 Enjoy! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Creating/Saving Multiple Records

2007-07-26 Thread Grzegorz Pawlik
You could generate a multiple insert query like that: INSERT INTO 'some_table'(field1, field2) VALUES ('value1', 'value2'), ('value3', 'value3'), (...) And execute it by $this-SomeModel-query(); cheers! On Jul 26, 4:21 pm, Femi Taiwo [EMAIL PROTECTED] wrote: Hi, Question Summary: Is there

Re: post title as parameter for view action... how?

2007-07-23 Thread Grzegorz Pawlik
replace the white spaces, directly from $html-link() call. Thank you! On Jul 22, 10:16 am, Grzegorz Pawlik [EMAIL PROTECTED] wrote: just call $html-link('/posts/view/'.$data['Post']['id'].'/'. $data['Post']['title']); if your view action have only one parameter $id, if it has more. f.e

Re: post title as parameter for view action... how?

2007-07-22 Thread Grzegorz Pawlik
just call $html-link('/posts/view/'.$data['Post']['id'].'/'. $data['Post']['title']); if your view action have only one parameter $id, if it has more. f.e. function view($id, $some_param=null, $some_param2=null); then call it that way:

Re: Error con memcache

2007-07-19 Thread Grzegorz Pawlik
ke? :P Hi mate, i think the probability of getting answers to your problelm will grow if you post it in english. Cheers :) On Jul 18, 7:30 pm, citBolon [EMAIL PROTECTED] wrote: Si alguno conoce el componente memcache probablemente me pueda ayudar. El error que obtengo es el siguiente: Fatal

Re: Too much cake magic in ff browser?

2007-07-16 Thread Grzegorz Pawlik
for this and then let me know if my prophet skills are a little rusty or still in good shape ; ). -- Felix -- My Blog:http://www.thinkingphp.org My Business:http://www.fg-webdesign.de Grzegorz Pawlik wrote: Hi, i found this strange behaviour. When accesing page via firefox

Too much cake magic in ff browser?

2007-07-15 Thread Grzegorz Pawlik
Hi, i found this strange behaviour. When accesing page via firefox 1.5 it acts like it has been reloaded few times (3 exactly). Prove: I've put this code in beforeFilter in /app/app_controller.php : $count = $this-Session-read('count'); $count[] = time(); $this-Session-write('count', $count);

Re: Application specific configuration

2007-05-06 Thread Grzegorz Pawlik
there's a config component based on database- look up on bakery :) On May 6, 7:22 am, Mariano Iglesias [EMAIL PROTECTED] wrote: Or create a file called app/config/config.php like the following: ?php $config['app'] = array( 'setting1' = 'value1', 'setting2' = 'value2' ); ?

Re: Lightbox + Cake

2007-03-14 Thread Grzegorz Pawlik
ofcourse it is. Dot means object member, that's why it is missing name after . operator On Mar 12, 11:21 pm, f. [EMAIL PROTECTED] wrote: Hi, http://img88.imageshack.us/img88/5099/77614616od5.png I think string concatenation is done with '+' in Javascript. Maybe a PHP habit, the dot...;)

Re: invalidate help

2007-02-21 Thread Grzegorz Pawlik
where do You call this function? Is it in some of your controllers method or callback? On Feb 21, 2:44 am, josesquared [EMAIL PROTECTED] wrote: I am using the invalidate function in the controller and it is not triggering the tagErrorMsg. I also tested and it doesn't seem to block the save

Re: About CakePHP Ajax Tutorial

2007-02-12 Thread Grzegorz Pawlik
I have problem with your example: it is working, but right afret changing content of that div page starts to reload, and stays blank for ages. How can i forbid this reload? On Jan 23, 8:20 pm, codecowboy [EMAIL PROTECTED] wrote: -- controllers -- The following controller contains the action