Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function generate(PhpClass $class, Table $model, Table $foreignModel, Table $middle) { |
||
15 | // add use statements |
||
16 | $this->ensureBasicSetup($class); |
||
17 | |||
18 | // method: configureParams(OptionsResolver $resolver) |
||
19 | $this->addConfigureParamsMethod($class, $this->twig->render('relationship-configureParams.twig')); |
||
20 | |||
21 | // method: run(Request $request) : Response |
||
22 | $class->addUseStatement('Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException'); |
||
23 | $class->addUseStatement('Tobscure\\JsonApi\\Exception\\InvalidParameterException'); |
||
24 | $class->addUseStatement($middle->getNamespace() . '\\' . $middle->getPhpName() . 'Query'); |
||
25 | $class->addUseStatement($model->getNamespace() . '\\' . $model->getPhpName() . 'Query'); |
||
26 | $class->addUseStatement($model->getNamespace() . '\\' . $foreignModel->getPhpName() . 'Query'); |
||
27 | $class->setMethod($this->generateRunMethod($this->twig->render('to-many-update-run.twig', [ |
||
28 | 'model' => $model->getCamelCaseName(), |
||
29 | 'class' => $model->getPhpName(), |
||
30 | 'foreign_model' => $foreignModel->getCamelCaseName(), |
||
31 | 'foreign_class' => $foreignModel->getPhpName(), |
||
32 | 'fk_class' => $middle->getPhpName() |
||
33 | ]))); |
||
34 | |||
35 | return $class; |
||
36 | } |
||
37 | } |