mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
Update use of DataObject methods (as per framework #3799)
This commit is contained in:
parent
9d7a640205
commit
e0afd2f772
@ -31,8 +31,17 @@ class SiteTreeFileExtension extends DataExtension {
|
||||
$rememberSubsiteFilter = Subsite::$disable_subsite_filter;
|
||||
Subsite::disable_subsite_filter(true);
|
||||
}
|
||||
|
||||
if($filter || $sort || $join || $limit) {
|
||||
Deprecation::notice('3.2', 'The $filter, $sort, $join and $limit parameters for
|
||||
SiteTreeFileExtension::BackLinkTracking() have been deprecated.
|
||||
Please manipluate the returned list directly.', Deprecation::SCOPE_GLOBAL);
|
||||
}
|
||||
|
||||
$links = $this->owner->getManyManyComponents('BackLinkTracking', $filter, $sort, $join, $limit);
|
||||
$links = $this->owner->getManyManyComponents('BackLinkTracking')
|
||||
->where($filter)
|
||||
->sort($sort)
|
||||
->limit($limit);
|
||||
$this->owner->extend('updateBackLinkTracking', $links);
|
||||
|
||||
if(class_exists("Subsite")){
|
||||
|
@ -27,7 +27,7 @@ class SiteTreeFolderExtension extends DataExtension {
|
||||
$ids = $query->execute()->column();
|
||||
if(!count($ids)) continue;
|
||||
|
||||
foreach(singleton($className)->has_one() as $relName => $joinClass) {
|
||||
foreach(singleton($className)->hasOne() as $relName => $joinClass) {
|
||||
if($joinClass == 'Image' || $joinClass == 'File') {
|
||||
$fieldName = $relName .'ID';
|
||||
$query = DataList::create($className)->where("$fieldName > 0");
|
||||
|
@ -109,7 +109,7 @@ class SiteTreeLinkTracking extends DataExtension {
|
||||
}
|
||||
|
||||
// Update the "LinkTracking" many_many
|
||||
if($record->ID && $record->many_many('LinkTracking') && $tracker = $record->LinkTracking()) {
|
||||
if($record->ID && $record->manyManyComponent('LinkTracking') && $tracker = $record->LinkTracking()) {
|
||||
$tracker->removeByFilter(sprintf(
|
||||
'"FieldName" = \'%s\' AND "%s" = %d',
|
||||
$fieldName,
|
||||
@ -123,7 +123,7 @@ class SiteTreeLinkTracking extends DataExtension {
|
||||
}
|
||||
|
||||
// Update the "ImageTracking" many_many
|
||||
if($record->ID && $record->many_many('ImageTracking') && $tracker = $record->ImageTracking()) {
|
||||
if($record->ID && $record->manyManyComponent('ImageTracking') && $tracker = $record->ImageTracking()) {
|
||||
$tracker->removeByFilter(sprintf(
|
||||
'"FieldName" = \'%s\' AND "%s" = %d',
|
||||
$fieldName,
|
||||
|
@ -54,7 +54,7 @@ class VirtualPage extends Page {
|
||||
$record = $this->CopyContentFrom();
|
||||
|
||||
$allFields = $record->db();
|
||||
if($hasOne = $record->has_one()) foreach($hasOne as $link) $allFields[$link . 'ID'] = "Int";
|
||||
if($hasOne = $record->hasOne()) foreach($hasOne as $link) $allFields[$link . 'ID'] = "Int";
|
||||
$virtualFields = array();
|
||||
foreach($allFields as $field => $type) {
|
||||
if(!in_array($field, $nonVirtualFields)) $virtualFields[] = $field;
|
||||
|
Loading…
x
Reference in New Issue
Block a user