@@ -86,7 +86,7 @@ |
||
86 | 86 | * @param string $columnName |
87 | 87 | * @param string $order |
88 | 88 | */ |
89 | - public function __construct($tableName=null, $columnName=null, $order=null) { |
|
89 | + public function __construct($tableName = null, $columnName = null, $order = null) { |
|
90 | 90 | $this->tableName = $tableName; |
91 | 91 | $this->columnName = $columnName; |
92 | 92 | $this->order = $order; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * |
60 | 60 | * @param FilterInterface $filter |
61 | 61 | */ |
62 | - public function __construct($filter=null) { |
|
62 | + public function __construct($filter = null) { |
|
63 | 63 | $this->filter = $filter; |
64 | 64 | } |
65 | 65 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param string $sqlString |
64 | 64 | */ |
65 | - public function __construct($sqlString=null) { |
|
65 | + public function __construct($sqlString = null) { |
|
66 | 66 | $this->sqlString = $sqlString; |
67 | 67 | } |
68 | 68 | |
@@ -95,32 +95,32 @@ discard block |
||
95 | 95 | // First, let's remove all the stuff in quotes: |
96 | 96 | |
97 | 97 | // Let's remove all the \' found |
98 | - $work_str = str_replace("\\'",'',$this->sqlString); |
|
98 | + $work_str = str_replace("\\'", '', $this->sqlString); |
|
99 | 99 | // Now, let's split the string using ' |
100 | 100 | $work_table = explode("'", $work_str); |
101 | 101 | |
102 | - if (count($work_table)==0) |
|
102 | + if (count($work_table) == 0) |
|
103 | 103 | return ''; |
104 | 104 | |
105 | 105 | // if we start with a ', let's remove the first text |
106 | - if (strstr($work_str,"'")===0) |
|
106 | + if (strstr($work_str, "'") === 0) |
|
107 | 107 | array_shift($work_table); |
108 | 108 | |
109 | - if (count($work_table)==0) |
|
109 | + if (count($work_table) == 0) |
|
110 | 110 | return ''; |
111 | 111 | |
112 | 112 | // Now, let's take only the stuff outside the quotes. |
113 | 113 | $work_str2 = ''; |
114 | 114 | |
115 | - $i=0; |
|
115 | + $i = 0; |
|
116 | 116 | foreach ($work_table as $str_fragment) { |
117 | - if (($i % 2) == 0) |
|
117 | + if (($i%2) == 0) |
|
118 | 118 | $work_str2 .= $str_fragment.' '; |
119 | 119 | $i++; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // Now, let's run a regexp to find all the strings matching the pattern xxx.yyy |
123 | - preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2,$capture_result); |
|
123 | + preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2, $capture_result); |
|
124 | 124 | |
125 | 125 | $tables_used = $capture_result[1]; |
126 | 126 | // remove doubles: |
@@ -99,23 +99,27 @@ |
||
99 | 99 | // Now, let's split the string using ' |
100 | 100 | $work_table = explode("'", $work_str); |
101 | 101 | |
102 | - if (count($work_table)==0) |
|
103 | - return ''; |
|
102 | + if (count($work_table)==0) { |
|
103 | + return ''; |
|
104 | + } |
|
104 | 105 | |
105 | 106 | // if we start with a ', let's remove the first text |
106 | - if (strstr($work_str,"'")===0) |
|
107 | - array_shift($work_table); |
|
107 | + if (strstr($work_str,"'")===0) { |
|
108 | + array_shift($work_table); |
|
109 | + } |
|
108 | 110 | |
109 | - if (count($work_table)==0) |
|
110 | - return ''; |
|
111 | + if (count($work_table)==0) { |
|
112 | + return ''; |
|
113 | + } |
|
111 | 114 | |
112 | 115 | // Now, let's take only the stuff outside the quotes. |
113 | 116 | $work_str2 = ''; |
114 | 117 | |
115 | 118 | $i=0; |
116 | 119 | foreach ($work_table as $str_fragment) { |
117 | - if (($i % 2) == 0) |
|
118 | - $work_str2 .= $str_fragment.' '; |
|
120 | + if (($i % 2) == 0) { |
|
121 | + $work_str2 .= $str_fragment.' '; |
|
122 | + } |
|
119 | 123 | $i++; |
120 | 124 | } |
121 | 125 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @param array<FilterInterface> $filters |
51 | 51 | */ |
52 | - public function __construct(array $filters=array()) { |
|
52 | + public function __construct(array $filters = array()) { |
|
53 | 53 | $this->filters = $filters; |
54 | 54 | } |
55 | 55 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if (count($filters_sql)>0) { |
94 | - return '('.implode(' AND ',$filters_sql).')'; |
|
94 | + return '('.implode(' AND ', $filters_sql).')'; |
|
95 | 95 | } else { |
96 | 96 | return ''; |
97 | 97 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | throw new TDBMException("Error in AndFilter: One of the parameters is not a filter."); |
115 | 115 | } |
116 | 116 | |
117 | - $tables = array_merge($tables,$filter->getUsedTables()); |
|
117 | + $tables = array_merge($tables, $filter->getUsedTables()); |
|
118 | 118 | } |
119 | 119 | // Remove tables in double. |
120 | 120 | $tables = array_flip(array_flip($tables)); |
@@ -9,14 +9,14 @@ |
||
9 | 9 | */ |
10 | 10 | class FilterUtils |
11 | 11 | { |
12 | - /** |
|
13 | - * @param string|null|DateTimeInterface $value |
|
14 | - */ |
|
15 | - public static function valueToSql($value, Connection $dbConnection) { |
|
16 | - if ($value instanceof DateTimeInterface) { |
|
17 | - return "'".$value->format('Y-m-d H:i:s')."'"; |
|
18 | - } else { |
|
19 | - return $dbConnection->quote($value); |
|
20 | - } |
|
21 | - } |
|
12 | + /** |
|
13 | + * @param string|null|DateTimeInterface $value |
|
14 | + */ |
|
15 | + public static function valueToSql($value, Connection $dbConnection) { |
|
16 | + if ($value instanceof DateTimeInterface) { |
|
17 | + return "'".$value->format('Y-m-d H:i:s')."'"; |
|
18 | + } else { |
|
19 | + return $dbConnection->quote($value); |
|
20 | + } |
|
21 | + } |
|
22 | 22 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param string $tableName |
100 | 100 | * @param string $columnName |
101 | - * @param string $value1 |
|
102 | - * @param string $value2 |
|
101 | + * @param string $value1 |
|
102 | + * @param string $value2 |
|
103 | 103 | */ |
104 | 104 | public function __construct($tableName=null, $columnName=null, $value1=null, $value2=null) { |
105 | 105 | $this->tableName = $tableName; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param Connection $dbConnection |
115 | 115 | * @return string |
116 | - * @throws \Mouf\Database\TDBM\TDBMException |
|
116 | + * @throws \Mouf\Database\TDBM\TDBMException |
|
117 | 117 | */ |
118 | - public function toSql(Connection $dbConnection) { |
|
118 | + public function toSql(Connection $dbConnection) { |
|
119 | 119 | if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
120 | 120 | return ""; |
121 | 121 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | * @param string $value1 |
102 | 102 | * @param string $value2 |
103 | 103 | */ |
104 | - public function __construct($tableName=null, $columnName=null, $value1=null, $value2=null) { |
|
104 | + public function __construct($tableName = null, $columnName = null, $value1 = null, $value2 = null) { |
|
105 | 105 | $this->tableName = $tableName; |
106 | 106 | $this->columnName = $columnName; |
107 | 107 | $this->value1 = $value1; |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param Connection $dbConnection |
70 | 70 | * @return string |
71 | - * @throws TDBMException |
|
71 | + * @throws TDBMException |
|
72 | 72 | */ |
73 | - public function toSql(Connection $dbConnection) { |
|
73 | + public function toSql(Connection $dbConnection) { |
|
74 | 74 | if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
75 | 75 | return ""; |
76 | 76 | } |
@@ -102,22 +102,22 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array<string> |
104 | 104 | */ |
105 | - public function getUsedTables() { |
|
106 | - if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
|
107 | - return array(); |
|
108 | - } |
|
109 | - |
|
110 | - $tables = array(); |
|
111 | - foreach ($this->filters as $filter) { |
|
112 | - |
|
113 | - if (!$filter instanceof FilterInterface) { |
|
114 | - throw new TDBMException("Error in OrFilter: One of the parameters is not a filter."); |
|
115 | - } |
|
116 | - |
|
117 | - $tables = array_merge($tables,$filter->getUsedTables()); |
|
118 | - } |
|
119 | - // Remove tables in double. |
|
120 | - $tables = array_flip(array_flip($tables)); |
|
121 | - return $tables; |
|
122 | - } |
|
105 | + public function getUsedTables() { |
|
106 | + if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
|
107 | + return array(); |
|
108 | + } |
|
109 | + |
|
110 | + $tables = array(); |
|
111 | + foreach ($this->filters as $filter) { |
|
112 | + |
|
113 | + if (!$filter instanceof FilterInterface) { |
|
114 | + throw new TDBMException("Error in OrFilter: One of the parameters is not a filter."); |
|
115 | + } |
|
116 | + |
|
117 | + $tables = array_merge($tables,$filter->getUsedTables()); |
|
118 | + } |
|
119 | + // Remove tables in double. |
|
120 | + $tables = array_flip(array_flip($tables)); |
|
121 | + return $tables; |
|
122 | + } |
|
123 | 123 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @param array<FilterInterface> $filters |
61 | 61 | */ |
62 | - public function __construct(array $filters=array()) { |
|
62 | + public function __construct(array $filters = array()) { |
|
63 | 63 | $this->filters = $filters; |
64 | 64 | } |
65 | 65 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if (count($filters_sql)>0) { |
94 | - return '('.implode(' OR ',$filters_sql).')'; |
|
94 | + return '('.implode(' OR ', $filters_sql).')'; |
|
95 | 95 | } else { |
96 | 96 | return ''; |
97 | 97 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | throw new TDBMException("Error in OrFilter: One of the parameters is not a filter."); |
115 | 115 | } |
116 | 116 | |
117 | - $tables = array_merge($tables,$filter->getUsedTables()); |
|
117 | + $tables = array_merge($tables, $filter->getUsedTables()); |
|
118 | 118 | } |
119 | 119 | // Remove tables in double. |
120 | 120 | $tables = array_flip(array_flip($tables)); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * @param string $columnName |
86 | 86 | * @param string $value |
87 | 87 | */ |
88 | - public function __construct($tableName=null, $columnName=null, $value=null) { |
|
88 | + public function __construct($tableName = null, $columnName = null, $value = null) { |
|
89 | 89 | $this->tableName = $tableName; |
90 | 90 | $this->columnName = $columnName; |
91 | 91 | $this->value = $value; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function getUpperCamelCaseName() { |
63 | 63 | // First, are there many column or only one? |
64 | 64 | // If one column, we name the setter after it. Otherwise, we name the setter after the table name |
65 | - if (count($this->foreignKey->getLocalColumns()) > 1) { |
|
65 | + if (count($this->foreignKey->getLocalColumns())>1) { |
|
66 | 66 | $name = TDBMDaoGenerator::toSingular(TDBMDaoGenerator::toCamelCase($this->foreignKey->getForeignTableName())); |
67 | 67 | if ($this->alternativeName) { |
68 | 68 | $camelizedColumns = array_map(['Mouf\\Database\\TDBM\\Utils\\TDBMDaoGenerator', 'toCamelCase'], $this->foreignKey->getLocalColumns()); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param '.$referencedBeanName.' $object |
145 | 145 | */ |
146 | 146 | public function '.$setterName.'('.$referencedBeanName.' $object = null) { |
147 | - $this->setRef(' . var_export($this->foreignKey->getName(), true) . ', $object, '.var_export($tableName, true).'); |
|
147 | + $this->setRef(' . var_export($this->foreignKey->getName(), true).', $object, '.var_export($tableName, true).'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | '; |
@@ -14,122 +14,122 @@ discard block |
||
14 | 14 | class ObjectBeanPropertyDescriptor extends AbstractBeanPropertyDescriptor |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @var ForeignKeyConstraint |
|
19 | - */ |
|
20 | - private $foreignKey; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var SchemaAnalyzer |
|
24 | - */ |
|
25 | - private $schemaAnalyzer; |
|
26 | - |
|
27 | - public function __construct(Table $table, ForeignKeyConstraint $foreignKey, SchemaAnalyzer $schemaAnalyzer) { |
|
28 | - parent::__construct($table); |
|
29 | - $this->foreignKey = $foreignKey; |
|
30 | - $this->schemaAnalyzer = $schemaAnalyzer; |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Returns the foreignkey the column is part of, if any. null otherwise. |
|
37 | - * |
|
38 | - * @return ForeignKeyConstraint|null |
|
39 | - */ |
|
40 | - public function getForeignKey() { |
|
41 | - return $this->foreignKey; |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Returns the name of the class linked to this property or null if this is not a foreign key |
|
46 | - * @return null|string |
|
47 | - */ |
|
48 | - public function getClassName() { |
|
49 | - return TDBMDaoGenerator::getBeanNameFromTableName($this->foreignKey->getForeignTableName()); |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Returns the param annotation for this property (useful for constructor). |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function getParamAnnotation() { |
|
58 | - $str = " * @param %s %s"; |
|
59 | - return sprintf($str, $this->getClassName(), $this->getVariableName()); |
|
60 | - } |
|
61 | - |
|
62 | - public function getUpperCamelCaseName() { |
|
63 | - // First, are there many column or only one? |
|
64 | - // If one column, we name the setter after it. Otherwise, we name the setter after the table name |
|
65 | - if (count($this->foreignKey->getLocalColumns()) > 1) { |
|
66 | - $name = TDBMDaoGenerator::toSingular(TDBMDaoGenerator::toCamelCase($this->foreignKey->getForeignTableName())); |
|
67 | - if ($this->alternativeName) { |
|
68 | - $camelizedColumns = array_map(['Mouf\\Database\\TDBM\\Utils\\TDBMDaoGenerator', 'toCamelCase'], $this->foreignKey->getLocalColumns()); |
|
69 | - |
|
70 | - $name .= 'By'.implode('And', $camelizedColumns); |
|
71 | - } |
|
72 | - } else { |
|
73 | - $column = $this->foreignKey->getLocalColumns()[0]; |
|
74 | - // Let's remove any _id or id_. |
|
75 | - if (strpos(strtolower($column), "id_") === 0) { |
|
76 | - $column = substr($column, 3); |
|
77 | - } |
|
78 | - if (strrpos(strtolower($column), "_id") === strlen($column)-3) { |
|
79 | - $column = substr($column, 0, strlen($column)-3); |
|
80 | - } |
|
81 | - $name = TDBMDaoGenerator::toCamelCase($column); |
|
82 | - if ($this->alternativeName) { |
|
83 | - $name .= 'Object'; |
|
84 | - } |
|
85 | - } |
|
86 | - return $name; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function isCompulsory() { |
|
94 | - // Are all columns nullable? |
|
95 | - $localColumnNames = $this->foreignKey->getLocalColumns(); |
|
96 | - |
|
97 | - foreach ($localColumnNames as $name) { |
|
98 | - $column = $this->table->getColumn($name); |
|
99 | - if ($column->getNotnull()) { |
|
100 | - return true; |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - return false; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Returns true if the property is the primary key |
|
109 | - * @return bool |
|
110 | - */ |
|
111 | - public function isPrimaryKey() { |
|
112 | - $fkColumns = $this->foreignKey->getLocalColumns(); |
|
113 | - sort($fkColumns); |
|
114 | - |
|
115 | - $pkColumns = $this->table->getPrimaryKeyColumns(); |
|
116 | - sort($pkColumns); |
|
117 | - |
|
118 | - return $fkColumns == $pkColumns; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Returns the PHP code for getters and setters |
|
123 | - * @return string |
|
124 | - */ |
|
125 | - public function getGetterSetterCode() { |
|
126 | - $tableName = $this->table->getName(); |
|
127 | - $getterName = $this->getGetterName(); |
|
128 | - $setterName = $this->getSetterName(); |
|
129 | - |
|
130 | - $referencedBeanName = TDBMDaoGenerator::getBeanNameFromTableName($this->foreignKey->getForeignTableName()); |
|
131 | - |
|
132 | - $str = ' /** |
|
17 | + /** |
|
18 | + * @var ForeignKeyConstraint |
|
19 | + */ |
|
20 | + private $foreignKey; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var SchemaAnalyzer |
|
24 | + */ |
|
25 | + private $schemaAnalyzer; |
|
26 | + |
|
27 | + public function __construct(Table $table, ForeignKeyConstraint $foreignKey, SchemaAnalyzer $schemaAnalyzer) { |
|
28 | + parent::__construct($table); |
|
29 | + $this->foreignKey = $foreignKey; |
|
30 | + $this->schemaAnalyzer = $schemaAnalyzer; |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Returns the foreignkey the column is part of, if any. null otherwise. |
|
37 | + * |
|
38 | + * @return ForeignKeyConstraint|null |
|
39 | + */ |
|
40 | + public function getForeignKey() { |
|
41 | + return $this->foreignKey; |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Returns the name of the class linked to this property or null if this is not a foreign key |
|
46 | + * @return null|string |
|
47 | + */ |
|
48 | + public function getClassName() { |
|
49 | + return TDBMDaoGenerator::getBeanNameFromTableName($this->foreignKey->getForeignTableName()); |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Returns the param annotation for this property (useful for constructor). |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function getParamAnnotation() { |
|
58 | + $str = " * @param %s %s"; |
|
59 | + return sprintf($str, $this->getClassName(), $this->getVariableName()); |
|
60 | + } |
|
61 | + |
|
62 | + public function getUpperCamelCaseName() { |
|
63 | + // First, are there many column or only one? |
|
64 | + // If one column, we name the setter after it. Otherwise, we name the setter after the table name |
|
65 | + if (count($this->foreignKey->getLocalColumns()) > 1) { |
|
66 | + $name = TDBMDaoGenerator::toSingular(TDBMDaoGenerator::toCamelCase($this->foreignKey->getForeignTableName())); |
|
67 | + if ($this->alternativeName) { |
|
68 | + $camelizedColumns = array_map(['Mouf\\Database\\TDBM\\Utils\\TDBMDaoGenerator', 'toCamelCase'], $this->foreignKey->getLocalColumns()); |
|
69 | + |
|
70 | + $name .= 'By'.implode('And', $camelizedColumns); |
|
71 | + } |
|
72 | + } else { |
|
73 | + $column = $this->foreignKey->getLocalColumns()[0]; |
|
74 | + // Let's remove any _id or id_. |
|
75 | + if (strpos(strtolower($column), "id_") === 0) { |
|
76 | + $column = substr($column, 3); |
|
77 | + } |
|
78 | + if (strrpos(strtolower($column), "_id") === strlen($column)-3) { |
|
79 | + $column = substr($column, 0, strlen($column)-3); |
|
80 | + } |
|
81 | + $name = TDBMDaoGenerator::toCamelCase($column); |
|
82 | + if ($this->alternativeName) { |
|
83 | + $name .= 'Object'; |
|
84 | + } |
|
85 | + } |
|
86 | + return $name; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + public function isCompulsory() { |
|
94 | + // Are all columns nullable? |
|
95 | + $localColumnNames = $this->foreignKey->getLocalColumns(); |
|
96 | + |
|
97 | + foreach ($localColumnNames as $name) { |
|
98 | + $column = $this->table->getColumn($name); |
|
99 | + if ($column->getNotnull()) { |
|
100 | + return true; |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + return false; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Returns true if the property is the primary key |
|
109 | + * @return bool |
|
110 | + */ |
|
111 | + public function isPrimaryKey() { |
|
112 | + $fkColumns = $this->foreignKey->getLocalColumns(); |
|
113 | + sort($fkColumns); |
|
114 | + |
|
115 | + $pkColumns = $this->table->getPrimaryKeyColumns(); |
|
116 | + sort($pkColumns); |
|
117 | + |
|
118 | + return $fkColumns == $pkColumns; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Returns the PHP code for getters and setters |
|
123 | + * @return string |
|
124 | + */ |
|
125 | + public function getGetterSetterCode() { |
|
126 | + $tableName = $this->table->getName(); |
|
127 | + $getterName = $this->getGetterName(); |
|
128 | + $setterName = $this->getSetterName(); |
|
129 | + |
|
130 | + $referencedBeanName = TDBMDaoGenerator::getBeanNameFromTableName($this->foreignKey->getForeignTableName()); |
|
131 | + |
|
132 | + $str = ' /** |
|
133 | 133 | * Returns the '.$referencedBeanName.' object bound to this object via the '.implode(" and ", $this->foreignKey->getLocalColumns()).' column. |
134 | 134 | * |
135 | 135 | * @return '.$referencedBeanName.' |
@@ -148,19 +148,19 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | '; |
151 | - return $str; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Returns the part of code useful when doing json serialization. |
|
156 | - * |
|
157 | - * @return string |
|
158 | - */ |
|
159 | - public function getJsonSerializeCode() |
|
160 | - { |
|
161 | - return ' if (!$stopRecursion) { |
|
151 | + return $str; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Returns the part of code useful when doing json serialization. |
|
156 | + * |
|
157 | + * @return string |
|
158 | + */ |
|
159 | + public function getJsonSerializeCode() |
|
160 | + { |
|
161 | + return ' if (!$stopRecursion) { |
|
162 | 162 | $array['.var_export($this->getLowerCamelCaseName(), true).'] = $this->'.$this->getGetterName().'()->jsonSerialize(true); |
163 | 163 | } |
164 | 164 | '; |
165 | - } |
|
165 | + } |
|
166 | 166 | } |