1 | <?php |
||
15 | class ParameterBuilder |
||
16 | { |
||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $parameters; |
||
21 | |||
22 | /** |
||
23 | * @param string $name parameter name |
||
24 | * @param mixed $value parameter to set |
||
25 | * |
||
26 | * @return self |
||
27 | */ |
||
28 | 18 | public function setParameter($name, $value) |
|
29 | { |
||
30 | 18 | if ($name === 'basename') { |
|
31 | 4 | $this->parameters['bundle_basename'] = $value; |
|
32 | 4 | $this->parameters['extension_alias'] = Container::underscore($value); |
|
33 | 14 | } elseif ($name === 'json') { |
|
34 | 6 | $this->parameters['json'] = $value; |
|
35 | // if we have data for id field, pass it along |
||
36 | 6 | $idField = $value->getField('id'); |
|
37 | 6 | if (!is_null($idField)) { |
|
38 | 4 | $this->parameters['idField'] = $idField->getDefAsArray(); |
|
39 | } else { |
||
40 | // if there is a json file and no id defined - so we don't do one here.. |
||
41 | // we leave it in the document though but we don't wanna output it.. |
||
42 | 2 | $this->parameters['noIdField'] = true; |
|
43 | } |
||
44 | 6 | $this->parameters['parent'] = $value->getParentService(); |
|
45 | 8 | } elseif ($name === 'recordOriginModifiable' && $value !== null) { |
|
46 | $this->parameters[$name] = ($value) ? 'true' : 'false'; |
||
47 | } else { |
||
48 | 8 | $this->parameters[$name] = $value; |
|
49 | } |
||
50 | |||
51 | 18 | return $this; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return array |
||
56 | */ |
||
57 | 18 | public function getParameters() |
|
61 | } |
||
62 |