php - Doctrine/DQL returning form values as DQL result during validation -


in system, can specify 2 week period bookings in high seasons, if 2 people lower in family hierarchy of 2 brothers want book same period in high season precedence rules apply.

i need period booking of contact chosen in form, added following code validate function in validator(1 used testing):

public function validate($value, constraint $constraint) {     $pb = $this->doctrine->getrepository('appbundle:period')->getpbforcontact(1);     var_dump($pb);    die(); 

here repository code corresponding function:

public function getpbforcontact($id){    $em = $this->getentitymanager();   $query = $em->createquery('select pb appbundle:period pb join pb.contact c c.id = :id , pb.draft = false')->setparameter('id', $id);   $pb = $query->getsingleresult();            return $pb;  } 

the trouble when dump period booking output given dates on edit form , not ones recorded in database. when specify columns in dql given start , end dates database records, no longer have object way. also, when use other contact's id gives me correct dates contact's period booking.

why returning entered form values when haven't been saved? can database values , not form values?

i using symfony 2.7 , doctrine.

this because doctrine uses identity map loaded objects. can't work 2 version of same entity. solution depends on many factors. example can clone entity before handling form , work copy.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -