src/Entities.php
public function createOne($moduleName, array $params)
    {
        if (!is_assoc_array($params)) {
            throw new WSException(
                "You have to specify at least one search parameter (prop => value) 
                in order to be able to create an entity"
            );
        }

        // Assign record to logged in user if not specified
        if (!isset($params[ 'assigned_user_id' ])) {
            $currentUser = $this->wsClient->getCurrentUser();
            $params[ 'assigned_user_id' ] = $currentUser[ 'id' ];
        }

        $requestData = [
            'elementType' => $moduleName,
            'element'     => json_encode($params)
        ];

        return $this->wsClient->invokeOperation('create', $requestData);
    }
public function createOne($moduleName, array $params)
    {
        if (!is_assoc_array($params)) {
            throw new WSException(
                "You have to specify at least one search parameter (prop => value) 
                in order to be able to create an entity"
            );
        }

        // Assign record to logged in user if not specified
        if (!isset($params[ 'assigned_user_id' ])) {
            $currentUser = $this->wsClient->getCurrentUser();
            $params[ 'assigned_user_id' ] = $currentUser[ 'id' ];
        }

        $requestData = [
            'elementType' => $moduleName,
            'element'     => json_encode($params)
        ];

        return $this->wsClient->invokeOperation('create', $requestData);
    }
public function createOne ( $ moduleName , array $ params ) { if ( ! is_assoc_array ( $ params ) ) { throw new WSException ( "You have to specify at least one search parameter (prop => value) 
                in order to be able to create an entity" ) ; } // Assign record to logged in user if not specified if ( ! isset ( $ params [ 'assigned_user_id' ] ) ) { $ currentUser = $ this -> wsClient -> getCurrentUser ( ) ; $ params [ 'assigned_user_id' ] = $ currentUser [ 'id' ] ; } $ requestData = [ 'elementType' => $ moduleName , 'element' => json_encode ( $ params ) ] ; return $ this -> wsClient -> invokeOperation ( 'create' , $ requestData ) ; }
Creates an entity for the giving module
@param  string  $moduleName   Name of the module / entity type for which the entry has to be created
@param  array  $params Entity data
@return array  Entity creation results
Creates an entity for the giving module