Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12 from okulbilisim/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
hmert committed Nov 10, 2014
2 parents 3b8a254 + cf3b7ae commit 258c6c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/Ojs/Common/Listener/UserListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public function loadJournalRoles()
{
$user = $this->checkUser();

if (!$user || !$this->session->get('selectedJournalId')) {
return;
}
//for API_KEY based connection
if($user instanceof \Symfony\Component\Security\Core\User\User){
$user = $this->container->get('doctrine')->getManager()->getRepository('OjsUserBundle:User')->findOneBy(['username'=>$user->getUsername()]);
}

if (!$user || !$this->session->get('selectedJournalId')) {
return;
}
$em = $this->container->get('doctrine')->getManager();
$repo = $em->getRepository('OjsUserBundle:UserJournalRole');
$entities = $repo->findBy(array('userId' => $user->getId(), 'journalId' => $this->session->get('selectedJournalId')));
Expand All @@ -76,7 +76,7 @@ public function loadClientUsers()
{
$user = $this->checkUser();
if (!$user) {
throw new UsernameNotFoundException("User not found.");
return;
}

//for API_KEY based connection
Expand All @@ -99,7 +99,7 @@ public function loadJournals()
/** @var User $user */
$user = $this->checkUser();
if (!$user) {
throw new UsernameNotFoundException("User not found.");
return;
}

//for API_KEY based connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class LoadInstitutionData extends AbstractFixture implements OrderedFixtureInterface
{

public function load(ObjectManager $manager)
{
$institution = new Institution();
Expand All @@ -19,12 +20,13 @@ public function load(ObjectManager $manager)
$institution->setAbout("About Abc University");
$institution->setPhone("+90 312 555 5555");
$manager->persist($institution);
$this->addReference('ref-institution', $institution);
$manager->flush();
}

public function getOrder()
{
return 4;
return 5;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class LoadInstitutionTypesData extends AbstractFixture implements OrderedFixtureInterface
{

public function load(ObjectManager $manager)
{
$itype = new InstitutionTypes();
Expand All @@ -21,12 +22,14 @@ public function load(ObjectManager $manager)
$itype2->setDescription("Demo intsitution desc.");
$manager->persist($itype2);

$this->addReference('ref-institution-type-1', $itype);
$this->addReference('ref-institution-type-2', $itype2);
$manager->flush();
}

public function getOrder()
{
return 5;
return 4;
}

}
5 changes: 5 additions & 0 deletions src/Ojs/JournalBundle/DataFixtures/ORM/LoadJournalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public function load(ObjectManager $manager)
{
$languages = $manager->getRepository('OjsJournalBundle:Lang')->findAll();

$institution = $this->getReference('ref-institution');

$journal = new Journal();
$journal->setIssn("1300-7041");
$journal->setMission("Mission text");
Expand All @@ -25,6 +27,7 @@ public function load(ObjectManager $manager)
$journal->setTitleTransliterated(null);
$journal->setUrl("https://app.ojs.io");
$journal->setSubdomain("local");
$journal->setInstitution($institution);
$manager->persist($journal);

$journal2 = new Journal();
Expand All @@ -39,6 +42,8 @@ public function load(ObjectManager $manager)
$journal2->setTitleTransliterated(null);
$journal2->setUrl("https://example2.edu");
$journal2->setSubdomain("demo2");
$journal2->setInstitution($institution);

$manager->persist($journal2);

/* @var $lang \Ojs\JournalBundle\Entity\Lang */
Expand Down
4 changes: 2 additions & 2 deletions src/Ojs/JournalBundle/Entity/Journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public function getUrl()
* @param int $institutionId
* @return Journal
*/
public function setInstitutioId($institutionId)
public function setInstitutionId($institutionId)
{
$this->institutionId = $institutionId;
return $this;
Expand All @@ -555,7 +555,7 @@ public function getInstitutionId()
*/
public function setInstitution($institution)
{
$this->institutionId = $institution;
$this->institution = $institution;
return $this;
}

Expand Down

0 comments on commit 258c6c1

Please sign in to comment.