UnitTests - The Real World

2011-11-14 Thread Thiago Belem
Folks, I've read alot about UnitTests and participated on several coding dojos but I can't figure out how apply the TDD on a real world CakePHP application. I know HOW to test, assert and etc. I just don't know exacly WHAT to test, since eve

Re: PHP 5.4

2011-11-14 Thread euromark
if you are in E_STRICT mode in PHP (which you seem to be) you will be notified if you don't use the exact param declaration in the inheriting classes. the Model::beforeSave() is: public function beforeSave($options = array()) {} so you need to use the exact same params (with the exact same def

PHP 5.4

2011-11-14 Thread David Sheeks
I put 5.4 on a vmware server to check cakephp against it and everything appears to work, but i'm getting the following notice: Declaration of AppModel::beforeSave() should be compatible with Model::beforeSave($options = Array) [*APP/Model/AppModel.php*, line *34*] -- Our newest site for the comm

Re: Clean solution to sharing common Views

2011-11-14 Thread Graham Weldon
Hey, My recommendation would be to look at the solution that jrbasso has created for CakePHP 2.0: https://github.com/jrbasso/json_plugin It has extensive installation and usage information, making it dead easy to use. This is a custom view class that allows you to eliminate the need for a view

Re: Containable Memory Usage

2011-11-14 Thread euromark
just stumbled upon Andy Dawson's OneQueryBehavior https://github.com/AD7six/mi/blob/master/models/behaviors/one_query.php seems like the wheel already got invented ;) it looks quite promising and "optimized containable" not that unrealistic after all. I will have to check that one out some time.

Clean solution to sharing common Views

