Commit 3438aef5 authored by Jonathan.Wage's avatar Jonathan.Wage

Refactoring of Resource module.

parent c7ea8f37
...@@ -46,11 +46,15 @@ class Doctrine_Export_Schema ...@@ -46,11 +46,15 @@ class Doctrine_Export_Schema
* @param string $directory * @param string $directory
* @return void * @return void
*/ */
public function buildSchema($directory, $models = array()) public function buildSchema($directory = null, $models = array())
{ {
$array = array(); $array = array();
$loadedModels = Doctrine::loadModels($directory); if ($directory) {
$loadedModels = Doctrine::loadModels($directory);
} else {
$loadedModels = Doctrine::getLoadedModels();
}
$parent = new ReflectionClass('Doctrine_Record'); $parent = new ReflectionClass('Doctrine_Record');
...@@ -140,7 +144,7 @@ class Doctrine_Export_Schema ...@@ -140,7 +144,7 @@ class Doctrine_Export_Schema
* @param string $directory * @param string $directory
* @return void * @return void
*/ */
public function exportSchema($schema, $format, $directory, $models = array()) public function exportSchema($schema, $format, $directory = null, $models = array())
{ {
$array = $this->buildSchema($directory, $models); $array = $this->buildSchema($directory, $models);
......
...@@ -41,7 +41,17 @@ class Doctrine_Import_Schema ...@@ -41,7 +41,17 @@ class Doctrine_Import_Schema
{ {
public $relations = array(); public $relations = array();
public function buildSchema($schema, $format)
{
$array = array();
foreach ((array) $schema AS $s) {
$array = array_merge($array, $this->parseSchema($s, $format));
}
$this->buildRelationships($array);
return array('schema' => $array, 'relations' => $this->relations);
}
/** /**
* importSchema * importSchema
* *
...@@ -58,12 +68,9 @@ class Doctrine_Import_Schema ...@@ -58,12 +68,9 @@ class Doctrine_Import_Schema
$builder = new Doctrine_Import_Builder(); $builder = new Doctrine_Import_Builder();
$builder->setTargetPath($directory); $builder->setTargetPath($directory);
$array = array(); $schema = $this->buildSchema($schema, $format);
foreach ((array) $schema AS $s) {
$array = array_merge($array, $this->parseSchema($s, $format));
}
$this->buildRelationships($array); $array = $schema['schema'];
foreach ($array as $name => $properties) { foreach ($array as $name => $properties) {
if (!empty($models) && !in_array($properties['className'], $models)) { if (!empty($models) && !in_array($properties['className'], $models)) {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource * Doctrine_Resource
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -32,34 +33,37 @@ ...@@ -32,34 +33,37 @@
*/ */
class Doctrine_Resource class Doctrine_Resource
{ {
public static function request($url, $request) protected $_config = null;
{ protected $_defaultFormat = 'xml';
$url .= strstr($url, '?') ? '&':'?';
$url .= http_build_query($request);
$response = file_get_contents($url);
return $response;
}
public function hydrate(array $array, $model, $config, $passedKey = null) public function __construct($config)
{ {
$collection = new Doctrine_Resource_Collection($model, $config); foreach ($config as $key => $value) {
$this->getConfig()->set($key, $value);
}
foreach ($array as $record) { $loadDoctrine = false;
$r = new Doctrine_Resource_Record($model, $config); foreach ($this->getConfig()->getAll() as $key => $value) {
if ($key == 'url') {
foreach ($record as $key => $value) { $this->loadDoctrine = true;
if (is_array($value)) {
$r->data[$key] = $this->hydrate($value, $model, $config, $key);
} else {
$r->data[$key] = $value;
}
} }
}
$collection->data[] = $r; if (!$this->getConfig()->has('format') OR !$this->getConfig()->get('format')) {
$this->getConfig()->set('format', $this->_defaultFormat);
}
}
public function getConfig($key = null)
{
if ($this->_config === null) {
$this->_config = new Doctrine_Resource_Config();
} }
return $collection; if ($key === null) {
return $this->_config;
} else {
return $this->_config->get($key);
}
} }
} }
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource_Client * Doctrine_Resource_Client
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -32,25 +33,57 @@ ...@@ -32,25 +33,57 @@
*/ */
class Doctrine_Resource_Client extends Doctrine_Resource class Doctrine_Resource_Client extends Doctrine_Resource
{ {
public $config = array(); public $loadDoctrine = false;
public function __construct($config) static public function getInstance($config = null)
{ {
$this->config = $config; static $instance;
if (!$instance) {
$instance = new Doctrine_Resource_Client($config);
if ($instance->loadDoctrine === true) {
$instance->loadDoctrine();
}
}
return $instance;
}
public function loadDoctrine()
{
$path = '/tmp/' . md5(serialize($this->getConfig()));
if (file_exists($path)) {
$schema = file_get_contents($path);
} else {
$request = new Doctrine_Resource_Request();
$request->set('type', 'load');
$request->set('format', 'xml');
$schema = $request->execute();
file_put_contents($path, $schema);
}
$import = new Doctrine_Import_Schema();
$schema = $import->buildSchema($path, 'xml');
$this->getConfig()->set('schema', $schema);
} }
public function newQuery() public function newQuery()
{ {
return new Doctrine_Resource_Query($this->config); return new Doctrine_Resource_Query();
} }
public function newRecord($model) public function newRecord($model, $loadRelations = true)
{ {
return new Doctrine_Resource_Record($model, $this->config); return new Doctrine_Resource_Record($model, $loadRelations);
} }
public function newCollection($model) public function newCollection($model)
{ {
return new Doctrine_Resource_Collection($model, $this->config); return new Doctrine_Resource_Collection($model);
} }
} }
\ No newline at end of file
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource_Collection * Doctrine_Resource_Collection
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -32,50 +33,57 @@ ...@@ -32,50 +33,57 @@
*/ */
class Doctrine_Resource_Collection extends Doctrine_Access implements Countable, IteratorAggregate class Doctrine_Resource_Collection extends Doctrine_Access implements Countable, IteratorAggregate
{ {
public $data = array(); protected $_data = array();
public $config = array(); protected $_config = array();
public $model = null; protected $_model = null;
public function __construct($model, $config) public function __construct($model)
{ {
$this->model = $model; $this->_model = $model;
$this->config = $config; }
public function getConfig($key = null)
{
return Doctrine_Resource_Client::getInstance()->getConfig($key);
} }
public function count() public function count()
{ {
return count($data); return count($this->_data);
} }
public function get($get) public function get($get)
{ {
if (isset($this->data[$get])) { if (isset($this->_data[$get])) {
return $this->data[$get]; return $this->_data[$get];
} }
} }
public function set($set, $value) public function set($set, $value)
{ {
$this->data[$set] = $value; $this->_data[$set] = $value;
}
public function add($value)
{
$this->_data[] = $value;
} }
public function getIterator() public function getIterator()
{ {
$data = $this->data; return new ArrayIterator($this->_data);
return new ArrayIterator($data);
} }
public function getFirst() public function getFirst()
{ {
return isset($this->data[0]) ? $this->data[0]:null; return isset($this->_data[0]) ? $this->_data[0]:null;
} }
public function toArray() public function toArray()
{ {
$array = array(); $array = array();
foreach ($this->data as $key => $record) { foreach ($this->_data as $key => $record) {
$array[$key] = $record->toArray(); $array[$key] = $record->toArray();
} }
...@@ -84,7 +92,7 @@ class Doctrine_Resource_Collection extends Doctrine_Access implements Countable, ...@@ -84,7 +92,7 @@ class Doctrine_Resource_Collection extends Doctrine_Access implements Countable,
public function save() public function save()
{ {
foreach ($this->data as $record) { foreach ($this as $record) {
$record->save(); $record->save();
} }
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource_Query * Doctrine_Resource_Query
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -30,66 +31,58 @@ ...@@ -30,66 +31,58 @@
* @link www.phpdoctrine.com * @link www.phpdoctrine.com
* @since 1.0 * @since 1.0
*/ */
class Doctrine_Resource_Query extends Doctrine_Resource class Doctrine_Resource_Query
{ {
public $config = array(); protected $_parts = array();
public $parts = array(); protected $_dql = null;
public $dql = null; protected $_params = array();
public $defaultFormat = 'xml';
public function __construct($config) public function getConfig($key = null)
{ {
$this->config = $config; return Doctrine_Resource_Client::getInstance()->getConfig($key);
} }
public function query($dql, $params = array()) public function query($dql, $params = array())
{ {
$this->dql = $dql; $this->_dql = $dql;
return $this->execute($params); return $this->execute($params);
} }
public function execute($params = array()) public function execute($params = array())
{ {
$request = array(); $request = new Doctrine_Resource_Request();
$request['dql'] = $this->getDql(); $request->set('dql', $this->getDql());
$request['params'] = $params; $request->set('params', $params);
$request['format'] = $this->getFormat(); $request->set('format', $this->getConfig()->get('format'));
$request['type'] = 'query'; $request->set('type', 'query');
$response = self::request($this->config['url'], $request); $response = $request->execute();
return $this->parseResponse($response); $array = Doctrine_Parser::load($response, $this->getConfig()->get('format'));
return $request->hydrate($array, $this->getModel());
} }
public function getDql() public function getDql()
{ {
if (!$this->dql && !empty($this->parts)) { if (!$this->_dql && !empty($this->_parts)) {
$q = ''; $q = '';
$q .= ( ! empty($this->parts['select']))? 'SELECT ' . implode(', ', $this->parts['select']) : ''; $q .= ( ! empty($this->_parts['select']))? 'SELECT ' . implode(', ', $this->_parts['select']) : '';
$q .= ( ! empty($this->parts['from']))? ' FROM ' . implode(' ', $this->parts['from']) : ''; $q .= ( ! empty($this->_parts['from']))? ' FROM ' . implode(' ', $this->_parts['from']) : '';
$q .= ( ! empty($this->parts['where']))? ' WHERE ' . implode(' AND ', $this->parts['where']) : ''; $q .= ( ! empty($this->_parts['where']))? ' WHERE ' . implode(' AND ', $this->_parts['where']) : '';
$q .= ( ! empty($this->parts['groupby']))? ' GROUP BY ' . implode(', ', $this->parts['groupby']) : ''; $q .= ( ! empty($this->_parts['groupby']))? ' GROUP BY ' . implode(', ', $this->_parts['groupby']) : '';
$q .= ( ! empty($this->parts['having']))? ' HAVING ' . implode(' AND ', $this->parts['having']) : ''; $q .= ( ! empty($this->_parts['having']))? ' HAVING ' . implode(' AND ', $this->_parts['having']) : '';
$q .= ( ! empty($this->parts['orderby']))? ' ORDER BY ' . implode(', ', $this->parts['orderby']) : ''; $q .= ( ! empty($this->_parts['orderby']))? ' ORDER BY ' . implode(', ', $this->_parts['orderby']) : '';
$q .= ( ! empty($this->parts['limit']))? ' LIMIT ' . implode(' ', $this->parts['limit']) : ''; $q .= ( ! empty($this->_parts['limit']))? ' LIMIT ' . implode(' ', $this->_parts['limit']) : '';
$q .= ( ! empty($this->parts['offset']))? ' OFFSET ' . implode(' ', $this->parts['offset']) : ''; $q .= ( ! empty($this->_parts['offset']))? ' OFFSET ' . implode(' ', $this->_parts['offset']) : '';
return $q; return $q;
} else { } else {
return $this->dql; return $this->_dql;
} }
} }
public function parseResponse($response)
{
$array = Doctrine_Parser::load($response, $this->getFormat());
$hydrated = $this->hydrate($array, $this->getModel(), $this->config);
return $hydrated;
}
public function buildUrl($array) public function buildUrl($array)
{ {
$url = ''; $url = '';
...@@ -115,18 +108,6 @@ class Doctrine_Resource_Query extends Doctrine_Resource ...@@ -115,18 +108,6 @@ class Doctrine_Resource_Query extends Doctrine_Resource
return $e[0]; return $e[0];
} }
public function setFormat($format)
{
$this->config['format'] = $format;
return $this;
}
public function getFormat()
{
return isset($this->config['format']) ? $this->config['format']:$this->defaultFormat;
}
/** /**
* addSelect * addSelect
* adds fields to the SELECT part of the query * adds fields to the SELECT part of the query
...@@ -253,7 +234,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource ...@@ -253,7 +234,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource
*/ */
public function distinct($flag = true) public function distinct($flag = true)
{ {
$this->parts['distinct'] = (bool) $flag; $this->_parts['distinct'] = (bool) $flag;
return $this; return $this;
} }
...@@ -267,7 +248,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource ...@@ -267,7 +248,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource
*/ */
public function forUpdate($flag = true) public function forUpdate($flag = true)
{ {
$this->parts[self::FOR_UPDATE] = (bool) $flag; $this->_parts[self::FOR_UPDATE] = (bool) $flag;
return $this; return $this;
} }
...@@ -446,7 +427,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource ...@@ -446,7 +427,7 @@ class Doctrine_Resource_Query extends Doctrine_Resource
*/ */
public function parseQueryPart($queryPartName, $queryPart) public function parseQueryPart($queryPartName, $queryPart)
{ {
$this->parts[$queryPartName][] = $queryPart; $this->_parts[$queryPartName][] = $queryPart;
return $this; return $this;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource_Record * Doctrine_Resource_Record
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -32,70 +33,117 @@ ...@@ -32,70 +33,117 @@
*/ */
class Doctrine_Resource_Record extends Doctrine_Record_Abstract implements Countable, IteratorAggregate class Doctrine_Resource_Record extends Doctrine_Record_Abstract implements Countable, IteratorAggregate
{ {
public $data = array(); protected $_data = array();
public $config = array(); protected $_model = null;
public $model = null; protected $_schema = null;
public function __construct($model, $config) public function __construct($model, $loadRelations = true)
{ {
$this->model = $model; $this->_model = $model;
$this->config = $config;
$schema = $this->getConfig('schema');
if (isset($schema['schema'][$model]) && $schema['schema'][$model]) {
$this->_schema = $schema['schema'][$model];
}
if (isset($schema['relations'][$model]) && $schema['relations'][$model]) {
$this->_schema['relations'] = $schema['relations'][$model];
}
$this->initialize($loadRelations);
}
public function initialize($loadRelations = true)
{
if (!$this->_schema) {
return false;
}
$schema = $this->_schema;
$relations = $this->_schema['relations'];
if (isset($schema['columns'])) {
$columns = $schema['columns'];
foreach ($columns as $column) {
if (!isset($this->_data[$column['name']]) || $this->_data[$column['name']]) {
$this->_data[$column['name']] = null;
}
}
}
if (isset($schema['relations']) && $loadRelations) {
$relations = $schema['relations'];
foreach ($relations as $relation) {
if ($relation['type'] === Doctrine_Relation::ONE) {
$this->_data[$relation['alias']] = Doctrine_Resource_Client::getInstance()->newRecord($relation['class'], false);
} else {
$this->_data[$relation['alias']] = Doctrine_Resource_Client::getInstance()->newCollection($relation['class']);
}
}
}
}
public function getConfig($key = null)
{
return Doctrine_Resource_Client::getInstance()->getConfig($key);
} }
public function get($get) public function get($get)
{ {
if (!isset($this->data[$get])) { if (!isset($this->_data[$get])) {
$this->data[$get] = null; $this->_data[$get] = null;
} else {
$this->_data[$get] = Doctrine_Resource_Client::getInstance()->newRecord($get, false);
} }
return $this->data[$get]; return $this->_data[$get];
} }
public function set($set, $value) public function set($set, $value)
{ {
$this->data[$set] = $value; $this->_data[$set] = $value;
} }
public function count() public function count()
{ {
return count($this->data); return count($this->_data);
} }
public function getIterator() public function getIterator()
{ {
$data = $this->data; return new ArrayIterator($this->_data);
return new ArrayIterator($data);
}
public function newRequest($type)
{
$request = array();
$request['format'] = isset($this->config['format']) ? $this->config['format']:'xml';
$request['type'] = $type;
$request['model'] = $this->model;
return $request;
} }
public function save() public function save()
{ {
$request = $this->newRequest('save'); $format = $this->getConfig('format') ? $this->getConfig('format'):'xml';
$request['data'] = $this->toArray();
$request = new Doctrine_Resource_Request();
$request->set('format', $format);
$request->set('type', 'save');
$request->set('model', $this->getModel());
$request->set('data', $this->toArray());
$response = Doctrine_Resource::request($this->config['url'], $request); $response = $request->execute();
$array = Doctrine_Parser::load($response, $request['format']); $array = Doctrine_Parser::load($response, $format);
$resource = new Doctrine_Resource(); $this->_data = $request->hydrate(array($array), $this->_model)->getFirst()->_data;
$this->data = $resource->hydrate(array($array), $this->model, $this->config)->getFirst()->data; }
public function getModel()
{
return $this->_model;
} }
public function toArray() public function toArray()
{ {
$array = array(); $array = array();
foreach ($this->data as $key => $value) { foreach ($this->_data as $key => $value) {
if ($value instanceof Doctrine_Resource_Collection OR $value instanceof Doctrine_Resource_Record) { if ($value instanceof Doctrine_Resource_Collection OR $value instanceof Doctrine_Resource_Record) {
$array[$key] = $value->toArray(); $array[$key] = $value->toArray();
} else { } else {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Doctrine_Resource_Server * Doctrine_Resource_Server
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @package Doctrine * @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$ * @version $Revision$
...@@ -30,20 +31,23 @@ ...@@ -30,20 +31,23 @@
* @link www.phpdoctrine.com * @link www.phpdoctrine.com
* @since 1.0 * @since 1.0
*/ */
class Doctrine_Resource_Server extends Doctrine_Resource class Doctrine_Resource_Server extends Doctrine_resource
{ {
public $config = array(); static public function getInstance($config = null)
public $format = 'xml';
public function __construct($config)
{ {
$this->config = array_merge($config, $this->config); static $instance;
if (!$instance) {
$instance = new Doctrine_Resource_Server($config);
}
return $instance;
} }
public function executeSave($request) public function executeSave($request)
{ {
$model = $request['model']; $model = $request->get('model');
$data = $request['data']; $data = $request->get('data');
$record = new $model(); $record = new $model();
$record->fromArray($data); $record->fromArray($data);
...@@ -54,31 +58,57 @@ class Doctrine_Resource_Server extends Doctrine_Resource ...@@ -54,31 +58,57 @@ class Doctrine_Resource_Server extends Doctrine_Resource
public function executeQuery($request) public function executeQuery($request)
{ {
$dql = $request['dql']; $dql = $request->get('dql');
$params = isset($request['params']) ? $request['params']:array(); $params = $request->get('params') ? $request->get('params'):array();
$conn = Doctrine_Manager::connection(); $conn = Doctrine_Manager::connection();
return $conn->query($dql, $params)->toArray(true, true); return $conn->query($dql, $params)->toArray(true, true);
} }
public function executeLoad($request)
{
$path = '/tmp/' . rand() . '.' . $request->get('format');
$models = $this->getConfig('models') ? $this->getConfig('models'):array();
$export = new Doctrine_Export_Schema();
$export->exportSchema($path, $request->get('format'), null, $models);
$schema = Doctrine_Parser::load($path, $request->get('format'));
unlink($path);
return $schema;
}
public function execute($request) public function execute($request)
{ {
if (!isset($request['type'])) { if (!isset($request['type'])) {
throw new Doctrine_Resource_Exception('You must specify a request type: query or save'); throw new Doctrine_Resource_Exception('You must specify a request type');
} }
$format = isset($request['format']) ? $request['format']:'xml'; $format = isset($request['format']) ? $request['format']:'xml';
$type = $request['type']; $type = $request['type'];
$funcName = 'execute' . Doctrine::classify($type); $funcName = 'execute' . Doctrine::classify($type);
$result = $this->$funcName($request); $request = new Doctrine_Resource_Request($request);
return Doctrine_Parser::dump($result, $format); if (method_exists($this, $funcName)) {
$result = $this->$funcName($request);
} else {
throw new Doctrine_Resource_Exception('Unknown Doctrine Resource Server function');
}
if ($result) {
return Doctrine_Parser::dump($result, $format);
} else {
return false;
}
} }
public function run($request) public function run($request)
{ {
echo $this->execute($request); echo $this->execute($request);
} }
} }
\ No newline at end of file
...@@ -7,18 +7,20 @@ require_once('data.php'); ...@@ -7,18 +7,20 @@ require_once('data.php');
$action = isset($_REQUEST['action']) ? $_REQUEST['action']:'client'; $action = isset($_REQUEST['action']) ? $_REQUEST['action']:'client';
if ($action == 'server') { if ($action == 'server') {
$config = array(); $config = array('name' => 'Doctrine_Resource_Test_Server',
'models' => $tables);
$server = new Doctrine_Resource_Server($config); $server = Doctrine_Resource_Server::getInstance($config);
$server->run($_REQUEST); $server->run($_REQUEST);
} else { } else {
$config = array('url' => 'http://localhost/~jwage/doctrine_trunk/playground/index.php?action=server'); $config = array('url' => 'http://localhost/~jwage/doctrine_trunk/playground/index.php?action=server');
$client = new Doctrine_Resource_Client($config); $client = Doctrine_Resource_Client::getInstance($config);
$record = $client->newRecord('User');
$record->name = 'jon wage'; $user = $client->newRecord('User');
$record->loginname = 'test'; $user->name = 'jonathan h. wage';
$record->save(); $user->save();
print_r($record->toArray()); print_r($user->toArray());
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment