/** * Is the devlog enabled? * * @return \Tx_Rnbase_Domain_Model_Data */ public function getExtConf() { if (!$this->getStorage()->hasExtConf()) { $this->getStorage()->setExtConf(\Tx_Rnbase_Domain_Model_Data::getInstance(unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mklog']))); } return $this->getStorage()->getExtConf(); }
/** * Test the encrypt method * * @return void * * @group unit * @test * @dataProvider getCryptionData */ public function testCryption(array $config = array()) { $data = Tx_Rnbase_Domain_Model_Data::getInstance(array('uid' => 5, 'body' => str_shuffle(substr(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' . LF, 32768), 0, 10)))); $crypt = Tx_Rnbase_Utility_Crypt::getInstance(array_merge(array('cipher' => MCRYPT_BLOWFISH, 'mode' => MCRYPT_MODE_ECB, 'key' => 'th3S3cr3t'), $config)); $crypted = $crypt->encrypt($data); self::assertTrue(is_string($crypted)); self::assertNotEquals($crypted, $data); $decrypted = $crypt->decrypt($crypted); self::assertEquals($decrypted, $data); }
/** * Inits the model instance either with uid or a complete data record. * As the result the instance should be completly loaded. * * @param mixed $rowOrUid * @return NULL */ protected function init($rowOrUid = NULL) { if (is_array($rowOrUid)) { parent::init($rowOrUid); $this->uid = $this->getProperty('uid'); } else { $rowOrUid = (int) $rowOrUid; $this->uid = $rowOrUid; if ($rowOrUid === 0) { parent::init(array()); } elseif ($this->getTableName()) { $this->loadRecord(); } } // set the modified state to clean $this->resetCleanState(); return NULL; }
/** * Returns the internal storage * * @return Tx_Rnbase_Domain_Model_Data */ protected function getStorage() { if ($this->storage === NULL) { $this->storage = Tx_Rnbase_Domain_Model_Data::getInstance(); } return $this->storage; }
/** * Initializes the Transport * * @param \Tx_Rnbase_Domain_Model_Data $options * * @return void */ public function initialize(\Tx_Rnbase_Domain_Model_Data $options) { $this->options = \Tx_Rnbase_Domain_Model_Data::getInstance($options); }
/** * @test */ public function testRecursiveInstance() { $data = array('gender' => 'm', 'name' => array('first' => 'John', 'last' => 'Doe', 'test' => array())); $model = Tx_Rnbase_Domain_Model_Data::getInstance($data); $this->assertSame('m', $model->getGender()); $this->assertInstanceOf('Tx_Rnbase_Domain_Model_Data', $model->getName()); $this->assertSame('John', $model->getName()->getFirst()); $this->assertSame('Doe', $model->getName()->getLast()); $this->assertInstanceOf('Tx_Rnbase_Domain_Model_Data', $model->getName()->getTest()); }
/** * Persists an model * * @param \Tx_Rnbase_Domain_Model_DomainInterface $model * @param array|\Tx_Rnbase_Domain_Model_Data $options * * @return void */ public function persist(\Tx_Rnbase_Domain_Model_DomainInterface $model, $options = null) { \tx_rnbase::load('Tx_Rnbase_Domain_Model_Data'); $options = \Tx_Rnbase_Domain_Model_Data::getInstance($options); // there is no tca, so skip this check! $options->setSkipTcaColumnElimination(true); parent::persist($model, $options); }