|
Revision 24337, 1.7 kB
(checked in by Kris.Wallsmith, 3 years ago)
|
[1.3, 1.4] cleaned up comments and coding standards in doctrine record classes
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class sfDoctrineRecordI18nFilter extends Doctrine_Record_Filter |
|---|
| 21 |
{ |
|---|
| 22 |
|
|---|
| 23 |
* @see Doctrine_Table::unshiftFilter() |
|---|
| 24 |
*/ |
|---|
| 25 |
public function init() |
|---|
| 26 |
{ |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
* Calls set on Translation relationship. |
|---|
| 31 |
* |
|---|
| 32 |
* Allows manipulation of I18n properties from the main object. |
|---|
| 33 |
* |
|---|
| 34 |
* @param Doctrine_Record $record |
|---|
| 35 |
* @param string $name Name of the property |
|---|
| 36 |
* @param string $value Value of the property |
|---|
| 37 |
*/ |
|---|
| 38 |
public function filterSet(Doctrine_Record $record, $name, $value) |
|---|
| 39 |
{ |
|---|
| 40 |
return $record['Translation'][sfDoctrineRecord::getDefaultCulture()][$name] = $value; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
* Call get on Translation relationship. |
|---|
| 45 |
* |
|---|
| 46 |
* Allow access to I18n properties from the main object. |
|---|
| 47 |
* |
|---|
| 48 |
* @param Doctrine_Record $record |
|---|
| 49 |
* @param string $name Name of the property |
|---|
| 50 |
*/ |
|---|
| 51 |
public function filterGet(Doctrine_Record $record, $name) |
|---|
| 52 |
{ |
|---|
| 53 |
$culture = sfDoctrineRecord::getDefaultCulture(); |
|---|
| 54 |
if (isset($record['Translation'][$culture])) |
|---|
| 55 |
{ |
|---|
| 56 |
return $record['Translation'][$culture][$name]; |
|---|
| 57 |
} |
|---|
| 58 |
else |
|---|
| 59 |
{ |
|---|
| 60 |
$defaultCulture = sfConfig::get('sf_default_culture'); |
|---|
| 61 |
return $record['Translation'][$defaultCulture][$name]; |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|