Tips are stored on the central PartKeepr server in a wiki. However, we need to know a list of all tip pages because the API has a limit per day. So basically, we sync the tip names from the wiki to the local system several times a day and not each time an user logs in. Note: If you wish to link against a tip of the day, do it by name and not by id!
Inheritance: extends PartKeepr\CoreBundle\Entity\BaseEntity
Esempio n. 1
0
 public function load(ObjectManager $manager)
 {
     $tipOfTheDay = new TipOfTheDay();
     $tipOfTheDay->setName('FOO');
     $manager->persist($tipOfTheDay);
     $manager->flush();
     $this->addReference('tipoftheday', $tipOfTheDay);
 }
Esempio n. 2
0
 /**
  * Updates the tip database. Expects an array of page names.
  *
  * This method clears all page names and re-creates them. This saves
  * alot of engineering, because we don't need to match contents
  * within the database against contents in an array.
  *
  * @param array $aPageNames The page names as array. Page names are stored as string.
  */
 private function updateTipDatabase(array $aPageNames)
 {
     $dql = 'DELETE FROM PartKeepr\\TipOfTheDayBundle\\Entity\\TipOfTheDay';
     $query = $this->entityManager->createQuery($dql);
     $query->execute();
     foreach ($aPageNames as $pageName) {
         $tip = new TipOfTheDay();
         $tip->setName($pageName);
         $this->entityManager->persist($tip);
     }
     $this->entityManager->flush();
 }