Skip to content

Commit d91506f

Browse files
committed
Fix comments for record filter
1 parent b297893 commit d91506f

File tree

3 files changed

+38
-28
lines changed

3 files changed

+38
-28
lines changed

lib/Doctrine/Record/Filter.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,28 @@ public function getTable()
4545
return $this->_table;
4646
}
4747

48+
/**
49+
* @throws Doctrine_Table_Exception
50+
*/
4851
public function init()
4952
{
5053
}
5154

5255
/**
53-
* filterSet
54-
* defines an implementation for filtering the set() method of Doctrine_Record
56+
* Provides fallback for setting value.
5557
*
56-
* @param mixed $name name of the property or related component
58+
* @return Doctrine_Record the given record
59+
*
60+
* @thrown Doctrine_Exception
5761
*/
5862
abstract public function filterSet(Doctrine_Record $record, $name, $value);
5963

6064
/**
61-
* filterGet
62-
* defines an implementation for filtering the get() method of Doctrine_Record
65+
* Provides fallback for getting value.
66+
*
67+
* @return mixed The value of the given property
6368
*
64-
* @param mixed $name name of the property or related component
69+
* @thrown Doctrine_Exception
6570
*/
6671
abstract public function filterGet(Doctrine_Record $record, $name);
67-
}
72+
}

lib/Doctrine/Record/Filter/Compound.php

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,48 @@
3232
*/
3333
class Doctrine_Record_Filter_Compound extends Doctrine_Record_Filter
3434
{
35+
/**
36+
* @var string[]
37+
*/
3538
protected $_aliases = array();
3639

40+
/**
41+
* @param string[] $aliases A list of relation name
42+
*/
3743
public function __construct(array $aliases)
3844
{
3945
$this->_aliases = $aliases;
4046
}
4147

48+
/**
49+
* @throws Doctrine_Table_Exception
50+
*/
4251
public function init()
4352
{
44-
// check that all aliases exist
45-
foreach ($this->_aliases as $alias) {
53+
// check that all aliases exist
54+
foreach ($this->_aliases as $alias) {
4655
$this->_table->getRelation($alias);
47-
}
56+
}
4857
}
4958

5059
/**
51-
* filterSet
52-
* defines an implementation for filtering the set() method of Doctrine_Record
60+
* Provides fallback for setting value.
61+
*
62+
* @return Doctrine_Record the given record
5363
*
54-
* @param mixed $name name of the property or related component
64+
* @thrown Doctrine_Record_UnknownPropertyException
5565
*/
5666
public function filterSet(Doctrine_Record $record, $name, $value)
5767
{
5868
foreach ($this->_aliases as $alias) {
59-
// The relationship must be fetched in order to check the field existance.
69+
// The relationship must be fetched in order to check the field existence.
6070
// Related to PHP-7.0 compatibility so an explicit call to method get is required.
6171
$record[$alias];
6272

6373
if ( ! $record->exists()) {
6474
if (isset($record[$alias][$name])) {
6575
$record[$alias][$name] = $value;
66-
76+
6777
return $record;
6878
}
6979
} else {
@@ -78,15 +88,16 @@ public function filterSet(Doctrine_Record $record, $name, $value)
7888
}
7989

8090
/**
81-
* filterGet
82-
* defines an implementation for filtering the get() method of Doctrine_Record
91+
* Provides fallback for getting value.
92+
*
93+
* @return mixed The value of the given property
8394
*
84-
* @param mixed $name name of the property or related component
95+
* @thrown Doctrine_Record_UnknownPropertyException
8596
*/
8697
public function filterGet(Doctrine_Record $record, $name)
8798
{
8899
foreach ($this->_aliases as $alias) {
89-
// The relationship must be fetched in order to check the field existance.
100+
// The relationship must be fetched in order to check the field existence.
90101
// Related to PHP-7.0 compatibility so an explicit call to method get is required.
91102
$record[$alias];
92103

@@ -102,4 +113,4 @@ public function filterGet(Doctrine_Record $record, $name)
102113
}
103114
throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record)));
104115
}
105-
}
116+
}

lib/Doctrine/Record/Filter/Standard.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,15 @@
3434
class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter
3535
{
3636
/**
37-
* filterSet
38-
* defines an implementation for filtering the set() method of Doctrine_Record
39-
*
40-
* @param mixed $name name of the property or related component
37+
* @thrown Doctrine_Record_UnknownPropertyException
4138
*/
4239
public function filterSet(Doctrine_Record $record, $name, $value)
4340
{
4441
throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record)));
4542
}
4643

4744
/**
48-
* filterGet
49-
* defines an implementation for filtering the get() method of Doctrine_Record
50-
*
51-
* @param mixed $name name of the property or related component
45+
* @thrown Doctrine_Record_UnknownPropertyException
5246
*/
5347
public function filterGet(Doctrine_Record $record, $name)
5448
{

0 commit comments

Comments
 (0)