@@ 109-129 (lines=21) @@ | ||
106 | * |
|
107 | * @throws \Exception |
|
108 | */ |
|
109 | private function getValue(string $name) |
|
110 | { |
|
111 | if (isset($this->presets[$name])) { |
|
112 | return $this->presets[$name]; |
|
113 | } |
|
114 | ||
115 | // if we use the old flow (sf3), the value can be stored in it's own yml file |
|
116 | if (strpos($name, ':')) { |
|
117 | $nameParts = explode(':', $name); |
|
118 | if (2 !== \count($nameParts)) { |
|
119 | throw new \Exception(sprintf('Malformed namespaced configuration name "%s" (expecting "namespace:pagename").', $name)); |
|
120 | } |
|
121 | list($namespace, $name) = $nameParts; |
|
122 | $path = $this->kernel->locateResource('@' . $namespace . '/Resources/config/pageparts/' . $name . '.yml'); |
|
123 | ||
124 | return Yaml::parse(file_get_contents($path)); |
|
125 | } |
|
126 | ||
127 | throw new \Exception(sprintf('Non existing pageparts preset "%s".', $name)); |
|
128 | } |
|
129 | } |
|
130 |
@@ 113-132 (lines=20) @@ | ||
110 | * |
|
111 | * @throws \Exception |
|
112 | */ |
|
113 | private function getRawData($name) |
|
114 | { |
|
115 | if (isset($this->presets[$name])) { |
|
116 | return $this->presets[$name]; |
|
117 | } |
|
118 | ||
119 | // if we use the old flow (sf3), the raw data can be stored in it's own yml file |
|
120 | if (strpos($name, ':')) { |
|
121 | $nameParts = explode(':', $name, 2); |
|
122 | if (2 !== \count($nameParts)) { |
|
123 | throw new \Exception(sprintf('Malformed namespaced configuration name "%s" (expecting "namespace:pagename").', $name)); |
|
124 | } |
|
125 | list($namespace, $name) = $nameParts; |
|
126 | $path = $this->kernel->locateResource('@'.$namespace.'/Resources/config/pagetemplates/'.$name.'.yml'); |
|
127 | ||
128 | return Yaml::parse(file_get_contents($path)); |
|
129 | } |
|
130 | ||
131 | throw new \Exception(sprintf('Non existing template "%s".', $name)); |
|
132 | } |
|
133 | } |
|
134 |