示例#1
0
/**
 * @param array $fields
 *
 * @return array
 */
function filter_relationship(array $fixtures, array $fields)
{
    $filteredFields = array();
    foreach ($fields as $name => $value) {
        if (!is_to_one_relationship($value) && !is_to_many_relationship($value) && !isset($fixtures[$name])) {
            $filteredFields[$name] = $value;
        }
    }
    return $filteredFields;
}
/**
 * @param mixed $value
 *
 * @return bool
 */
function is_to_many_relationship($value)
{
    return is_array($value) && !empty($value) && is_to_one_relationship($value[0]);
}
 /**
  * {@inheritDoc}
  */
 public function supports($value)
 {
     return is_to_one_relationship($value);
 }