em = $em; $this->rdp = $rdp; $this->class = $class; } /** * @param FormForgeFieldValueInterface $element * @return bool */ public function quickUpdateValue(FormForgeFieldValueInterface $element){ if(empty($element)) return false; try { $this->em->persist($element); $this->em->flush(); } catch (ORMException $e) { return false; } return true; } /** * @param FormForgeFieldValueInterface $element * @return bool */ public function deleteValue(FormForgeFieldValueInterface $element){ if($this->em->contains($element)){ try { $this->em->remove($element); $this->em->flush(); } catch (ORMException $e) { return false; } } return true; } /** * @param string $publicKey * @return FormForgeFieldValueInterface|null */ public function getCustomFieldValueByPublicKey(string $publicKey): ?FormForgeFieldValueInterface { $field = $this->em->getRepository($this->class)->findOneBy(['publicKey'=>$publicKey]); if (empty($field)) return null; return $field; } }