|
@@ 1902-1912 (lines=11) @@
|
| 1899 |
|
* the field data stripped off. It defaults to TRUE. |
| 1900 |
|
* @return string|false |
| 1901 |
|
*/ |
| 1902 |
|
public function belongsToComponent($component, $classOnly = true) { |
| 1903 |
|
$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED); |
| 1904 |
|
|
| 1905 |
|
if($belongsTo && array_key_exists($component, $belongsTo)) { |
| 1906 |
|
$belongsTo = $belongsTo[$component]; |
| 1907 |
|
} else { |
| 1908 |
|
return false; |
| 1909 |
|
} |
| 1910 |
|
|
| 1911 |
|
return ($classOnly) ? preg_replace('/(.+)?\..+/', '$1', $belongsTo) : $belongsTo; |
| 1912 |
|
} |
| 1913 |
|
|
| 1914 |
|
/** |
| 1915 |
|
* Return all of the database fields defined in self::$db and all the parent classes. |
|
@@ 2000-2010 (lines=11) @@
|
| 1997 |
|
* the field data stripped off. It defaults to TRUE. |
| 1998 |
|
* @return string|false |
| 1999 |
|
*/ |
| 2000 |
|
public function hasManyComponent($component, $classOnly = true) { |
| 2001 |
|
$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED); |
| 2002 |
|
|
| 2003 |
|
if($hasMany && array_key_exists($component, $hasMany)) { |
| 2004 |
|
$hasMany = $hasMany[$component]; |
| 2005 |
|
} else { |
| 2006 |
|
return false; |
| 2007 |
|
} |
| 2008 |
|
|
| 2009 |
|
return ($classOnly) ? preg_replace('/(.+)?\..+/', '$1', $hasMany) : $hasMany; |
| 2010 |
|
} |
| 2011 |
|
|
| 2012 |
|
/** |
| 2013 |
|
* @deprecated 4.0 Method has been replaced by manyManyExtraFields() and |