Example #1
0
 /**
  * Import a Json file (.rzt) containing node and node source.
  *
  * @param string $serializedData
  *
  * @return bool
  */
 public static function importJsonFile($serializedData)
 {
     $nodes = NodeJsonSerializer::deserialize($serializedData);
     $exist = Kernel::getInstance()->getService('em')->getRepository('RZ\\Roadiz\\Core\\Entities\\Node')->findAll();
     if (empty($exist)) {
         foreach ($nodes as $node) {
             static::browseTree($node);
         }
     }
     return true;
 }
Example #2
0
 /**
  * Import a Json file (.rzt) containing node and node source.
  *
  * @param string $serializedData
  * @param EntityManager $em
  *
  * @return bool
  */
 public static function importJsonFile($serializedData, EntityManager $em)
 {
     $serializer = new NodeJsonSerializer($em);
     $nodes = $serializer->deserialize($serializedData);
     $exist = $em->getRepository('RZ\\Roadiz\\Core\\Entities\\Node')->findAll();
     if (empty($exist)) {
         foreach ($nodes as $node) {
             static::browseTree($node, $em);
         }
     }
     return true;
 }