/**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     //load new entities
     $reports = [];
     foreach ($this->getEntityData() as $data) {
         $singleQueryReport = $manager->getRepository('AppBundle:SingleQueryReport')->findOneBy(['name' => $data['name']]);
         if (!$singleQueryReport) {
             $singleQueryReport = new SingleQueryReport();
             $singleQueryReport->setTag($data['tag']);
             $singleQueryReport->setName($data['name']);
             $singleQueryReport->setFilename($data['filename']);
             $availableToAccounts = isset($data['availableToAccounts']) ? $data['availableToAccounts'] : false;
             $singleQueryReport->setColumns($data['columns']);
             $singleQueryReport->setParameterWhiteList($data['parameterWhiteList']);
             foreach ($data['parts'] as $index => $partData) {
                 $part = new SingleQueryReportPart();
                 $part->setMethodName($partData['methodName']);
                 $part->setArgs($partData['args']);
                 $part->setOrder($index);
                 $singleQueryReport->addPart($part);
             }
             foreach ($data['countParts'] as $index => $partData) {
                 $part = new SingleQueryReportCountPart();
                 $part->setMethodName($partData['methodName']);
                 $part->setArgs($partData['args']);
                 $part->setOrder($index);
                 $singleQueryReport->addCountPart($part);
             }
             foreach ($data['singleQueryReportParameters'] as $paramData) {
                 $paramter = new SingleQueryReportParameter();
                 $paramter->setName($paramData['name']);
                 $paramter->setTitle($paramData['title']);
                 $paramter->setPriority($paramData['priority']);
                 $paramter->setType($paramData['type']);
                 $paramter->setIsFuzzy($paramData['isFuzzy']);
                 $paramter->setIsHidden($paramData['isHidden']);
                 $paramter->setIsOptional($paramData['isOptional']);
                 $paramter->setTemplate($paramData['template']);
                 $paramter->setValue($paramData['value']);
                 $paramter->setChoicesPropertyName($paramData['choicesPropertyName']);
                 foreach ($paramData['parts'] as $index => $partData) {
                     $part = new SingleQueryReportParameterPart();
                     $part->setMethodName($partData['methodName']);
                     $part->setArgs($partData['args']);
                     $part->setOrder($index);
                     $paramter->addPart($part);
                 }
                 $singleQueryReport->addSingleQueryReportParameter($paramter);
             }
             $manager->persist($singleQueryReport);
         }
         $reports[] = $singleQueryReport;
         //$this->addReference('dfwOffice', $dfwOffice);
     }
     $manager->flush();
     $this->initAclRoles();
     foreach ($reports as $report) {
         $this->addAcl($report);
         foreach ($report->getParts() as $part) {
             $this->addAcl($part);
         }
         foreach ($report->getCountParts() as $part) {
             $this->addAcl($part);
         }
         foreach ($report->getSingleQueryReportParameters() as $paramter) {
             $this->addAcl($paramter);
             foreach ($paramter->getParts() as $part) {
                 $this->addAcl($part);
             }
         }
     }
     return true;
 }
 public function removePart(SingleQueryReportPart $part)
 {
     $part->setSingleQueryReport(null);
     $this->parts->remove($part);
 }