Saturday, October 27, 2007

Cake 1.2.5875 pre-beta some bug with saveField

I have some trouble with Model->saveField('title',$title);

when I switch project to Cake 1.2.5875 pre-beta, suddenly cake set to 0,null,'' all other fields in my table ;-(

But daphonz say, how to fight with this bug:

$saveData = array('Category'=>array('id'=>$category['ParentCategory']['id'],'options'=>serialize($options)));


Not so beauty, but it's work fine.

Good luck, pals!

Monday, October 22, 2007

CakePHP 1.2 pre beta


Now, we all can made dance of fun, and go to to get latest version of Cake:


yep! I', already download my favorite CakePHP 1.2! (Erh, I don't understand why you still using 1.1.* versions?)

I hope, in new october version of 1.2 cake, I haven't problems with saving unique/non unique fields in MySQL...

Labels: , ,

Monday, October 15, 2007

List, JQuery & CakePHP

In my work I will need a online change droplist.

So. I have list of countries, and of course, every country have a lot of cities. And we don't need to put ALL tons of cities in our html code. What we must do?

I don't work with prototype, I love jquery, and I wrote small code in jquery & cakephp.

First, user select country, then script AJAX-working upload list of cities, and user can select needing city.

How? Look my add.thtml (ctp):

For country select:

selectTag('Realty/country_id', $country_list,null,null,null,true)?>

And city select:

selectTag('Realty/city_id', $city_list,null,null,null,true)?>


In top of add.thtml I wrote:

$(document).ready(function() {
$("#RealtyCountryId").change( function () {
$("#sel_city").html("Please wait...");
$.get("/realties/sel_city", {id: $("#RealtyCountryId").val()}, function (data) { $("#sel_city").html(data)} );


And, of course, in realties_controller I have sel_city function:

function sel_city()
$this->layout = null;
$id = intval($this->params['url']['id']);
if (! $id) exit;
$this->City->unbindModel(array('hasMany' => array('Realty'), 'belongsTo' => array('Country')));
$city_list = $this->City->generateList('country_id = ' . $id,'name ASC');

Yep! ;-) Any questions? ;-)

Monday, October 08, 2007

Documentation for CakePHP 1.2

Yep! I got a link! ;-)

Try this rapidshare-link for getting first version of CakePHP 1.2 documentation.

Like 60-70% of complete, but you can find here a lot of useful things ;-) I already read it manual, and hope, you too found this documentation useful. Have a nace baking ;-)