Exemple #1
0
 /**
  * @return array
  */
 public function uniqueIdValuesProvider()
 {
     $uuidables = array('Orm\\Data\\Modul', 'Orm\\Data\\Template', 'Orm\\Data\\Page', 'Orm\\Data\\Site', 'Orm\\Data\\Unit');
     $providerEntries = array();
     foreach ($uuidables as $uuidable) {
         $providerEntries[] = array($uuidable::ID_PREFIX, $uuidable::ID_SUFFIX, $uuidable::ID_PREFIX . UniqueIdGenerator::v4() . $uuidable::ID_SUFFIX);
     }
     return $providerEntries;
 }
Exemple #2
0
 /**
  * Generiert die Uuids aus einer uebergebenen Klassen-Instanz
  *
  * @param Orm\Iface\Data\Uuidable $dataInstance
  * @param integer $count
  * @return array
  */
 private function generateUuids(Uuidable $dataInstance, $count)
 {
     $uuids = array();
     $uuidPrefix = $dataInstance::ID_PREFIX;
     $uuidSuffix = $dataInstance::ID_SUFFIX;
     if ($count > 0) {
         for ($i = 0; $i < $count; ++$i) {
             $uuids[] = $uuidPrefix . UniqueIdGenerator::v4() . $uuidSuffix;
         }
     }
     return $uuids;
 }
Exemple #3
0
 /**
  * @return array
  */
 public function moduleIdValuesProvider()
 {
     $moduleIds = array(array(false, 'a'), array(false, 'a1'), array(false, 'new_module_id'), array(false, 'abcdefghijklmnopqrstuvwxyz_0123456789'), array(true, OrmDataModule::ID_PREFIX . UniqueIdGenerator::v4() . OrmDataModule::ID_SUFFIX), array(true, OrmDataModule::ID_PREFIX . UniqueIdGenerator::v4() . OrmDataModule::ID_SUFFIX), array(true, OrmDataModule::ID_PREFIX . '01234567-89ab-cdef-0123-456789abcdef' . OrmDataModule::ID_SUFFIX));
     $moduleIdFirstChars = range('a', 'z');
     $moduleIdChars = array_merge($moduleIdFirstChars, range(0, 9));
     $moduleIdChars[] = '_';
     foreach ($moduleIdFirstChars as $moduleIdFirstChar) {
         shuffle($moduleIdChars);
         $moduleId = $moduleIdFirstChar . implode('', $moduleIdChars);
         $moduleIds[] = array(false, $moduleId);
     }
     return $moduleIds;
 }
Exemple #4
0
 /**
  * Setzt eine neu generierte ID
  */
 public function setNewGeneratedId()
 {
     $this->id = DataModul::ID_PREFIX . UniqueIdGenerator::v4() . DataModul::ID_SUFFIX;
     return $this;
 }
Exemple #5
0
 /**
  * Setzt eine neu generierte ID
  */
 public function setNewGeneratedId()
 {
     $this->id = OrmDataTemplate::ID_PREFIX . UniqueIdGenerator::v4() . OrmDataTemplate::ID_SUFFIX;
 }
Exemple #6
0
 /**
  * Setzt eine neu generierte ID
  */
 public function setNewGeneratedId()
 {
     $this->id = DataMedia::ID_PREFIX . UniqueIdGenerator::v4() . DataMedia::ID_SUFFIX;
 }
Exemple #7
0
 /**
  * @param $templateUnit
  *
  * @return string
  */
 protected static function createNewPageUnitId($templateUnit)
 {
     return \Orm\Data\Page\MUnit::ID_PREFIX . \Seitenbau\UniqueIdGenerator::v4() . \Orm\Data\Page\MUnit::ID_SUFFIX;
 }
Exemple #8
0
 /**
  * fills the missing user attributes
  *
  * @param array   $user
  * @param string  $userName
  *
  * @return array
  */
 protected static function addValuesToUserArray(array $user, $userName)
 {
     if (!array_key_exists('id', $user)) {
         $user['id'] = \Seitenbau\UniqueIdGenerator::v4();
     }
     if (!array_key_exists('email', $user)) {
         $user['email'] = $userName . '@rukzuk.com';
     }
     if (!array_key_exists('password', $user)) {
         $user['password'] = '******';
         // == 123
     }
     if (!array_key_exists('firstname', $user)) {
         $user['firstname'] = $userName;
     }
     if (!array_key_exists('lastname', $user)) {
         $user['lastname'] = 'rukzuk';
     }
     if (!array_key_exists('language', $user)) {
         $user['language'] = 'en';
     }
     return $user;
 }
Exemple #9
0
 /**
  * Setzt eine neu generierte ID
  */
 public function setNewGeneratedId()
 {
     $this->id = DataTemplateSnippet::ID_PREFIX . UniqueIdGenerator::v4() . DataTemplateSnippet::ID_SUFFIX;
 }
Exemple #10
0
 /**
  * @param  string $websiteId
  * @param  string $buildId
  * @throws \Cms\Exception
  * @return array
  */
 private function createPublishingId($websiteId, $buildId)
 {
     $publishedId = $buildId . '.' . time() . '.' . UniqueIdGenerator::v4();
     $validator = new PublishedIdValidator();
     if (!$validator->isValid($publishedId)) {
         throw new CmsException('2', __METHOD__, __LINE__, array('message' => 'wrong published id format'));
     }
     return $publishedId;
 }