Re: CakePHP 2.1.1 Auth/ACL PHPUnit

2012-04-16 Thread rossjha
id']), "controllers/{$controller}/{$action}"); //If user doesn't have permissions, redirect if(!$permissions){ $this->Session->setFlash('You don\'t have permissions for this area', 'flashFailure'); $this->redirect(array('contr

Re: CakePHP 2.1.1 Auth/ACL PHPUnit

2012-04-15 Thread rossjha
Hi thanks for getting back to me, yes I stripped back my login action and I have setFlash, working and I have the session comp in my app_controller. If I try the auth comp I get the same error. If I var_dump I can see the mock obj are there but with empty values. -- Our newest site for the c

CakePHP 2.1.1 Auth/ACL PHPUnit

2012-04-14 Thread rossjha
Hi, I'm trying to create a user controller test case. I'm using Auth/ACL and i'm having problems with mock objects. With the test below, i get the following error: Expectation failed for method name is equal to when invoked 1 time(s). Method was expected to be called 1 times, actually calle

Re: Saving record HABTM

2009-05-30 Thread rossjha
Thanks for getting back to me Alastair. As the assets will have a thumbnail of some kind, I thought to save the product and if a add checkbox == 1 then pass the last product_Id to the assets action, displaying all thumbnails. I'm then using jquery post to post the values to the productsAssets con

Re: Set::extract

2009-04-13 Thread rossjha
Perfect, that worked a treat thank you! On Apr 13, 5:41 pm, grigri wrote: > This should do the trick: > > Set::combine($data, '{n}.title', '{n}.no_tags'); > > hth > grigri > > On Apr 13, 3:30 pm, "ross.hagg...@googlemail.com" > > wrote: > > Hi i have the following array > > > array( > > [0] =>

Re: HABTM Count

2009-04-09 Thread rossjha
This seems to be working. $this->Tag->unbindModel(array('hasAndBelongsToMany' => array ('Improvements'))); $this->Tag->bindModel(array('hasOne' => array( 'ImprovementsTag', 'FilterTag' => array( 'className' => 'Tag',

Re: Add to result array in controller

2009-04-04 Thread rossjha
in my opinion, the > color of the status only has to do with the way you'll view things, it > is in no way related to your data manipulations. > > You're also loading extra stuff in memory by adding that css class > value for every item of your find - not that it really matters b

Re: Undefined index

2009-04-03 Thread rossjha
then why use a loop > at all! > Please confirm that you have validated/checked all the values in all > the records in $results array! > Enjoy, >    John > > On Apr 2, 10:31 pm, rossjha wrote: > > > I successfully change the status value to my desired value, array > >

Re: Undefined index

2009-04-02 Thread rossjha
Changing if(array_key_exists('Improvement'... toif (array_key_exists('Improvements'... removes the notice? Seems to be working now. On Apr 2, 8:31 pm, rossjha wrote: > I successfully change the status value to my desired value, array > below, but i still receiv

Re: Undefined index

2009-04-02 Thread rossjha
27; => string '2009-03-17 09:21:00' (length=19) 'modified' => string '2009-03-17 09:21:00' (length=19) On Apr 2, 8:11 pm, John Andersen wrote: > So it means that the index ['status'] probably doesn't exists! > Check for it as you do

Re: Undefined index

2009-04-02 Thread rossjha
, John Andersen wrote: > Which of the lines are line 38? > > On Apr 2, 8:43 pm, rossjha wrote: > > > Thanks for getting back to me, see below > > > Notice (8): Undefined index:  status [APP\models\improvement.php, line > > 38] > > >         function index()

Re: Undefined index

2009-04-02 Thread rossjha
Thanks for getting back to me, see below Notice (8): Undefined index: status [APP\models\improvement.php, line 38] function index() { $user_id = $this->Auth->user('id'); $conditions = array( 'conditions' => array('Improvement.user_

Re: Add to result array in controller

2009-04-02 Thread rossjha
eiving notices, but i will post a new message. Ross On Apr 1, 9:33 pm, rossjha wrote: > Thanks for getting back to me, just getting to grips witth MVC, so i > wasn't sure adding logic in the view would be the best thing.  Thanks > a lot > > Ross > > PS i will be using css c

Re: Add to result array in controller

2009-04-01 Thread rossjha
Thanks for getting back to me, just getting to grips witth MVC, so i wasn't sure adding logic in the view would be the best thing. Thanks a lot Ross PS i will be using css classes, just a quickie function for demo On Apr 1, 6:36 pm, Jimmy Bourassa wrote: > Your color really should be a CSS cl

Re: Layouts and Elements

2009-03-18 Thread rossjha
Thanks for getting back to me. I think i'm going to try the layouts for now and see where i go. Cheers On Mar 18, 12:39 am, brian wrote: > If you set a var in the controller you'd still need to test in the > view whether or not to include the element, so it wouldn't be much > different than c

Re: Check for empty fields and redirect

2009-02-27 Thread rossjha
Think i've got it. Realised above wouldn't work anyway! user.last_login is null when the new user is created users_controller.php function login(){ $val = false; if(is_null($this->Auth->user('last_login'))){ $val = true;