Sulu\Component\Rest\ListBuilder\Metadata\Doctrine\Type\ConcatenationTypeMetadata::addField PHP Method

addField() public method

Add a field which should be combined with the other fields.
public addField ( FieldMetadata $field )
$field Sulu\Component\Rest\ListBuilder\Metadata\Doctrine\FieldMetadata
    public function addField(FieldMetadata $field)
    {
        $this->fields[] = $field;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Extracts concatenation-type for property-node.
  *
  * @param \DOMXPath $xpath
  * @param \DOMElement $propertyNode
  *
  * @return ConcatenationTypeMetadata
  */
 protected function getConcatenationType(\DOMXPath $xpath, \DOMElement $propertyNode)
 {
     $type = new ConcatenationTypeMetadata(XmlUtil::getValueFromXPath('@orm:glue', $xpath, $propertyNode, ' '));
     foreach ($xpath->query('orm:field', $propertyNode) as $fieldNode) {
         if (null === ($field = $this->getField($xpath, $fieldNode))) {
             continue;
         }
         $type->addField($field);
     }
     return $type;
 }