| @@ 167-183 (lines=17) @@ | ||
| 164 | * |
|
| 165 | * @throws MappingException |
|
| 166 | */ |
|
| 167 | protected static function setAliasedProperties(array &$mappedClass, Mapping $mapping, $className) |
|
| 168 | { |
|
| 169 | if (false === empty($mappedClass[static::ALIASED_PROPERTIES_KEY])) { |
|
| 170 | $mapping->setPropertyNameAliases($mappedClass[static::ALIASED_PROPERTIES_KEY]); |
|
| 171 | foreach (\array_keys($mapping->getAliasedProperties()) as $propertyName) { |
|
| 172 | if (false === \in_array($propertyName, static::getClassProperties($className), true)) { |
|
| 173 | throw new MappingException( |
|
| 174 | \sprintf( |
|
| 175 | 'Could not alias property %s in class %s because it does not exist.', |
|
| 176 | $propertyName, |
|
| 177 | $className |
|
| 178 | ) |
|
| 179 | ); |
|
| 180 | } |
|
| 181 | } |
|
| 182 | } |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Recursive function to get an associative array of class properties by |
|
| @@ 224-240 (lines=17) @@ | ||
| 221 | * |
|
| 222 | * @throws MappingException |
|
| 223 | */ |
|
| 224 | protected static function setHideProperties(array &$mappedClass, Mapping $mapping, $className) |
|
| 225 | { |
|
| 226 | if (false === empty($mappedClass[static::HIDE_PROPERTIES_KEY])) { |
|
| 227 | $mapping->setHiddenProperties($mappedClass[static::HIDE_PROPERTIES_KEY]); |
|
| 228 | foreach ($mapping->getHiddenProperties() as $propertyName) { |
|
| 229 | if (false === \in_array($propertyName, static::getClassProperties($className), true)) { |
|
| 230 | throw new MappingException( |
|
| 231 | \sprintf( |
|
| 232 | 'Could not hide property %s in class %s because it does not exist.', |
|
| 233 | $propertyName, |
|
| 234 | $className |
|
| 235 | ) |
|
| 236 | ); |
|
| 237 | } |
|
| 238 | } |
|
| 239 | } |
|
| 240 | } |
|
| 241 | ||
| 242 | /** |
|
| 243 | * @param array $mappedClass |
|