duanqun9618 2016-08-06 15:37
浏览 11

一个TextField,用于DataTransformer的两个属性

I have searched a lot on google but I have no idea of how to solve my problem. I have an Entity EntreeListe which contains two attributes rayon and produit. I would like that the user enter in a text field : Rayon : Produit.

So, I add two DataTransformer on my textfield produit

$builder->get('produit')
    ->addModelTransformer(new StringToProduitTransformer($this->manager));
$builder->get('produit')
    ->addModelTransformer(new StringToRayonTransformer($this->manager));

So that I can transform explode(' : ', $string)[0] into a Rayon and explode(' : ', $string)[1] into a Produit.

The problem is that, when I submit the form, the parameter passed to reverseTransform of StringToProduitTransformer is not a string but a Rayon because the transformation of StringToRayonTransformer is already done.

I don't know if I'm clear, so just ask questions. Any suggestions is welcome :).

What I want is to have the string passed to the two reverseTransform... So have multiple DataTransformer for one field.

Or is there another way to do this ? To complete two attributes with one input ?

Thank you very much.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算