public function newEntity($data = null, array $options = [])
    {
        if ($data === null) {
            $class = $this->getResourceClass();
            $entity = new $class([], ['source' => $this->getRegistryAlias()]);

            return $entity;
        }
        $marshaller = $this->marshaller();

        return $marshaller->one($data, $options);
    }
public function newEntity($data = null, array $options = [])
    {
        if ($data === null) {
            $class = $this->getResourceClass();
            $entity = new $class([], ['source' => $this->getRegistryAlias()]);

            return $entity;
        }
        $marshaller = $this->marshaller();

        return $marshaller->one($data, $options);
    }
public function newEntity ( $ data = null , array $ options = [ ] ) { if ( $ data === null ) { $ class = $ this -> getResourceClass ( ) ; $ entity = new $ class ( [ ] , [ 'source' => $ this -> getRegistryAlias ( ) ] ) ; return $ entity ; } $ marshaller = $ this -> marshaller ( ) ; return $ marshaller -> one ( $ data , $ options ) ; }
Create a new entity + associated entities from an array.

This is most useful when hydrating web service data back into entities.

The hydrated entity will correctly do an insert/update based
on the primary key data existing in the database when the entity
is saved. Until the entity is saved, it will be a detached record.

@param array|null $data The data to build an entity with.
@param array $options A list of options for the object hydration.
@return \Muffin\Webservice\Model\Resource
Create a new entity + associated entities from an array .