Re: Unable to save related table information

2010-01-15 Thread John Andersen
Yes, your data is not CakePHP compatible. The Rental looks find, but it also includes the Rate. The Rate should be at the same level as Rental, and should look like this: [Rate] = Array ( [0] = Array ( [title] = 1 [day] = ... ) [1] = Array

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
sure thing [code] //Model //datum.php // a basic model nothing unusual here ?php class Datum extends AppModel { var $name = 'Datum'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Form' = array(

Re: saveAll() producing Fatal Error

2010-01-15 Thread John Andersen
SCS is right! Looks like your problem is the var $data definition! The reason is the each model already has the $data defined! You should use another name! See http://api.cakephp.org/class/model for the models properties, so you don't conflict with them! Enjoy, John On Jan 15, 10:40 am,

Re: adding multiple translations in i18n table for single record

2010-01-15 Thread Brendon Gleeson
i managed to sort it out Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
BTW tried changing my data_controller name and it made no difference I still get the same error Fatal error: Call to a member function getColumnType() on a non-object in /cake/libs/model/model.php on line 950 On Jan 14, 9:39 pm, scs scs2...@gmail.com wrote: the getColumnType() is making me

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
@john thanks I tried making data_controller dataaa_controller and changing all references to it but sadly no luck still the exact same problem. On Jan 15, 10:00 am, MrDevin mr.de...@gmail.com wrote: BTW tried changing my data_controller name and it made no difference I still get the

Re: How to saveField without affecting modified

2010-01-15 Thread majna
touch behavior: http://bakery.cakephp.org/articles/view/touchbehavior On Jan 15, 4:20 am, Alfred Pakenham alfred.paken...@gmail.com wrote: Hi, I'm sure I have seen this somewhere, but can't remember where. How do I save a field and make sure that modified is not changed? For example I have a

Re: saveAll() producing Fatal Error

2010-01-15 Thread John Andersen
You are welcome :) but my issue was not with the data controller, but whether or not the following is defined in your model? [code snippet] //this is from my latest schema snapshot var $data = array( 'id' = array('type' = 'integer', 'null' = false, 'default' = NULL, 'key' = 'primary'),

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
sorry for the confusion. the following code was from my schema snapshot schema_5.php I believe. This is only used to to make sure my tables in MYSQL are structured correctly and not actively running anywhere. [code snippet] //this is from my latest schema snapshot var $data = array( 'id' =

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
i screwed up writing that Thanks for your patience is supposed to be on the end and have a period. :) On Jan 15, 2:19 pm, MrDevin mr.de...@gmail.com wrote: sorry for the confusion. the following code was from my schema snapshot schema_5.php I believe. This is only used to to make sure

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread codef0rmer
@Walther: thx i knew, i would get a valid solution. i tried upgrading my cakephp 1.2.5 to 1.3 alpha, but when i use below code in User Model, error comes... var $virtualFields = array( 'name' = 'CONCAT(User.first_name, ' ', User.last_name)' ); syntax error, unexpected

Re: saveAll() producing Fatal Error

2010-01-15 Thread John Andersen
Can I understand it, that you have a table named data, for which is defined a model named Datum? If yes, then I am trying to do the same now, and want to see what happens in case of a saveAll after an edit operation. Enjoy, John On Jan 15, 3:20 pm, MrDevin mr.de...@gmail.com wrote: i screwed

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread Amit Rawat
try this var $virtualFields = array( 'name' = 'CONCAT(User.first_name, , User.last_name)' ); regards, amit Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google

Different expiry values for different sessions

2010-01-15 Thread Kareem Sabri
Hello, I'd like to have different sessions have different lifetimes. For general users I'd like the sessions to persist for days, but for Admin users I'd like the sessions to expire when the browser closes. Is this possible? Thanks in advance. Check out the new CakePHP Questions site

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
You understand correctly. WOW! thanks for putting so much effort in to my problem! On Jan 15, 3:06 pm, John Andersen j.andersen...@gmail.com wrote: Can I understand it, that you have a table named data, for which is defined a model named Datum? If yes, then I am trying to do the same now, and

Re: ah - screwed up my auth/login!

