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 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 value based

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, array('

Re: no flash messages in the login page using cake 1.3

2010-06-10 Thread vekija
In your login view add echo $session->flash('auth); On Jun 10, 5:29 pm, Windex wrote: > Well, I guess I figured it out... not entirely sure what I did but the > last thing was to adjust the debug level up and down and then back to > where it was when I started having the problem.  =\ > > On Jun

Re: Model with two belongsTo associations

2010-06-07 Thread vekija
oad it's associated Label? Or am I better off just > doing it via "contain" and leaving well enough alone? > > Thanks for your quick response! > > On Jun 7, 1:23 pm, vekija wrote: > > > > > It should work with Containable behavior. > > > for exam

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 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 element from defaul

Re: Optional Validation

2010-06-07 Thread vekija
just add 'allowEmpty' => true to the 'state' array On Jun 7, 10:51 pm, naidim 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: 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

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

2010-06-07 Thread vekija
rmation to be > able to present it in the above described way? Otherwise I'm not sure > as to how I could first filter out all the projects I'm involved with > and then go hunt for the groups and users. Any insights on this matter > is really appreciated. > > Thank you

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 http://book.cak

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 doe

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 th

Re: Validate data & md5

2010-06-04 Thread vekija
ity. > > 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 wrote: >

Re: Order problem with deep association

2010-06-04 Thread vekija
contain, Set::sort() only takes one sort > parameter. > > if (isset($area['Shift'])) { >     foreach($area['Shift'] as &$shift) { >         $shift['Assignment'] = Set::sort( >             $shift['Assignment'], >             "{n}.Person

Re: Order problem with deep association

2010-06-04 Thread vekija
C, Person.name ASC' ) ) ) )); On Jun 4, 11:29 am, shantamg 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 wrote: > > > > &

Re: Order problem with deep association

2010-06-04 Thread vekija
lds? > something like: Person.category_id asc, Person.name asc > > On Jun 2, 12:21 am, vekija 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 > > >

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, mw

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 e

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'] = Set::sort($data['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 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, -- You received t

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 wrote: > Hi Guys, > > Im a little confused, im trying to rename a controller that I have > baked. > > I have cr

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... RewriteEngine on RewriteCond%{REMOTE_HOST} !^http://social.cc/blog$ RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] please note that I'm by no means an

Re: Problem with editing in-validated messages

2009-10-06 Thread vekija
elp. However I do > have one more question. I never encountered this being added to views > in anything that I read about doing data validation. So I am just > wondering if I am doing something wrong from the get go that makes it > so that I have to add this, or is this just standard p

Re: Problem with editing in-validated messages

2009-10-06 Thread vekija
he way most things are done in CakePHP. > Is this really the way I should go about solving this issue? > > On Oct 6, 3:57 am, vekija wrote: > > > try removing $this->Message->id = $id; and adding parameters to read > > function at the bottom > > > $this->

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" wrote: > So, my subjec

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

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 wrote: > Hi folks, > > I have a email field which is n

Re: regardin options and default

2009-10-05 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, "$$$" wrote: > add functio

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 s

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: sorting records with order by and group by

2009-10-05 Thread vekija
... > > On Mon, Oct 5, 2009 at 8:32 AM, vekija 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

Re: Field Naming conventions and hasmany records

2009-10-04 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: Multiple controller for 1 layout

2009-10-04 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 wrote: > I'd like to know how to display in a single layout, the result of 2 or > more controllers ? > > Thanks for your help > Franck --~--~--

sorting records with order by and group by

2009-10-04 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', array(