Skip to content

Instantly share code, notes, and snippets.

@brianV
brianV / error.json
Created August 21, 2020 20:43
API Platform: PATH / PUT error when using a OneToOne related to a mapped superclass.
{
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Entity App\\Entity\\Submission@000000002116ebc30000000012ca4827 is not managed. An entity is managed if its fetched from the database or registered as new through EntityManager#persist",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
@brianV
brianV / gist:be00761436f219efb8f057e42838e13f
Created December 29, 2016 15:47
Elastic import where GET API is not always returning the most recent revision
Note how in the document below, successive calls to getDocument() (which uses the GET API) return the same
version of the document despite new versions being indexed with addDocument().
[2016-12-29 10:43:46] app.INFO: Elastica version check: getDocument() called. Version 52 of 1:69 returned [] []
[2016-12-29 10:43:47] app.INFO: Elastica version check: Called addDocument() for 1:69 [] []
[2016-12-29 10:43:47] app.INFO: Elastica version check: getDocument() called. Version 52 of 1:69 returned [] []
[2016-12-29 10:43:47] app.INFO: Elastica version check: Called addDocument() for 1:69 [] []
[2016-12-29 10:43:47] app.INFO: Elastica version check: getDocument() called. Version 52 of 1:69 returned [] []
[2016-12-29 10:43:47] app.INFO: Elastica version check: Called addDocument() for 1:69 [] []
[2016-12-29 10:43:48] app.INFO: Elastica version check: getDocument() called. Version 55 of 1:69 returned [] []
@brianV
brianV / 2-even_fibonacci.php
Created October 2, 2015 17:22
Sum of even Fibonacci numbers less than 4000000
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$last = array(1, 2); //First two numbers in Fibonacci sequence.
$sum = 2; // Since we won't calculate out the two (it's in the 'seed' above), we start our sum with it.
$highest = 4000000; // stop here.
SELECT col1 FROM tbl_name WHERE col2=val2 AND col3=val3;
SELECT col1 FROM tbl_name WHERE col2=val2 AND col4=val4;