Skip to content

Instantly share code, notes, and snippets.

View terox's full-sized avatar
🎯
Focusing

David Pérez Terol terox

🎯
Focusing
View GitHub Profile
<?php
/**
* We want "clone/duplicate" -EntityM- keeping fk1 objec and cloning fk2. We are setting fk2 id
* to null ($fk2->setId(null)) to force EntityManger to persist new entity. But didn't work.
* Also doing $fk2 = new EntityB(). We are trying to do it in __clone method following the
* recomendations in Doctrine documentation, and the EntityManager throws something like that:
*
* "Doctrine\ORM\ORMException : Entity of type EntityM has identity through a foreign entity EntityB,
* however this entity has no identity itself.You have to call EntityManager#persist() on the related
@terox
terox / keybase.md
Last active August 29, 2015 14:22
keybase.md

Keybase proof

I hereby claim:

  • I am terox on github.
  • I am terox (https://keybase.io/terox) on keybase.
  • I have a public key whose fingerprint is 5FEF C9A7 B330 C446 3B1E EC15 54D4 46B2 D632 E2ED

To claim this, I am signing this object:

function letterFromNumber = function( number ) {
var letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.charAt(number % 26)
var concat = Math.round(number / 26);
return concat > 0 ? letterFromNumber(concat-1) + letter : letter;
};