2011-11-14 Thread Shukuboy
Hi, I've been trying to find the best way to share a basic JSON View across my application. The view is quite simple and only contains : The view is used across the application thorough a utility method in the AppController : protected function renderJSONResponse($response) { $this -

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Matthew Kaufman
Is this GitHub documentation different from what is hosted on the CakePHP Docs Website? (https://github.com/cakephp/docs.git) Then do I need to do the below?: -- == Building the documentation == After installing the require packages you can build the documentation using Make # Create all the H

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Matthew Kaufman
Yeah seriously; it is better though. LOL On 11/14/11, euromark wrote: > and it should also be mentioned that now all keys are (forced) > lowercase. > I dont know WHY but thats how it is now.. > really messed up tons of my library classes - which of course were > looking for keys like "Data" inste

Re: Using REST In CakePHP 2.0

2011-11-14 Thread jeremyharris
The 2.0 docs are hosted on github here: https://github.com/cakephp/docs Glad that worked out for you! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Will
Thanks for the link, Jeremy! I restructured my array to match the API documentation and it worked. Where does one submit an update from the book? On Nov 14, 4:47 pm, jeremyharris wrote: > XML has been completely reworked in CakePHP 2.0 > > Take a look at the API docs here:http://api20.cakephp.o

Re: Using REST In CakePHP 2.0

2011-11-14 Thread euromark
and it should also be mentioned that now all keys are (forced) lowercase. I dont know WHY but thats how it is now.. really messed up tons of my library classes - which of course were looking for keys like "Data" instead of now "data" took me hours to fix all occurrences of this change. especially i

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Matthew Kaufman
Yes, you can feel free as well as I would have if I knew how to do it; I did look at the XML class. On Mon, Nov 14, 2011 at 6:47 PM, jeremyharris wrote: > XML has been completely reworked in CakePHP 2.0 > > Take a look at the API docs here: http://api20.cakephp.org/class/xml > > Notice that you

Re: Jenkins + CakePHP

2011-11-14 Thread Graham Weldon
There is nothing super special about it. We are using github web hooks to fire builds. Pre-build steps setup the environment so we can guarantee unpolluted tests: cat > app/Config/database.php <<'DATABASE_PHP' 'Database/Mysql', 'host' => 'localhost', 'database' => 'test_cakephp', '

Re: Concurrency control

2011-11-14 Thread euromark
The only behavior in that direction I can think of is called "LockTable Behavior" it restricts to either read/write for a complete table but maybe you can modify it to restrict access to rows for certain users for a certain amount of time etc On 14 Nov., 17:14, phpMagpie wrote: > Not sure if th

Jenkins + CakePHP

2011-11-14 Thread Thiago Belem
I've seen the new CakePHP tests reports running in Jenkinsand I want to know if there's any material about this setup and how I can configure to my projects. I found some guides about configuring Jenkins for PHPbu

Re: Using REST In CakePHP 2.0

2011-11-14 Thread jeremyharris
XML has been completely reworked in CakePHP 2.0 Take a look at the API docs here: http://api20.cakephp.org/class/xml Notice that you need one root element when building from an array. The book probably just needs to be updated. Feel free to submit an update if you get some time :) -- Our newe

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Matthew Kaufman
Yes Thank you 000w.s.s.000 for your reply; I have the exact same setup as well now for the temporary work-around. It makes me question slightly what CakePHP is Good For again any more; am I wrong in my thinking? Why is this so overly complex to do something that is supposed to be very simple. Doe

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Will
Hi Matt, I saw your post from a few days ago. I copied my code from the tutorial, but it did not work at all. I can only get XML::build() to work with a one element array. Creating an array such as array("Employees"=>$this->Employee->find('all')) was also giving me an error, so I've devised the

Re: Using REST In CakePHP 2.0

2011-11-14 Thread Matt Kaufman
Me too. It doesn't work the way that it does in 1.3. It used to work but does not in Cake 2. Look at my mailing list posts from a few days ago on this topic. Matt Kaufman Http://mkfmn.com Sent from my iPhone On Nov 14, 2011, at 10:58 AM, Will <000w.s.s@gmail.com> wrote: > Hi all, > >

Re: onClick in button

2011-11-14 Thread Dominik Gajewski
Script is working fine in nonCakePHP page. I'm adding script from js file. 2011/11/13 CrotchFrog : > Just to eliminate the obvious ...  have you included the .js > using $this->Html->script() or some other method? > Have you checked the script for errors using Firebug or something similar? > > --

Re: CakePHP 2.0.3 out of the oven

2011-11-14 Thread dype
Many thanks for this new release ! But I've still have the with screen with phpunit 3.6 (pear installation). It works fine with the vendor installation : https://gist.github.com/1332693 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePH

paginated comments not showing up in view

2011-11-14 Thread Daniel
I am fetching comments related to a post in the view function in the posts_controller : $this->paginate = array( 'Comment' => array( 'limit'=> 2, 'page'=> 1, 'order'=> array('Comment.created' => 'desc'), 'conditions

Using REST In CakePHP 2.0

2011-11-14 Thread Will
Hi all, I am trying to activate the REST functionality in CakePHP 2.0 for one of my models called "Employee". In my controller, I have: function index(){ $this->set('employees', $this->paginate('Employee')); } In my view for the XML (/app/View/Employees/xml/index.ctp), I have: saveXML

Re: Form from another model in a view

2011-11-14 Thread Diogo
That's exactly my line of thinking. I might use a comments controller if it's being used on more than one model. Other than that, I think it's not worth all the work. Thanks! On Nov 14, 2:32 pm, phpMagpie wrote: > I don't think there is a right and wrong way to be honest, I have done this > in th

Re: How to paginate "subtable" in a view?

2011-11-14 Thread Daniel
On Nov 13, 5:27 pm, phpMagpie wrote: > ... > In essence you need a separate find for your category: > $this->set('category', $this->Category->find('first', array( >   'conditions' => array('Category.id' => $id), >   'contain' => array( >     'Post' => array('User' => array('id', 'username') ) >

Re: CakepHP 2.0 plugins no longer have a default controller?

2011-11-14 Thread Richard@Home
Just in case anyone else is looking for the answer to this: I posted a ticket on CakePHP's issue tracker: http://cakephp.lighthouseapp.com/projects/42648/tickets/2237-20-plugins-dont-have-a-default-controller To which Mark responded and updated the migration guide: http://book.cakephp.org/2.0/e

Should configure(Cache.check) set = false in beforeSave and beforeDelete ?

2011-11-14 Thread Điển vũ
I think configure::write('Cache.check', false) beforeSave and beforeDelete in AppModel.php --- ex: in case, Author hasMany Book and I have a lot cache of action : BooksController->view , 1000 cache file Then i create new a author, if Cache.check == true, it will au

Re: Re-order an Array

2011-11-14 Thread phpMagpie
http://book.cakephp.org/view/1492/combine HTH, Paul. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send

Re: Message: No input file specified.

2011-11-14 Thread phpMagpie
When it works on local server and doesn't once uploaded, the only variable is your server's configuration and .htaccess, mod_rewrite, DBO tend to be the main culprits. HTH, Paul. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Que

Re: Form from another model in a view

2011-11-14 Thread phpMagpie
I don't think there is a right and wrong way to be honest, I have done this in the Comment controller and in my BlogPost controller, if comments are used across many models then probably best to centralize logic in comments controller. I don't worry about field by field validation errors for co

Re: Message: No input file specified.

2011-11-14 Thread Mister Mistah
lol i promise i tried that!! It ended up being my .htaccess files. they were wrong for some reason, but good to go now thanks! On Nov 14, 9:54 am, phpMagpie wrote: > http://lmgtfy.com/?q=No+input+file+specified+cakephp -- Our newest site for the community: CakePHP Video Tutorials http://tv

Re-order an Array

2011-11-14 Thread Gerrit
Hello everybody, is there a method in CakePHP which allows me to convert the following array to the expected result? I extract my start to a group by creteria. Array ( [0] => Array ( [Route] => Array ( [id] => 3 [sta

Re: Auth component problem

2011-11-14 Thread phpMagpie
$this->Auth->fields = array('username' => 'email', 'password' => 'password'); // no capital F HTH, Paul -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP relat

Re: Auth component problem

2011-11-14 Thread phpMagpie
Which version of Cake you using? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+un

Re: Concurrency control

2011-11-14 Thread phpMagpie
Not sure if there is an existing behaviour, but if you create a created and modified field Cake will automagically update them. Check these to see if they have been updated since form load et voila. HTH, Paul -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org

Posting form data with JSON

2011-11-14 Thread senser
Hello, I'm working on project that is planned to heavily rely on data exchange with JSON. Here is an exemplary ajax call that posts JSON data to Cake's controller (code is in the view): $.ajax({"url": "/project/Controller/action "data": JSON.stringify($(this).serializeArray()), "type": "POS

Re: my own controller instead of user_controller login problem

2011-11-14 Thread danswater
thank you for your quick response sir. i will remember your tip and try to understand more cakephp -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related que

Re: primaryKey in cake 2.0

2011-11-14 Thread sixthpoint
I looked through my code and found that it is just not throwing a error when linking models, I had "Users" instead of "User" as my model in the association. For some reason i thought it should throw a error if the model did not exist? Is this a issue or done intentionally? On Nov 13, 11:14 pm, Gra

Re: my own controller instead of user_controller login problem

2011-11-14 Thread danswater
thank you for your quick response sir. I will try to read your links that you posted. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To u

Form from another model in a view

2011-11-14 Thread Diogo
So I'm trying to extend the Blog tutorial adding some comments: Post hasMany Comments I want to display the add comment form in the same view as the 'post view'. Thing is I don't know the best way to get this approach. I thought about three ways: Creating a function in Comments Controller to han

Concurrency control

2011-11-14 Thread Ernesto
Hi all i'm looking to implement a Concurrency Control Behavior who looks if data has been modified by someone between the time user loads and tries to save it. Is there any pre-made behavior? i lurked the bakery but found nothing. -- Our newest site for the community: CakePHP Video Tutorials

Re: my own controller instead of user_controller login problem

2011-11-14 Thread euromark
you should also be aware of uppercase and lowercase naming of your objects On 14 Nov., 15:46, phpMagpie wrote: > From page:http://book.cakephp.org/view/1250/Authentication > > "Now, there are a few conventions to think about when using AuthComponent. > By default, the AuthComponent expects you t

Re: CakePHP and Sqlite

2011-11-14 Thread zer0_gravity
thanks On Nov 14, 9:58 am, zer0_gravity wrote: > Thanks > > On Nov 13, 5:10 am, Matteo Landi wrote: > > > > > > > > > On Sun, Nov 13, 2011 at 5:25 AM, zer0_gravity wrote: > > > Having trouble setting up CakePHP to work with Sqlite? could you > > > explain or point me to where I can get info in

Re: CakePHP and Sqlite

2011-11-14 Thread zer0_gravity
Thanks On Nov 13, 5:10 am, Matteo Landi wrote: > On Sun, Nov 13, 2011 at 5:25 AM, zer0_gravity wrote: > > Having trouble setting up CakePHP to work with Sqlite? could you > > explain or point me to where I can get info in rewards to this. > > > thanks > > FWIW a couple of weeks ago I wrote a min

Re: Site not working in shared host showing 500 Internal server error

2011-11-14 Thread phpMagpie
http://lmgtfy.com/?q=cakephp+500+Internal+Server+Error -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, sen

Auth component problem

2011-11-14 Thread anjith
Hi, I am using auth component for login, it is working fine when database table columns are username and password if i use email as column name even though i specified the fields as below in app_controller.php its not working in beforeFilter() method. $this->Auth->Fields = array('username' => 'em

Re: Message: No input file specified.

2011-11-14 Thread phpMagpie
http://lmgtfy.com/?q=No+input+file+specified+cakephp -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send

Re: my own controller instead of user_controller login problem

2011-11-14 Thread phpMagpie
>From page: http://book.cakephp.org/view/1250/Authentication "Now, there are a few conventions to think about when using AuthComponent. By default, the AuthComponent expects you to have a table called 'users' with fields called 'username' and 'password' to be used." So if you insist on using a

Site not working in shared host showing 500 Internal server error

2011-11-14 Thread anjith
Hi, I have developed a site using cake bake tool in localhost and uploaded to shared host, i uploaded as it is from local to server and changed the database file accordingly. Problem is i am getting following error, i have re-checked everything again and again. Did I forgot anything. "The server

my own controller instead of user_controller login problem

2011-11-14 Thread danswater
Hi all! I am new in cakephp and i just downloaded cakephp ver. 1.3.13 and give it a try. I made a simple login/logout application using the auth component. I have a students and profiles tables in my database and i bake it using "cake bake all" so that it generates CRUD function. And i made an app

Re: TimeHelper problem

2011-11-14 Thread john lyles
Thanks Thiago, that was the problem On Nov 13, 10:32 pm, Thiago Belem wrote: > Did you enabled the TimeHelper on the $helpers property on your Controller? > > http://book.cakephp.org/2.0/en/controllers.html#Controller::$helpers > > Cya, > -- > ***Thiago Belem* > Desenvolvedor > Rio de Janeiro - R

Re: Question on the session handler

2011-11-14 Thread Graham Weldon
Hey, You should be able to change your session configuration slightly: /// in: Config/core.php Configure::write('Session.handler', array( 'model' => 'MySession' )); Configure::write('Session', array( 'defaults' => 'database' )); /// Create your session model in: Model/MySession.php From ther

Re: hi need to maintain to layouts one for admin and one for remaining

2011-11-14 Thread euromark
if (!empty($this->params['admin'])) {} suffices On 14 Nov., 11:20, anjith wrote: > Its working. > > On Nov 14, 3:05 pm, Xoubaman wrote: > > > > > > > > > In AppController::beforeFilter > > > iif (isset($this->params['admin']) && ($this->params['admin'] == 1)) { > > $this->layout = 'admin';

Re: hi need to maintain to layouts one for admin and one for remaining

2011-11-14 Thread anjith
Its working. On Nov 14, 3:05 pm, Xoubaman wrote: > In AppController::beforeFilter > > iif (isset($this->params['admin']) && ($this->params['admin'] == 1)) { > $this->layout = 'admin'; > > } > > This is for Cake 1.3, in Cake 2 I know $this->params has been replaced with > other similar propert

Re: hi need to maintain to layouts one for admin and one for remaining

2011-11-14 Thread Xoubaman
In AppController::beforeFilter iif (isset($this->params['admin']) && ($this->params['admin'] == 1)) { $this->layout = 'admin'; } This is for Cake 1.3, in Cake 2 I know $this->params has been replaced with other similar propertie. -- Our newest site for the community: CakePHP Video Tutorials h

Question on the session handler

2011-11-14 Thread socrates
Hello, I have create two separate web applications but this application have to share the same db, so I thought I would create two separate tables for session management on db, my question would be, can I do this through configuration, or do I create a new session handler? thanks for your attention

Re: Whats nes in Version 2?

2011-11-14 Thread Gerrit
Okay, thank you. I had expected some big changes. On 14 Nov., 09:51, AD7six wrote: > On Nov 14, 9:43 am, Gerrit wrote: > > > Hello everybody... > > > can anybody tell me what's new in version 2? I didn't find a summery > > anywhere. > > http://lmgtfy.com/?q=cakephp+2.0 > > Strange that none of t

Re: Whats nes in Version 2?

2011-11-14 Thread AD7six
On Nov 14, 9:43 am, Gerrit wrote: > Hello everybody... > > can anybody tell me what's new in version 2? I didn't find a summery > anywhere. http://lmgtfy.com/?q=cakephp+2.0 Strange that none of those results were relevant. My Personal favorite is the one titled "CakePHP 2.0 released | The Bake

Re: Strange Session Data Corruption on CakePHP

2011-11-14 Thread AD7six
On Nov 14, 7:06 am, Rayhan Chowdhury wrote: > Yes, I want to back to this url later, but it gets changed, so I am in > big trouble... Start from the assumption that code doesn't lie or magically do different things than asked How is it possible for .. /loading2.gif to be stored in the session

Whats nes in Version 2?

2011-11-14 Thread Gerrit
Hello everybody... can anybody tell me what's new in version 2? I didn't find a summery anywhere. Thanks! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP rel