I am new to Silverstripe and have to edit some basics. But there is one problem I've got with the framework.
Inside the Page_Controller I added a pubic function search() where I want to retrieve all pages with a specific keyword in its title.
Anyway. I cannot get even a single page with this:
public function siteSearch() {
//$q = Convert::raw2sql($_POST['q']);
$results = Page::get()->filter(array('ID' => '6'));
echo '<pre>';
print_r( $results );
echo '</pre>';
die();
All I get is an "empty" DataList Object. Not the data itself. What I thought is Page::get() will return all pages, but it doesn't. I get this instead;
DataList Object
(
[dataClass:protected] => Page
[dataQuery:protected] => DataQuery Object
(
[dataClass:protected] => Page
[query:protected] => SQLQuery Object
(
[select:protected] => Array
(
)
[from:protected] => Array
(
[SiteTree] => "SiteTree"
)
[where:protected] => Array
(
)
[orderby:protected] => Array
(
["Sort"] => ASC
)
[groupby:protected] => Array
(
)
[having:protected] => Array
(
)
[limit:protected] => Array
(
)
[distinct:protected] => 1
[delete:protected] =>
[connective:protected] => AND
[replacementsOld:protected] => Array
(
)
[replacementsNew:protected] => Array
(
)
)
[collidingFields:protected] => Array
(
)
[queriedColumns:DataQuery:private] =>
[queryFinalised:DataQuery:private] =>
[querySubclasses:protected] => 1
[filterByClassName:protected] => 1
[queryParams:DataQuery:private] => Array
(
[Versioned.mode] => stage
[Versioned.stage] => Live
)
)
[model:protected] => DataModel Object
(
[customDataLists:protected] => Array
(
)
)
[inAlterDataQueryCall:protected] =>
[failover:protected] =>
[customisedObject:protected] =>
[objCache:ViewableData:private] => Array
(
)
[class] => DataList
[_config_forclass:Object:private] =>
[extension_instances:protected] => Array
(
)
)
Hope you get where my problem is :-D Many thanks all!