/** * Create a record. * @REST */ public function postAction() { // Create record. $record = new NeatlineRecord(); $post = Zend_Json::decode($this->_request->getRawBody()); $record->saveForm($post); // Respond with record data. echo Zend_Json::encode($record->toArray()); }
/** * When data is saved to a new, unsaved record, values from the `all` * selector should be pulled to the record before it is used to update the * exhibit CSS. */ public function testPullAllTagWhenUnsaved() { $exhibit = $this->_exhibit(); $exhibit->styles = "\n .all {\n fill-color: 1;\n }\n "; $exhibit->save(); // Save data to unsaved record. $record = new NeatlineRecord($exhibit); $record->saveForm(array('fill_color' => '2')); // Should pull CSS value. $this->assertEquals('1', $record->fill_color); // CSS should be unchanged. $this->assertEquals(array('all' => array('fill_color' => '1')), nl_readCSS($exhibit->styles)); }