Skip to content
Permalink
Browse files

fixes changes requested via comments

  • Loading branch information...
thinkingmedia
thinkingmedia committed Nov 3, 2016
1 parent cd745a5 commit bfc93253e23a605f8e6ab6c521c2036bc1f290dc
Showing with 13 additions and 12 deletions.
  1. +13 −12 src/ORM/Marshaller.php
@@ -138,7 +138,7 @@ protected function _buildPropertyMap($data, $options)
* - validate: Set to false to disable validation. Can also be a string of the validator ruleset to be applied.
* Defaults to true/default.
* - associated: Associations listed here will be marshalled as well. Defaults to null.
* - fieldList: (deprecated) use fields instead.
* - fieldList: (deprecated) Since 3.4.0. Use fields instead.
* - fields: A whitelist of fields to be assigned to the entity. If not present,
* the accessible fields list in the entity will be used. Defaults to null.
* - accessibleFields: A list of fields to allow or deny in entity accessible fields. Defaults to null
@@ -160,6 +160,7 @@ protected function _buildPropertyMap($data, $options)
* @param array $options List of options
* @return \Cake\ORM\Entity
* @see \Cake\ORM\Table::newEntity()
* @see \Cake\ORM\Entity::$_accessible
*/
public function one(array $data, array $options = [])
{
@@ -199,10 +200,6 @@ public function one(array $data, array $options = [])
}
}
if (isset($options['fieldList'])) {
$options['fields'] = $options['fieldList'];
}
if (isset($options['fields'])) {
foreach ((array)$options['fields'] as $field) {
if (array_key_exists($field, $properties)) {
@@ -258,6 +255,11 @@ protected function _prepareDataAndOptions($data, $options)
{
$options += ['validate' => true];
if (!isset($options['fields']) && isset($options['fieldList'])) {
$options['fields'] = $options['fieldList'];
unset($options['fieldList']);
}
$tableName = $this->_table->alias();
if (isset($data[$tableName])) {
$data += $data[$tableName];
@@ -316,7 +318,7 @@ protected function _marshalAssociation($assoc, $value, $options)
* - validate: Set to false to disable validation. Can also be a string of the validator ruleset to be applied.
* Defaults to true/default.
* - associated: Associations listed here will be marshalled as well. Defaults to null.
* - fieldList: (deprecated) use fields instead
* - fieldList: (deprecated) Since 3.4.0. Use fields instead
* - fields: A whitelist of fields to be assigned to the entity. If not present,
* the accessible fields list in the entity will be used. Defaults to null.
* - accessibleFields: A list of fields to allow or deny in entity accessible fields. Defaults to null
@@ -328,6 +330,7 @@ protected function _marshalAssociation($assoc, $value, $options)
* @param array $options List of options
* @return array An array of hydrated records.
* @see \Cake\ORM\Table::newEntities()
* @see \Cake\ORM\Entity::$_accessible
*/
public function many(array $data, array $options = [])
{
@@ -496,7 +499,7 @@ protected function _loadBelongsToMany($assoc, $ids)
* - associated: Associations listed here will be marshalled as well.
* - validate: Whether or not to validate data before hydrating the entities. Can
* also be set to a string to use a specific validator. Defaults to true/default.
* - fieldList: (deprecated) use fields instead
* - fieldList: (deprecated) Since 3.4.0. Use fields instead
* - fields: A whitelist of fields to be assigned to the entity. If not present
* the accessible fields list in the entity will be used.
* - accessibleFields: A list of fields to allow or deny in entity accessible fields.
@@ -516,6 +519,7 @@ protected function _loadBelongsToMany($assoc, $ids)
* @param array $data key value list of fields to be merged into the entity
* @param array $options List of options.
* @return \Cake\Datasource\EntityInterface
* @see \Cake\ORM\Entity::$_accessible
*/
public function merge(EntityInterface $entity, array $data, array $options = [])
{
@@ -565,10 +569,6 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
$properties[$key] = $value;
}
if (isset($options['fieldList'])) {
$options['fields'] = $options['fieldList'];
}
$entity->errors($errors);
if (!isset($options['fields'])) {
$entity->set($properties);
@@ -614,7 +614,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
* - validate: Whether or not to validate data before hydrating the entities. Can
* also be set to a string to use a specific validator. Defaults to true/default.
* - associated: Associations listed here will be marshalled as well.
* - fieldList: (deprecated) use fields instead
* - fieldList: (deprecated) Since 3.4.0. Use fields instead
* - fields: A whitelist of fields to be assigned to the entity. If not present,
* the accessible fields list in the entity will be used.
* - accessibleFields: A list of fields to allow or deny in entity accessible fields.
@@ -624,6 +624,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
* @param array $data list of arrays to be merged into the entities
* @param array $options List of options.
* @return array
* @see \Cake\ORM\Entity::$_accessible
*/
public function mergeMany($entities, array $data, array $options = [])
{

0 comments on commit bfc9325

Please sign in to comment.
You can’t perform that action at this time.