|
@@ 1877-1893 (lines=17) @@
|
| 1874 |
|
* the field data stripped off. It defaults to TRUE. |
| 1875 |
|
* @return string|array |
| 1876 |
|
*/ |
| 1877 |
|
public function belongsTo($component = null, $classOnly = true) { |
| 1878 |
|
if($component) { |
| 1879 |
|
Deprecation::notice( |
| 1880 |
|
'4.0', |
| 1881 |
|
'Please use DataObject::belongsToComponent() instead of passing a component name to belongsTo()', |
| 1882 |
|
Deprecation::SCOPE_GLOBAL |
| 1883 |
|
); |
| 1884 |
|
return $this->belongsToComponent($component, $classOnly); |
| 1885 |
|
} |
| 1886 |
|
|
| 1887 |
|
$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED); |
| 1888 |
|
if($belongsTo && $classOnly) { |
| 1889 |
|
return preg_replace('/(.+)?\..+/', '$1', $belongsTo); |
| 1890 |
|
} else { |
| 1891 |
|
return $belongsTo ? $belongsTo : array(); |
| 1892 |
|
} |
| 1893 |
|
} |
| 1894 |
|
|
| 1895 |
|
/** |
| 1896 |
|
* Return data for a specific belongs_to component. |
|
@@ 1975-1991 (lines=17) @@
|
| 1972 |
|
* the field data stripped off. It defaults to TRUE. |
| 1973 |
|
* @return string|array|false |
| 1974 |
|
*/ |
| 1975 |
|
public function hasMany($component = null, $classOnly = true) { |
| 1976 |
|
if($component) { |
| 1977 |
|
Deprecation::notice( |
| 1978 |
|
'4.0', |
| 1979 |
|
'Please use DataObject::hasManyComponent() instead of passing a component name to hasMany()', |
| 1980 |
|
Deprecation::SCOPE_GLOBAL |
| 1981 |
|
); |
| 1982 |
|
return $this->hasManyComponent($component, $classOnly); |
| 1983 |
|
} |
| 1984 |
|
|
| 1985 |
|
$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED); |
| 1986 |
|
if($hasMany && $classOnly) { |
| 1987 |
|
return preg_replace('/(.+)?\..+/', '$1', $hasMany); |
| 1988 |
|
} else { |
| 1989 |
|
return $hasMany ? $hasMany : array(); |
| 1990 |
|
} |
| 1991 |
|
} |
| 1992 |
|
|
| 1993 |
|
/** |
| 1994 |
|
* Return data for a specific has_many component. |