function let(PropertyTransformerInterface $transformer, ColumnInfoInterface $columnInfo, ClassMetadataInfo $metadata)
 {
     $this->beConstructedWith($transformer, 'array');
     $columnInfo->getPropertyPath()->willReturn('property_path');
     $metadata->hasField('property_path')->willReturn(true);
     $metadata->getTypeOfField('property_path')->willReturn('array');
 }
Ejemplo n.º 2
0
 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param ClassMetadataInfo $metadata
  *
  * @return array $fields
  */
 private function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = (array) $metadata->fieldNames;
     if (!$metadata->isIdentifierNatural()) {
         $fields = array_diff($fields, $metadata->identifier);
     }
     $fieldsMapping = array();
     foreach ($fields as $field) {
         $fieldsMapping[$field] = $metadata->getTypeOfField($field);
     }
     foreach ($metadata->associationMappings as $fieldName => $relation) {
         if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
             $fieldsMapping[$fieldName] = 'relation';
         }
     }
     return $fieldsMapping;
 }
Ejemplo n.º 3
0
 /**
  * Checks if $field type is valid
  * 
  * @param ClassMetadataInfo $meta
  * @param string $field
  * @return boolean
  */
 protected function _isValidField(ClassMetadataInfo $meta, $field)
 {
     return in_array($meta->getTypeOfField($field), $this->_validTypes);
 }