/** * {@inheritDoc} */ protected function doLoad(ObjectManager $manager) { $j0 = new Journal(); $j0->setEmail('*****@*****.**'); $j0->setIssn('1234-1234'); $j0->setPublisherName('Test Publisher'); $j0->setPublisherUrl('http://example.com'); $j0->setTitle('I J Testing'); $j0->setUrl('http://journal.example.com'); $j0->setStatus('healthy'); $j0->setUuid('c0a65967-32bd-4ee8-96de-c469743e563a'); $j0->setOjsVersion('2.4.8.0'); $manager->persist($j0); $j0->setContacted(new DateTime('-10 days')); $j0->setNotified(new DateTime('-5 days')); $j1 = new Journal(); $j1->setEmail('*****@*****.**'); $j1->setIssn('4321-4321'); $j1->setPublisherName('Orange Inc'); $j1->setPublisherUrl('http://orangula.dev'); $j1->setTitle('J Oranges'); $j1->setUrl('http://journal.orangula.dev'); $j1->setStatus('new'); $j1->setUuid('A556CBF2-B674-444F-87B7-23DEE36F013D'); $j1->setContacted(new DateTime()); $manager->persist($j1); $manager->flush(); $this->setReference('journal', $j0); }
/** * Build and persist a journal from XML. * * @param SimpleXMLElement $xml * @param string $journal_uuid * * @return Journal */ public function fromXml(SimpleXMLElement $xml, $journal_uuid) { $journal = $this->em->getRepository('AppBundle:Journal')->findOneBy(array('uuid' => $journal_uuid)); if ($journal === null) { $journal = new Journal(); } $journal->setUuid($journal_uuid); $journal->setTitle($this->getXmlValue($xml, '//atom:title')); $journal->setUrl(html_entity_decode($this->getXmlValue($xml, '//pkp:journal_url'))); // & -> & $journal->setEmail($this->getXmlValue($xml, '//atom:email')); $journal->setIssn($this->getXmlValue($xml, '//pkp:issn')); $journal->setPublisherName($this->getXmlValue($xml, '//pkp:publisherName')); $journal->setPublisherUrl(html_entity_decode($this->getXmlValue($xml, '//pkp:publisherUrl'))); // & -> & $this->em->persist($journal); $this->em->flush($journal); return $journal; }