我使用实体并使用flush()和persist()Doctrine将数据添加到数据库。 但是当我的实体具有null属性时,它不会插入到数据库中。仅在填充所有属性时才进行插入。 如何让它始终在数据库中输入数据? 这是我的实体:
object(JRP\Boleto\Entity\Boleto)#74 (23) {
["id":"JRP\Boleto\Entity\Boleto":private]=>
NULL
["mora_dia":"JRP\Boleto\Entity\Boleto":private]=>
float(0)
["multa":"JRP\Boleto\Entity\Boleto":private]=>
float(0)
["detalhe":"JRP\Boleto\Entity\Boleto":private]=>
NULL
["ag_cod":"JRP\Boleto\Entity\Boleto":private]=>
string(15) "1893-7/536151-6"
["nossonumero":"JRP\Boleto\Entity\Boleto":private]=>
string(17) "15713790245291896"
["valor":"JRP\Boleto\Entity\Boleto":private]=>
float(10.8)
["sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(33) "XXXX"
["end_sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(21) "XXXXX"
["cep_sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(9) "09270-410"
["cidade_sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(11) "XXXXXX"
["cnpj_sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(18) "57.546.715.0001-61"
["inscricao_sacado":"JRP\Boleto\Entity\Boleto":private]=>
string(14) "XXXXX"
["notafiscal":"JRP\Boleto\Entity\Boleto":private]=>
string(7) "1872328"
["cod_cliente":"JRP\Boleto\Entity\Boleto":private]=>
string(10) "0000080537"
["linha":"JRP\Boleto\Entity\Boleto":private]=>
string(42) "01571.379021 45291.896178 2 62920001080249"
["vencimento_original":"JRP\Boleto\Entity\Boleto":private]=>
object(DateTime)#83 (3) {
["date"]=>
string(19) "2014-12-29 00:36:28"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "America/New_York"
}
["cedente":"JRP\Boleto\Entity\Boleto":private]=>
string(15) "BRF S.A.,BRASIL"
["cnpj_cedente":"JRP\Boleto\Entity\Boleto":private]=>
string(14) "01838723009850"
["carro":"JRP\Boleto\Entity\Boleto":private]=>
string(4) "0602"
["data_documento":"JRP\Boleto\Entity\Boleto":private]=>
object(DateTime)#38 (3) {
["date"]=>
string(19) "2014-11-18 00:36:28"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "America/New_York"
}
["num_documento":"JRP\Boleto\Entity\Boleto":private]=>
string(13) "001872328-001"
["data_proc":"JRP\Boleto\Entity\Boleto":private]=>
object(DateTime)#67 (3) {
["date"]=>
string(19) "2014-11-19 00:36:28"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "America/New_York"
}
}