@@ -230,7 +230,7 @@ |
||
| 230 | 230 | $module = $this->packageService->getModule(); |
| 231 | 231 | $action = $module->getAction($actionName); |
| 232 | 232 | $prefix = substr($actionName, 0, strpos($actionName, 'relationship') + 12); |
| 233 | - $readAction = $module->getAction($prefix.'-read'); |
|
| 233 | + $readAction = $module->getAction($prefix . '-read'); |
|
| 234 | 234 | |
| 235 | 235 | // get modules names |
| 236 | 236 | $matches = []; |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | /** @var Table */ |
| 15 | 15 | private $foreign; |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param \keeko\tools\services\CommandService $service |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($service, Table $model, Table $foreign) { |
| 18 | 21 | parent::__construct($service); |
| 19 | 22 | $this->model = $model; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | foreach ($fields as $field) { |
| 100 | 100 | $code .= "'$field'"; |
| 101 | 101 | if (isset($conversions[$field])) { |
| 102 | - $code .= ' => function($v) {'."\n\t".'return ' . $conversions[$field] . ';'."\n".'}'; |
|
| 102 | + $code .= ' => function($v) {' . "\n\t" . 'return ' . $conversions[$field] . ';' . "\n" . '}'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $code .= ', '; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ]); |
| 159 | 159 | |
| 160 | 160 | // set |
| 161 | - $class->setMethod(PhpMethod::create('set'.$crudMethod) |
|
| 161 | + $class->setMethod(PhpMethod::create('set' . $crudMethod) |
|
| 162 | 162 | ->addParameter(PhpParameter::create('model')) |
| 163 | 163 | ->addParameter(PhpParameter::create('data')) |
| 164 | 164 | ->setBody($this->twig->render('to-one-set.twig', [ |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | ]); |
| 192 | 192 | |
| 193 | 193 | // set |
| 194 | - $class->addUseStatement($rel['cfk']->getMiddleTable()->getNamespace() . '\\' .$rel['cfk']->getMiddleTable()->getPhpName() . 'Query'); |
|
| 195 | - $class->setMethod(PhpMethod::create('set'.$crudMethod) |
|
| 194 | + $class->addUseStatement($rel['cfk']->getMiddleTable()->getNamespace() . '\\' . $rel['cfk']->getMiddleTable()->getPhpName() . 'Query'); |
|
| 195 | + $class->setMethod(PhpMethod::create('set' . $crudMethod) |
|
| 196 | 196 | ->addParameter(PhpParameter::create('model')) |
| 197 | 197 | ->addParameter(PhpParameter::create('data')) |
| 198 | 198 | ->setBody($this->twig->render('to-many-set.twig', [ |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | // add |
| 206 | - $class->setMethod(PhpMethod::create('add'.$crudMethod) |
|
| 206 | + $class->setMethod(PhpMethod::create('add' . $crudMethod) |
|
| 207 | 207 | ->addParameter(PhpParameter::create('model')) |
| 208 | 208 | ->addParameter(PhpParameter::create('data')) |
| 209 | 209 | ->setBody($this->twig->render('to-many-add.twig', [ |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | // remove |
| 216 | - $class->setMethod(PhpMethod::create('remove'.$crudMethod) |
|
| 216 | + $class->setMethod(PhpMethod::create('remove' . $crudMethod) |
|
| 217 | 217 | ->addParameter(PhpParameter::create('model')) |
| 218 | 218 | ->addParameter(PhpParameter::create('data')) |
| 219 | 219 | ->setBody($this->twig->render('to-many-remove.twig', [ |