Skip to content

Instantly share code, notes, and snippets.

/* {{{ proto string strstr(string haystack, string needle[, bool part])
Finds first occurrence of a string within another */
PHP_FUNCTION(strstr)
{
zval *needle;
char *haystack;
int haystack_len;
char *found = NULL;
char needle_char[2];
long found_offset;
/* {{{ proto int strpos(string haystack, string needle [, int offset])
Finds position of first occurrence of a string within another */
PHP_FUNCTION(strpos)
{
zval *needle;
char *haystack;
char *found = NULL;
char needle_char[2];
long offset = 0;
int haystack_len;
final public function findReadOnly($id, $fetchMode = self::FETCH_LAZY_MODE)
{
// initialize answer
$res = null;
// calculate key
$cacheKey = self::getCacheKey($this->getEntityName(), $id, $fetchMode);
// check cache
if (($cacheRes = $this->fetchFromCache($cacheKey)) !== false) {
ErrorException: Catchable Fatal Error: Object of class Proxies\__CG__\EB\Core\KernelBundle\Entity\Account\Account could not be converted to string in /home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 1336
/home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1336
/home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3007
/home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1855
/home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1710
/home/www/eb/platform/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:696
/home/www/eb/platform/src/EB/Core/KernelBundle/Doctrine/ORM/EntityRepository.php:158
/home/www/eb/platform/src/EB/Core/BusinessBundle/Campaign/EmailBuild.php:134
/home/www/eb/platform/src/EB/Core/BusinessBundle/Campaign/EmailBuild.php:114
<?php
namespace EB\Core\KernelBundle\Entity\Publisher;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
use EB\Core\KernelBundle\Entity\Account\Account;
use EB\Core\KernelBundle\Interfaces\EntityCachableInterface;
@eb-eoliveira
eb-eoliveira / Account.php
Created April 18, 2013 15:37
Doctrine2-Account
<?php
namespace EB\Core\KernelBundle\Entity\Account;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
use EB\Core\KernelBundle\Doctrine\DBAL\Types\EnumAccountTypeType;
/**
* Set sent at now.
*
* @return ItemSent
*/
public function setSentAtNow()
{
return $this->setSentAt(new \DateTime());
}
@eb-eoliveira
eb-eoliveira / gist:4992122
Created February 20, 2013 02:11
Fatcache second test
<?php
$m = new Memcached();
$m->addServer('localhost', 11211, 33);
$items = 500000;
$keysToGet = array();
for ($i = 1; $i <= $items; ++$i) {
$key = md5(rand());
@eb-eoliveira
eb-eoliveira / gist:4992114
Created February 20, 2013 02:10
Fatcache simple test
<?php
$m = new Memcached();
$m->addServer('localhost', 11211, 33);
$items = 100000;
$start = time();
for ($i = 1; $i <= $items; ++$i) {
$key = md5(rand());
$value = md5(rand()). md5(rand()) . md5(rand()) . md5(rand()) . md5(rand());