src/Model/Service/SqlService.php
public function create(array $data)
    {
        if (is_null($this->schema)) {
            throw SystemException::forNoSchema();
        }

        $table = $this->schema->getName();
        $created = $this->schema->getCreatedFieldName();
        $updated = $this->schema->getUpdatedFieldName();
        $ipaddress = $this->schema->getIPAddressFieldName();

        if ($created) {
            $data[$created] = date('Y-m-d H:i:s');
        }

        if ($updated) {
            $data[$updated] = date('Y-m-d H:i:s');
        }

        if ($ipaddress && isset($_SERVER['REMOTE_ADDR'])) {
            $data[$ipaddress] = $_SERVER['REMOTE_ADDR'];
        }

        $uuids = $this->schema->getUuidFieldNames();

        foreach($uuids as $uuid) {
            $data[$uuid] = sha1(uniqid());
        }

        return $this
            ->resource
            ->model($data)
            ->save($table)
            ->get();
    }
public function create(array $data)
    {
        if (is_null($this->schema)) {
            throw SystemException::forNoSchema();
        }

        $table = $this->schema->getName();
        $created = $this->schema->getCreatedFieldName();
        $updated = $this->schema->getUpdatedFieldName();
        $ipaddress = $this->schema->getIPAddressFieldName();

        if ($created) {
            $data[$created] = date('Y-m-d H:i:s');
        }

        if ($updated) {
            $data[$updated] = date('Y-m-d H:i:s');
        }

        if ($ipaddress && isset($_SERVER['REMOTE_ADDR'])) {
            $data[$ipaddress] = $_SERVER['REMOTE_ADDR'];
        }

        $uuids = $this->schema->getUuidFieldNames();

        foreach($uuids as $uuid) {
            $data[$uuid] = sha1(uniqid());
        }

        return $this
            ->resource
            ->model($data)
            ->save($table)
            ->get();
    }
public function create ( array $ data ) { if ( is_null ( $ this -> schema ) ) { throw SystemException :: forNoSchema ( ) ; } $ table = $ this -> schema -> getName ( ) ; $ created = $ this -> schema -> getCreatedFieldName ( ) ; $ updated = $ this -> schema -> getUpdatedFieldName ( ) ; $ ipaddress = $ this -> schema -> getIPAddressFieldName ( ) ; if ( $ created ) { $ data [ $ created ] = date ( 'Y-m-d H:i:s' ) ; } if ( $ updated ) { $ data [ $ updated ] = date ( 'Y-m-d H:i:s' ) ; } if ( $ ipaddress && isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { $ data [ $ ipaddress ] = $ _SERVER [ 'REMOTE_ADDR' ] ; } $ uuids = $ this -> schema -> getUuidFieldNames ( ) ; foreach ( $ uuids as $ uuid ) { $ data [ $ uuid ] = sha1 ( uniqid ( ) ) ; } return $ this -> resource -> model ( $ data ) -> save ( $ table ) -> get ( ) ; }
Create in database

@param *array $object
@param *array $data

@return array
Create in database