Re: Problem with transaction in version 2.0

2011-12-20 Thread Vekija
It seems that you're calling transactions methods from the model while you should call them from the datasource instance. Try something like this. $datasource = $this-StadiobingoBet-getDataSource(); $datasource-begin($this-StadiobingoBet); if($this-StadiobingoBet-saveAll($yourdata,

Re: virtualfields + description cache

2011-12-20 Thread vekija
Did you try to set cacheSources to false in the model, as it has cacheSources property? On Dec 19, 5:48 pm, Janos Csikos ja...@csikos.co.uk wrote: Hi All, I have a problem with the description caching in datasource (CakePHP 1.3.12). Or maybe with my solution. My problem: I need to count a

Re: saveField() causes a SELECT COUNT(*)

2010-06-07 Thread vekija
I think it's to be sure that the record actually exists and it's updated. If you make mysql update call on a non-existent record you won't get an error, so the saveField() would return true when it should return false. By executing the COUNT statement saveField() can return false if the record

Re: I'm trying to make a good find with three HABTM models

2010-06-07 Thread vekija
You can try Containable behavior. In models put var $actsAs = array('Containable'); and then in the controller $this-Project-find('all', array('contain' = array('Group' = array('User'; you can find out more about the Containable behavior in the cook book

Re: I'm trying to make a good find with three HABTM models

2010-06-07 Thread vekija
is really appreciated. Thank you in advance! On Jun 7, 3:26 pm, vekija vedran.konto...@gmail.com wrote: You can try Containable behavior. In models put      var $actsAs = array('Containable'); and then in the controller      $this-Project-find('all', array('contain' = array

Re: Model with two belongsTo associations

2010-06-07 Thread vekija
It should work with Containable behavior. for example $categories = $this-Category-find('all', array('contain' = array('Item' = array('Label'; should return an array like: Category 1 Item 1 Label 1 Item 2 Label 2 Category 2 Item 3 Label 3 On Jun

Re: Optional Validation

2010-06-07 Thread vekija
just add 'allowEmpty' = true to the 'state' array On Jun 7, 10:51 pm, naidim nai...@gmail.com wrote: How do you set Cake validation to only verify the rules IF there is content. If the field is left blank (optional field), skip validation. e.g. var $validate = array(     'state' = array(  

Re: Using Javascript-link Inside An Element

2010-06-07 Thread vekija
you have to echo those :) echo $javascript-link('mootools-for-dropdown', false); On Jun 7, 8:43 pm, Dima dmitriy.pind...@gmail.com wrote: I'm pretty new to CakePHP so it is likely that my issue is rather simple to fix.  I have a custom element which I created called nav_menu.cpt.  I call this

Re: Model with two belongsTo associations

2010-06-07 Thread vekija
and leaving well enough alone? Thanks for your quick response! On Jun 7, 1:23 pm, vekija vedran.konto...@gmail.com wrote: It should work with Containable behavior. for example $categories = $this-Category-find('all', array('contain' = array('Item' = array('Label'; should return

Re: Validate data md5

2010-06-05 Thread vekija
of security. It's best practice to use a secure connection whenever you're transmitting passwords. And if you're handling the request over secure http, then it doesn't matter if you send the password back to the user. On Jun 4, 10:08 am, vekija vedran.konto...@gmail.com wrote: When you have

Re: Saving multiple rows of key-value pairs during a single update?

2010-06-05 Thread vekija
Had a similar issue recently when I was trying to save related data array with associative indexes. Since saveAll() won't work with such indexes I had to convert those to the numeric so I put the code in beforeSave() callback. It didn't work. But when I put the code in the controller just before

Re: Validate data md5

2010-06-04 Thread vekija
When you have an error on the registration form, it is a best practice to clear the password value and force the user to renter that info. So, in the controller... if($this-User-save($this-data)) { // ... whatever you do after user had registered successfully } else { // ... there was an

Re: Saving multiple rows of key-value pairs during a single update?

2010-06-04 Thread vekija
I think the easier way to accomplish this would be to adapt the view, like this: echo $this-Form-input('MetaUser.0.meta_key', array('type' = 'hidden', 'value' = 'activation_code')); echo $this-Form-input('MetaUser.0.meta_value', array('label' = 'Activation code')); On Jun 4, 6:48 pm,

Re: Order problem with deep association

2010-06-04 Thread vekija
: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do

Re: Order problem with deep association

2010-06-04 Thread vekija
, shantamg jason.galu...@gmail.com wrote: yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear

Re: Order problem with deep association

2010-06-04 Thread vekija
['Assignment'],             {n}.Person.resident_category_id,             asc         );     } } On Jun 4, 1:04 pm, vekija vedran.konto...@gmail.com wrote: Sorry about that, acidently posted before I finished :) $this-Shift-find('all', array(     'contain' = array

Re: Order problem with deep association

2010-06-02 Thread vekija
Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] =

Re: Photo Uploading,storing in a folder

2009-11-15 Thread vekija
take a look here http://sabbour.wordpress.com/2008/07/18/enhanced-image-upload-component-for-cakephp-12/ On Nov 16, 5:47 am, arunsab arunsa...@gmail.com wrote: Hi all,   i am new in cakephp can anyone show me a sample example of photo uploading in cakephp and same time saving in a folder, --

Re: install other app under cake

2009-10-08 Thread vekija
you can put your blog folder next to the app and edit the .htaccess file something like this... IfModule mod_rewrite.c RewriteEngine on RewriteCond%{REMOTE_HOST} !^http://social.cc/blog$ RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule

Re: Renaming a baked controller

2009-10-08 Thread vekija
In you viewr add array('action' = 'register') as a second parameter to form create function echo $form-create('ModelName', array('action' = 'register')); On Oct 8, 3:16 pm, toneee toneeeda...@googlemail.com wrote: Hi Guys, Im a little confused, im trying to rename a controller that I have

Re: regardin options and default

2009-10-06 Thread vekija
You're missing 'type' parameter... echo $form-input('submited_by', array('type' = 'select', 'options' = $managers, 'selected' = $user_id)); BTW, you can read user's id directly form your view with the session helper... $session-read('UserId'); On Oct 5, 7:00 pm, $$$ sai.cool@gmail.com

Re: Email Validation

2009-10-06 Thread vekija
Add 'allowEmpty' paramter to your email validation rule and set it to true, something like this $validate = array ( 'email' = array('rule' = 'email', 'message' = 'invalid email', 'allowEmpty' = true); ); On Oct 6, 11:03 am, sijo jose jose.s...@gmail.com wrote: Hi folks, I have a email

Re: How to name the fields when 2 fields in a table refers to same field in another table

2009-10-06 Thread vekija
in your service model set relation like this $belongsTo = array( 'ServiceProvider' = array( 'className' = 'User', 'foreignKey' = 'served_by' ), 'ServiceUser' = array( 'className' = 'User', 'foreignKey' = 'served_to', ) ); Then yopu can access the

Re: Problem with editing in-validated messages

2009-10-06 Thread vekija
try removing $this-Message-id = $id; and adding parameters to read function at the bottom $this-data = $this-Message-read(null, $id); and placing a hidden input file in your form for message id echo $form-hidden('Message.id'); On Oct 6, 11:22 am, Arak Tai'Roth nielsen.dus...@gmail.com

Re: Problem with editing in-validated messages

2009-10-06 Thread vekija
. Is this really the way I should go about solving this issue? On Oct 6, 3:57 am, vekija vedran.konto...@gmail.com wrote: try removing $this-Message-id = $id; and adding parameters to read function at the bottom $this-data = $this-Message-read(null, $id); and placing a hidden input file in your

Re: Problem with editing in-validated messages

2009-10-06 Thread vekija
, vekija vedran.konto...@gmail.com wrote: From the book: One thing to note here: CakePHP will assume that you are editing a model if the 'id' field is present in the data array. If no 'id' is present (look back at our add view), Cake will assume that you are inserting a new model when save

sorting records with order by and group by

2009-10-05 Thread vekija
Hi, I'm having a problem with sorting the recordset with order by and group by statements. Would appreciate any help. There are 2 models, Team and Vote (Team has many Votes) and I want to order teams based on the number of votes they got. Here's the find call: $teams = $this-find('all',

Re: Multiple controller for 1 layout

2009-10-05 Thread vekija
You could use requestAction http://book.cakephp.org/view/434/requestAction but beware of the performance impact it might have On Oct 4, 9:39 pm, f m franck.d...@gmail.com wrote: I'd like to know how to display in a single layout, the result of 2 or more controllers ? Thanks for your help

Re: Field Naming conventions and hasmany records

2009-10-05 Thread vekija
You'll have to save the topic first and then fetch it's id. From the cookbook: If neither of the associated model records exists in the system yet (for example, you want to save a new User and their related Profile records at the same time), you'll need to first save the primary, or parent model.

Re: sorting records with order by and group by

2009-10-05 Thread vekija
... On Mon, Oct 5, 2009 at 8:32 AM, vekija vedran.konto...@gmail.com wrote: Hi, I'm having a problem with sorting the recordset with order by and group by statements. Would appreciate any help. There are 2 models, Team and Vote (Team has many Votes) and I want to order teams based

Re: Different Admin routing based on a role field

2009-10-05 Thread vekija
add this to your router file Router::connect('/user/:controller/:action/*', array('prefix' = 'user', 'user' = true)); this will require your actions in the controller to be prefixed as well. In case you want to share actions between the roles but have separate views, you can add a custom

Re: image path in javascript file

2009-10-05 Thread vekija
when you call colorpicker function, add options hash as a second parameter {IMAGE_BASE: 'img/'}. Change the path to one where your images are, but if you store them in your app's image folder it should most likely be /img/. Note the leading and trailing slashes, leading one tells the script to