Skip to content

Commit 7c22a01

Browse files
committed
Merge pull request #154 from dovg/dblink-property
Dblink property
2 parents 6163df6 + 722a828 commit 7c22a01

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

doc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2012-12-06 Evgeny V. Kokovikhin
2+
* main/DAOs/GenericDAO.class.php
3+
meta/builders/AutoDaoBuilder.class.php
4+
meta/builders/BaseBuilder.class.php:
5+
dbLink became a property
6+
17
2012-11-25 Alexey S. Denisov
28

39
* core/Form/Primitives/PrimitiveIdentifier.class.php

main/DAOs/GenericDAO.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ abstract class GenericDAO extends Singleton implements BaseDAO
1818
{
1919
private $identityMap = array();
2020

21+
protected $linkName = null;
22+
2123
abstract public function getTable();
2224
abstract public function getObjectName();
2325

@@ -71,7 +73,7 @@ public function completeObject(Identifiable $object)
7173
**/
7274
public function getLinkName()
7375
{
74-
return null;
76+
return $this->linkName;
7577
}
7678

7779
public function getIdName()

meta/builders/AutoDaoBuilder.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ abstract class Auto{$class->getName()}DAO extends {$parentName}
3737
{
3838
3939
EOT;
40-
40+
4141
$out .= self::buildPointers($class)."\n}\n";
4242

4343
return $out.self::getHeel();

meta/builders/BaseBuilder.class.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ protected static function buildPointers(MetaClass $class)
2424
$out = null;
2525

2626
if (!$class->getPattern() instanceof AbstractClassPattern) {
27+
if ($source = $class->getSourceLink()) {
28+
$out .= <<<EOT
29+
protected \$linkName = '{$source}';
30+
31+
32+
EOT;
33+
}
34+
2735
if (
2836
$class->getIdentifier()->getColumnName() !== 'id'
2937
) {
@@ -78,17 +86,6 @@ public function uncacheLists()
7886
EOT;
7987
}
8088

81-
if ($source = $class->getSourceLink()) {
82-
$out .= <<<EOT
83-
84-
85-
public function getLinkName()
86-
{
87-
return '{$source}';
88-
}
89-
EOT;
90-
}
91-
9289
return $out;
9390
}
9491

0 commit comments

Comments
 (0)