public function insertTechnicalDatas(MediaVorus $mediavorus)
    {
        try {
            $document = $this->get_subdef('document');
        } catch (\Exception_Media_SubdefNotFound $e) {
            return $this;
        }

        $connection = $this->getDataboxConnection();
        $connection->executeUpdate('DELETE FROM technical_datas WHERE record_id = :record_id', [
            ':record_id' => $this->getRecordId(),
        ]);

        $sqlValues = [];

        foreach ($document->readTechnicalDatas($mediavorus) as $name => $value) {
            if (is_null($value)) {
                continue;
            } elseif (is_bool($value)) {
                if ($value) {
                    $value = 1;
                } else {
                    $value = 0;
                }
            }
            $sqlValues[] = [$this->getRecordId(), $name, $value];
        }

        if ($sqlValues) {
            $connection->transactional(function (Connection $connection) use ($sqlValues) {
                $statement = $connection->prepare('INSERT INTO technical_datas (record_id, name, value) VALUES (?, ?, ?)');
                array_walk($sqlValues, [$statement, 'execute']);
            });
        }

        $this->delete_data_from_cache(self::CACHE_TECHNICAL_DATA);

        return $this;
    }
public function insertTechnicalDatas(MediaVorus $mediavorus)
    {
        try {
            $document = $this->get_subdef('document');
        } catch (\Exception_Media_SubdefNotFound $e) {
            return $this;
        }

        $connection = $this->getDataboxConnection();
        $connection->executeUpdate('DELETE FROM technical_datas WHERE record_id = :record_id', [
            ':record_id' => $this->getRecordId(),
        ]);

        $sqlValues = [];

        foreach ($document->readTechnicalDatas($mediavorus) as $name => $value) {
            if (is_null($value)) {
                continue;
            } elseif (is_bool($value)) {
                if ($value) {
                    $value = 1;
                } else {
                    $value = 0;
                }
            }
            $sqlValues[] = [$this->getRecordId(), $name, $value];
        }

        if ($sqlValues) {
            $connection->transactional(function (Connection $connection) use ($sqlValues) {
                $statement = $connection->prepare('INSERT INTO technical_datas (record_id, name, value) VALUES (?, ?, ?)');
                array_walk($sqlValues, [$statement, 'execute']);
            });
        }

        $this->delete_data_from_cache(self::CACHE_TECHNICAL_DATA);

        return $this;
    }
public function insertTechnicalDatas ( MediaVorus $ mediavorus ) { try { $ document = $ this -> get_subdef ( 'document' ) ; } catch ( \ Exception_Media_SubdefNotFound $ e ) { return $ this ; } $ connection = $ this -> getDataboxConnection ( ) ; $ connection -> executeUpdate ( 'DELETE FROM technical_datas WHERE record_id = :record_id' , [ ':record_id' => $ this -> getRecordId ( ) , ] ) ; $ sqlValues = [ ] ; foreach ( $ document -> readTechnicalDatas ( $ mediavorus ) as $ name => $ value ) { if ( is_null ( $ value ) ) { continue ; } elseif ( is_bool ( $ value ) ) { if ( $ value ) { $ value = 1 ; } else { $ value = 0 ; } } $ sqlValues [ ] = [ $ this -> getRecordId ( ) , $ name , $ value ] ; } if ( $ sqlValues ) { $ connection -> transactional ( function ( Connection $ connection ) use ( $ sqlValues ) { $ statement = $ connection -> prepare ( 'INSERT INTO technical_datas (record_id, name, value) VALUES (?, ?, ?)' ) ; array_walk ( $ sqlValues , [ $ statement , 'execute' ] ) ; } ) ; } $ this -> delete_data_from_cache ( self :: CACHE_TECHNICAL_DATA ) ; return $ this ; }
Read technical datas an insert them
This method can be long to perform

@return record_adapter
Read technical datas an insert them This method can be long to perform