Assume i have an array of data contacts,
$cont = array("123-123-123","[email protected]");
Which i stored in symfony2 doctrine field as json_array type
$person->setContacts($cont); //Which automatically converts into json
Now my problem is, while searching the person by contact,
$cont['contacts'] = array("123-123-123","[email protected]");
or
$cont['contacts'] = json_encode(array("123-123-123","[email protected]"));
$person->findBy($cont);
Does not yield the correct result, is there any other method to retrieve the data by json_array field,sorry if the question is too basic.
setContactsmethod?Contact? Or use Value Objects like in @Guilro's answer?