forked from propelorm/Propel2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExtensionPeerBuilder.php
95 lines (84 loc) · 2.54 KB
/
ExtensionPeerBuilder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Propel\Generator\Builder\Om;
/**
* Generates the empty PHP5 stub peer class for user object model (OM).
*
* This class produces the empty stub class that can be customized with application
* business logic, custom behavior, etc.
*
* @author Hans Lellelid <hans@xmpl.org>
*/
class ExtensionPeerBuilder extends AbstractPeerBuilder
{
/**
* Returns the name of the current class being built.
* @return string
*/
public function getUnprefixedClassName()
{
return $this->getStubObjectBuilder()->getUnprefixedClassName() . 'Peer';
}
/**
* Adds class phpdoc comment and openning of class.
* @param string &$script The script will be modified in this method.
*/
protected function addClassOpen(&$script)
{
$table = $this->getTable();
$tableName = $table->getName();
$tableDesc = $table->getDescription();
$baseClassName = $this->getClassNameFromBuilder($this->getPeerBuilder());
$script .= "
/**
* Skeleton subclass for performing query and update operations on the '$tableName' table.
*
* $tableDesc
*";
if ($this->getBuildProperty('addTimeStamp')) {
$now = strftime('%c');
$script .= "
* This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
*
* $now
*";
}
$script .= "
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class ".$this->getUnqualifiedClassName()." extends $baseClassName {
";
}
/**
* Specifies the methods that are added as part of the stub peer class.
*
* By default there are no methods for the empty stub classes; override this method
* if you want to change that behavior.
*
* @see ObjectBuilder::addClassBody()
*/
protected function addClassBody(&$script)
{
// there is no class body
}
/**
* Closes class.
* @param string &$script The script will be modified in this method.
*/
protected function addClassClose(&$script)
{
$script .= "
} // " . $this->getUnqualifiedClassName() . "
";
$this->applyBehaviorModifier('extensionPeerFilter', $script, "");
}
} // ExtensionPeerBuilder