2010-01-15 Thread euromark
after hours of testing i finally found the source the security component and its black hole (i added it to the controller in the components var and seemed to work - except for the login of course) i wonder why a) it's triggered in the first place b) does just trigger a white screen of death

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread codef0rmer
@Amit Rawat: oh, silly mistake. I really need to keen my observation ;) var $virtualFields = array( 'full_name' = 'CONCAT(User.first_name, , User.last_name)' ); but the full_name key is not coming in $arrUser = $this-User-find(first, array( fields = array(

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread John Andersen
Remove the fields statement and see what you get! Enjoy, John On Jan 15, 5:00 pm, codef0rmer amit.2006...@gmail.com wrote: @Amit Rawat: oh, silly mistake. I really need to keen my observation ;) var $virtualFields = array(        'full_name' = 'CONCAT(User.first_name, , User.last_name)'

Re: ACL Question

2010-01-15 Thread scs
Make sure you do not have var $components = array('Acl'); in you app_controller or any other controllers On Jan 14, 8:48 pm, Dave make.cake.b...@gmail.com wrote: I get this error as soon as i login Could not find AclComponent. Please include Acl in Controller::$components.

Re: saveAll() producing Fatal Error

2010-01-15 Thread scs
Maybe I'm missing something but if you are using a model called Datum for a table in your database called dataare you adding the line var $useTable = 'data'; in your model for it is looking at that table? On Jan 15, 9:30 am, MrDevin mr.de...@gmail.com wrote: You understand correctly. WOW!

Role name vs ID

2010-01-15 Thread Dave
When my user logs in the User.role_id is there in the Auth Session data. User] = Array ( [id] = 4b4fed29-3a54-4c72-964d-01944adcd75b [role_id] = 4b4fe97e-d974-4f49-8793-2ade4adcd75b My Role.id's are char(36) UUID so i get

RE: ACL Question

2010-01-15 Thread Dave
Yeah it was only in the app_controller, but I just dumped cache folder and seemed to clear it up. Thanks, Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of scs Sent: January-15-10 12:51 PM To: CakePHP Subject: Re: ACL Question Make

Re: saveAll() producing Fatal Error

2010-01-15 Thread John Andersen
Ok, got it now! It is the table name data that make CakePHP fail in the model in the function getColumnType! This function is also used when asking for the table column type and when your happen to have a table named data, this statement gives the wrong result! [code] if ($model != $this-alias

Re: ACL Question

2010-01-15 Thread Jon Bennett
Yeah it was only in the app_controller, but I just dumped cache folder and seemed to clear it up. If it's in AppController then all controllers inherit and will use it. Any components you put in a specific controller are merged with Appcontroller's, not overwritten. j -- jon bennett -

RE: ACL Question

2010-01-15 Thread Dave
I know. I was removing ACL from the app. It was only in app_controller but when I removed it I was getting errors. That's all, its all good. Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message

Auth Permission Based System

2010-01-15 Thread Dave
The site I am building has Users which hasOne Role, Role hasMany Users. So its pretty simple where Users can only edit/delete thier own info but I need to restrict controller actions based on the User.group_id and was wondering are there any simple , quick and effective ways to do this? Starting

Replacing an select/option drop down in views to a specific value.

2010-01-15 Thread Guran
I am building a expense submitter system. I have employees who have a name field and an employee_id field. In the view - views/expenses/add.ctp Cake has generated the following code: ?php echo $form-input('employee_id'); ?. This results in a select/ option drop down listing all the employees.

Re: Replacing an select/option drop down in views to a specific value.

2010-01-15 Thread John Andersen
Can the employee choose another employee id in the select list? If the employee is not allowed to choose another employee id, then just show the existing employee id as a label, not a list. For preselecting the employees id in the select list, add the employees id to the controllers data

Multiple table1 FKs referring to single table2 PK

2010-01-15 Thread McScreech
Hello, In the book sections http://book.cakephp.org/view/78/Associations-Linking-Models-Together 3.7.6.2 hasOne #hasOne-80 3.7.6.3 belongsTo #belongsTo-81 3.7.6.4 hasMany #hasMany-82 3.7.6.5 hasAndBelongsToMany (HABTM) same link#hasAndBelongsToMany- HABTM-83 I read: Possible keys for

Re: Unable to save related table information

2010-01-15 Thread koala kid
Thanks, that fixed it. For some reason I had Rate/ instead of Rate. in my HTML form as the input name, changing that and its now saving. Thanks for the tip. However I've now got another issue! When I submit the form the data is being saved but I get a PHP warning: Warning (2): Illegal offset

Re: Replacing an select/option drop down in views to a specific value.

2010-01-15 Thread Guran
John; Thanks for the response. I am sorry I did not understand. I am a newbee. the code ?php echo $form-input('employee_id'); ? generated by cake produces a drop down of all employee names in the database. Instead I want to present only the name of the logged in employee since the expense

Re: Unable to save related table information

2010-01-15 Thread koala kid
FYI my POST data now looks like this: Array ( [Rental] = Array ( [id] = 1 [rental_code] = SMpenthouse [location_id] = 7 [rental_agent] = m...@gmail.com [rental_meta_title] = [rental_meta_desc] =

Re: saveAll() producing Fatal Error

2010-01-15 Thread MrDevin
You rock Thanks :D :D !!! On Jan 15, 5:37 pm, John Andersen j.andersen...@gmail.com wrote: Ok, got it now! It is the table name data that make CakePHP fail in the model in the function getColumnType! This function is also used when asking for the table column type and when your happen to

Re: Unable to save related table information

2010-01-15 Thread John Andersen
You probably get the warning due to the following: [code] class Rate extends AppModel { var $name = 'Rate'; var $belongsTo = 'Rentals'; } [/code] Observe that you have given your Rental model as Rentals in the belongsTo association! Fix that and the warning should go away. Enjoy,

Pagination/Sorting of i18n entries - HOW?

2010-01-15 Thread DigitalDude
Hey, I recently added i18n support for multilanguage abilities on dynamic content. So far, so good, works perfect. But HOW can I use the sorting in index views for a dynamic multilanguage field? Let's say I have id, title and description as sorting keys in my index view, and title and

Re: Unable to save related table information

2010-01-15 Thread koala kid
I already fixed that at some point whilst looking for the problem. My classes now look like this: class Location extends AppModel { var $name = 'Location'; var $hasMany = array( 'Rental' = array( 'className' = 'Rental', 'order' =

Re: Unable to save related table information

2010-01-15 Thread koala kid
I definitely have something funny going on with these associations, I just noticed that when I do an update on the Rentals, it creates a NEW entry in the Rate table rather than updating the entry with the correct ID. Boy this ORM stuff just confuses the hell out of me. koala kid wrote: I

Re: Auth Permission Based System

2010-01-15 Thread DigitalDude
Hey, you could do a quick check whether a record belongs to a user or not and then redirect him/her or sth like that. For example, if a user tries to edit it's own record, and the url would be users/edit/5 (which means you call the action 'edit' in your user's controller, and the record-id is 5)

redirect problem in cake 1.2.5

2010-01-15 Thread postman
Hello! I have a problem with -redirect() in my controller. I've downloaded the cakephp 1.2.5 empty project and created users_controller, here is it: class UsersController extends AppController { var $name = Users; function index() { echo 'index'; } function test()

Some doubts about ACL

2010-01-15 Thread Douglas Pacheco Cardoso
Hi, how are you? I'm a new membership... Please, i want to use ACL to do control of permissions on my system. I understand how it works, how to check permissions and more, but i don't know getting to join ideas to create one page for manage of this permissions. Example: I want to select the

Re: Unable to save related table information

2010-01-15 Thread John Andersen
If you are editing an existing record, then your data must include the id, so that the model knows that it is an existing record and not a new one. If the id is not present, then the model will create a new record. So your data array for the Rate should also include the id, like this: [code]

Re: redirect problem in cake 1.2.5

2010-01-15 Thread John Andersen
Try to turn on debug and replace your statement in the index method with debug('In index'); You echo statement in the index method may be the one that makes an output, before the index view starts doing that, thus giving you the error! Debug is turned on in your app/config/core.php file - look

RE: Auth Permission Based System

2010-01-15 Thread Dave
In my setup I have 3 routes set up Admin, Manager, Member. The controllers each have admin_ manager_ and member_ function / action since each role plays a different part in the site. So a member for example can only access member_ functions / actions and I have in app_controller beforeFilter():

No download progress using media view

2010-01-15 Thread bram
My app delivers jpeg images and zip files through the media view. Even though the content length is specified correctly in the response headers, the browser doesn't use it to display the download progress. These are the request and response headers: GET http://localhost/test/DSC03701.jpg Load

Re: Unable to save related table information

2010-01-15 Thread koala kid
OK, again thanks for your help. So I have the ID being passed back as a hidden field: echo $form-input('id', array('type'='hidden', 'value' = $rental['Rental']['id'])); I thought that Cake would, due to the relationship I set up in the Model, grab the ID from Rental and pass it to Rate as