Created
June 16, 2013 20:48
-
-
Save zoghal/5793384 to your computer and use it in GitHub Desktop.
sample tree eroor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$page = new Page(){ | |
$page->create(); | |
$page->save(array('parent_id' => 10 , 'title' => 'hello')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Page extends AppModel{ | |
public $actsAs = array( | |
'Tree' | |
); | |
public $hasOne = array( 'Category' ); | |
public function beforeFind($queryData) { | |
$queryData['conditions'][$this->escapeField('model')] = 'Page' | |
return $queryData; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `pages` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`site_id` int(11) DEFAULT NULL, | |
`type` varchar(255) COLLATE utf8_persian_ci NOT NULL, | |
`model` varchar(255) COLLATE utf8_persian_ci NOT NULL, | |
`lang` varchar(5) COLLATE utf8_persian_ci NOT NULL, | |
`name` varchar(255) COLLATE utf8_persian_ci NOT NULL, | |
`alias` varchar(255) COLLATE utf8_persian_ci NOT NULL, | |
`home` tinyint(1) NOT NULL DEFAULT '0', | |
`status` tinyint(1) NOT NULL DEFAULT '1', | |
`content_count` int(11) DEFAULT '0', | |
`service_count` int(11) DEFAULT '0', | |
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
`modifed` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', | |
PRIMARY KEY (`id`), | |
KEY `fk_objects_sites_1` (`site_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment