diff --git a/README.md b/README.md index a56a43ba60..e32a2a71ab 100644 --- a/README.md +++ b/README.md @@ -565,6 +565,7 @@ Define your first model class: ``` php namespace my; + class User extends \Atk4\Data\Model { public $table = 'user'; @@ -572,7 +573,7 @@ class User extends \Atk4\Data\Model { parent::init(); - $this->addFields(['email','name','password']); + $this->addFields(['email', 'name', 'password']); // use your table fields here } } @@ -599,7 +600,7 @@ Now you can explore. Try typing: > $m = new \my\User($db); > $m->loadBy('email', 'example@example.com') > $m->get() -> $m->export(['email','name']) +> $m->export(['email', 'name']) > $m->action('count') > $m->action('count')->getOne() ``` diff --git a/docs/design.rst b/docs/design.rst index baf0dba1e0..3c042a9b38 100644 --- a/docs/design.rst +++ b/docs/design.rst @@ -162,7 +162,7 @@ Code:: class Model_Client extends Model_User { public function sendPasswordReminder() { - mail($this->get('email'), 'Your password is: '.$this->get('password')); + mail($this->get('email'), 'Your password is: ' . $this->get('password')); } } diff --git a/docs/model.rst b/docs/model.rst index dcaada58c3..ec2aee85a7 100644 --- a/docs/model.rst +++ b/docs/model.rst @@ -320,18 +320,6 @@ This can also be useful for calculating relative times:: } -Strict Fields -^^^^^^^^^^^^^ - -.. php:property:: strict_fields - -By default model will only allow you to operate with values for the fields -that have been defined through addField(). If you attempt to get, set or -otherwise access the value of any other field that has not been properly -defined, you'll get an exception. Read more about :php:class:`Field` - -If you set `strict_fields` to false, then the check will not be performed. - Actions ------- Another common thing to define inside :php:meth:`Model::init()` would be @@ -357,7 +345,7 @@ a user invokable actions:: $this->save(['password' => .. ]); - return 'generated and sent password to '.$m->get('name'); + return 'generated and sent password to ' . $m->get('name'); } } diff --git a/docs/persistence/csv.rst b/docs/persistence/csv.rst index 449b290a5f..0f9949b331 100644 --- a/docs/persistence/csv.rst +++ b/docs/persistence/csv.rst @@ -51,7 +51,7 @@ which fields you would like to see in the CSV:: foreach (new Model_User($db) as $m) { $m->withPersistence($csv) - ->onlyFields(['id','name','password']) + ->onlyFields(['id', 'name', 'password']) ->save(); } diff --git a/src/Persistence.php b/src/Persistence.php index 97a1975b92..d66eb7cd28 100644 --- a/src/Persistence.php +++ b/src/Persistence.php @@ -156,22 +156,7 @@ public function load(Model $model, $id): array /** * Will convert one row of data from native PHP types into * persistence types. This will also take care of the "actual" - * field keys. Example:. - * - * In: - * [ - * 'name' => ' John Smith', - * 'age' => 30, - * 'password' => 'abc', - * 'is_married' => true, - * ] - * - * Out: - * [ - * 'first_name' => 'John Smith', - * 'age' => 30, - * 'is_married' => 1 - * ] + * field keys. * * @return array */