|
@@ 416-430 (lines=15) @@
|
| 413 |
|
* @param \DOMElement $mapping Doctrine XML mapping |
| 414 |
|
* @return array |
| 415 |
|
*/ |
| 416 |
|
private function getDoctrineFields(\DOMElement $mapping) |
| 417 |
|
{ |
| 418 |
|
$xpath = new \DOMXPath($mapping->ownerDocument); |
| 419 |
|
$xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping'); |
| 420 |
|
|
| 421 |
|
return array_map( |
| 422 |
|
function (\DOMElement $element) { |
| 423 |
|
return [ |
| 424 |
|
'name' => $element->getAttribute('fieldName'), |
| 425 |
|
'type' => $element->getAttribute('type'), |
| 426 |
|
]; |
| 427 |
|
}, |
| 428 |
|
iterator_to_array($xpath->query('doctrine:field', $mapping)) |
| 429 |
|
); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
/** |
| 433 |
|
* Get doctrine document embed-one fields |
|
@@ 438-452 (lines=15) @@
|
| 435 |
|
* @param \DOMElement $mapping Doctrine XML mapping |
| 436 |
|
* @return array |
| 437 |
|
*/ |
| 438 |
|
private function getDoctrineEmbedOneFields(\DOMElement $mapping) |
| 439 |
|
{ |
| 440 |
|
$xpath = new \DOMXPath($mapping->ownerDocument); |
| 441 |
|
$xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping'); |
| 442 |
|
|
| 443 |
|
return array_map( |
| 444 |
|
function (\DOMElement $element) { |
| 445 |
|
return [ |
| 446 |
|
'name' => $element->getAttribute('field'), |
| 447 |
|
'type' => $element->getAttribute('target-document'), |
| 448 |
|
]; |
| 449 |
|
}, |
| 450 |
|
iterator_to_array($xpath->query('*[self::doctrine:embed-one or self::doctrine:reference-one]', $mapping)) |
| 451 |
|
); |
| 452 |
|
} |
| 453 |
|
|
| 454 |
|
/** |
| 455 |
|
* Get doctrine document embed-many fields |
|
@@ 460-474 (lines=15) @@
|
| 457 |
|
* @param \DOMElement $mapping Doctrine XML mapping |
| 458 |
|
* @return array |
| 459 |
|
*/ |
| 460 |
|
private function getDoctrineEmbedManyFields(\DOMElement $mapping) |
| 461 |
|
{ |
| 462 |
|
$xpath = new \DOMXPath($mapping->ownerDocument); |
| 463 |
|
$xpath->registerNamespace('doctrine', 'http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping'); |
| 464 |
|
|
| 465 |
|
return array_map( |
| 466 |
|
function (\DOMElement $element) { |
| 467 |
|
return [ |
| 468 |
|
'name' => $element->getAttribute('field'), |
| 469 |
|
'type' => $element->getAttribute('target-document'), |
| 470 |
|
]; |
| 471 |
|
}, |
| 472 |
|
iterator_to_array($xpath->query('*[self::doctrine:embed-many or self::doctrine:reference-many]', $mapping)) |
| 473 |
|
); |
| 474 |
|
} |
| 475 |
|
|
| 476 |
|
/** |
| 477 |
|
* Gets an array of all fields, flat with full internal name in dot notation as key and |