Skip to content

Commit

Permalink
Add API docs for accessibleFields option.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 10, 2014
1 parent c79f240 commit 2f12dbb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/ORM/Table.php
Expand Up @@ -1620,7 +1620,7 @@ public function entityValidator() {
* using the options parameter:
*
* {{{
* $articles = $this->Articles->newEntity(
* $article = $this->Articles->newEntity(
* $this->request->data(),
* ['associated' => ['Tags', 'Comments.Users']]
* );
Expand All @@ -1630,13 +1630,23 @@ public function entityValidator() {
* passing the `fieldList` option, which is also accepted for associations:
*
* {{{
* $articles = $this->Articles->newEntity($this->request->data(), [
* 'fieldList' => ['title', 'body'],
* 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
* ]
* $article = $this->Articles->newEntity($this->request->data(), [
* 'fieldList' => ['title', 'body'],
* 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
* ]
* );
* }}}
*
* The `fieldList` option lets remove or restrict input data from ending up in
* the entity. If you'd like to relax the entity's default accessible fields,
* you can use the `accessibleFields` option:
*
* {{{
* $article = $this->Articles->newEntity(
* $this->request->data(),
* ['accessibleFields' => ['protected_field' => true]]
* );
* }}}
*/
public function newEntity(array $data = [], array $options = []) {
if (!isset($options['associated'])) {
Expand Down

0 comments on commit 2f12dbb

Please sign in to comment.