Show
added a comment - Here is the real world example. I put the statement, the parameters, the error, and all the related entities.
INSERT INTO fna_client_revision (fna_parent_record_id, record_id, display_name, last_name, maiden_name, first_name, civility, gender, birthdate, employer, employment, employment_from, civil_status, civil_status_from, insurability, fna_client_fna_id, fna_spouse_fna_id, rev_no, created_at, modified_at, created_by, modified_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Array
(
[1] => 1
[2] => George Simard2
[3] => Simard2
[4] =>
[5] => George
[6] =>
[7] => MALE
[8] => 1962-09-14
[9] => Plomberie ABC Inc.
[10] => Plombier
[11] =>
[12] => MARRIED
[13] =>
[14] => INSURABLE
[15] => 5
[16] => 2009-12-07 08:54:46
[17] => 2009-12-07 08:54:46
[18] => Eric Durand-Tremblay
[19] => Eric Durand-Tremblay
[20] => 1
[21] =>
[22] =>
)
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'employment' cannot be null
namespace ORM\BaseEntity;
/**
* @MappedSuperclass
*/
class Entity
{
private static $boolean_values = array( "YES" , 'NO');
/**
* @Column(name= "id" , type= "integer" )
* @Id
* @GeneratedValue(strategy= "AUTO" )
*/
protected $id;
/**
* @Column(name= "created_at" , type= "datetime" )
*/
protected $created_at;
/**
* @Column(name= "modified_at" , type= "datetime" )
*/
protected $modified_at;
/**
* @Column(name= "created_by" , type= "string" )
*/
protected $created_by="";
/**
* @Column(name= "modified_by" , type= "string" )
*/
protected $modified_by="";
}
/**
* @MappedSuperclass
* @HasLifecycleCallbacks
*/
class Revisionable extends ORM\BaseEntity\Entity
{
/**
* @Column(name= "rev_no" , type= "integer" )
*/
protected $revision=1;
}
namespace ORM\BaseEntity;
/**
* @MappedSuperclass
* @HasLifecycleCallbacks
*/
class Client extends Revisionable
{
/**
* @Column(name= "display_name" , type= "string" )
*/
protected $display_name;
/**
* @Column(name= "last_name" , type= "string" )
*/
protected $last_name="";
/**
* @Column(name= "maiden_name" , type= "string" )
*/
protected $maiden_name="";
/**
* @Column(name= "first_name" , type= "string" )
*/
protected $first_name="";
/**
* @Column(name= "civility" , type= "string" )
*/
protected $civility="";
/**
* @Column(name= "gender" , type= "string" , length= "25" )
*/
protected $gender="";
/**
* @Column(name= "birthdate" , type= "date" , nullable= " true " )
*/
protected $birthdate;
/**
* @Column(name= "employer" , type= "string" )
*/
protected $employer="";
/**
* @Column(name= "employment" , type= "string" )
*/
protected $employment="";
/**
* @Column(name= "employment_from" , type= "date" , nullable= " true " )
*/
protected $employment_from;
/**
* @Column(name= "civil_status" , type= "string" , length= "25" )
*/
protected $civil_status="";
/**
* @Column(name= "civil_status_from" , type= "date" , nullable= " true " )
*/
protected $civil_status_from;
/**
* @Column(name= "insurability" , type= "string" , length= "25" )
*/
protected $insurability="";
/**
* @OneToOne(targetEntity= "ORM\Entity\FNA" )
* @JoinColumns({
* @JoinColumn(name= "fna_client_fna_id" , referencedColumnName= "id" )
* })
*/
protected $client_fna;
/**
* @OneToOne(targetEntity= "ORM\Entity\FNA" )
* @JoinColumns({
* @JoinColumn(name= "fna_spouse_fna_id" , referencedColumnName= "id" )
* })
*/
protected $spouse_fna;
}
namespace ORM\RevisionEntity;
/**
* @Entity
* @Table(name= "fna_client_revision" , indexes={@index(name= "idx_record_id" , columns={ "record_id" })})
* @HasLifecycleCallbacks
*/
class Client extends ORM\BaseEntity\Client{
/**
* @ManyToOne(targetEntity= "Kronos\FNA\ORM\Entity\Client" )
* @JoinColumns({
* @JoinColumn(name= "fna_parent_record_id" , referencedColumnName= "id" , onDelete= "SET NULL" )
* })
*/
protected $parent_record; /// HERE IS THE FIELD WHO CHANGE PLACE AFTER SERIALIZATION !!!!!!!!!!!!!!!!!!!!!!
/**
*
* @Column(name= "record_id" , type= " int " )
*/
protected $record_id;
}
Are you using composite keys anywhere?
The fact that reflFields is not serialized is not really an optimization but rather due to the fact that they simply can can not be serialized/unserialized properly.
We surely need some more concrete test case in order to reproduce this.