Cake\ORM\Table::newEntities PHP Method

newEntities() public method

By default all the associations on this table will be hydrated. You can limit which associations are built, or include deeper associations using the options parameter: $articles = $this->Articles->newEntities( $this->request->data(), ['associated' => ['Tags', 'Comments.Users']] ); You can limit fields that will be present in the constructed entities by passing the fieldList option, which is also accepted for associations: $articles = $this->Articles->newEntities($this->request->data(), [ 'fieldList' => ['title', 'body', 'tags', 'comments'], 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']] ] ); You can use the Model.beforeMarshal event to modify request data before it is converted into entities.
public newEntities ( array $data, array $options = [] )
$data array
$options array
    public function newEntities(array $data, array $options = [])
    {
        if (!isset($options['associated'])) {
            $options['associated'] = $this->_associations->keys();
        }
        $marshaller = $this->marshaller();
        return $marshaller->many($data, $options);
    }