Skip to content

Instantly share code, notes, and snippets.

class Plugin extends \Phile\Plugin\AbstractPlugin
{
protected $events = ['request_uri' => 'startup'];
public function startup($data)
{
if ($data['uri'] === 'foo') {
// matches URL
$this->doStuffOnFoo();
exit();
@Schlaefer
Schlaefer / php.php
Created July 16, 2015 19:54
cakephp 3 marshaller timezone ignore workaround
<?php
$entity = $table->newEntity(
[
'evaluationDate' => (new Time('2015-07-01T00:00:00+0200'))->timezone('UTC')
]
);
$table->save($entity);
// mysql queries
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01T00:00:00+0000');
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01 00:00:00');
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01T00:00:00+0400');
INSERT INTO `tests` (`stamp`) VALUES ('2015-07-01 00:00:00');
<?php
date_default_timezone_set('UTC');
var_dump(date_default_timezone_get());
$dt = new \DateTime('2015-07-01T00:00:00+0200');
var_dump($dt->format('c'));
$dt->setTimezone(new \DateTimeZone('UTC'));
var_dump($dt->format('c'));
<?php
class A {
protected $_properties = [
'a' => 1,
'b' => 2
];
public function &get($property)
{
<?php
class Dic {
/**
* @var \Aura\Di\Container;
*/
static protected $_DIC;
public static function initialize() {
  • plugins
    • simplify event subscription via new $events property #199
    • new getPluginPath() method #206
    • pass plugins in the plugins_loaded event #206
  • URL resolution
    • new scheme adding meaning to a trailing slash in URL #192
    • urldecode URLs #175
    • fix broken /index.php URL
  • improve symbolic-linking of and in the content/ directory #197
  • add method to clean the complete cache #213
@Schlaefer
Schlaefer / php
Last active August 29, 2015 14:18
<?php
namespace Saito\Test;
use Cake\Error\ExceptionRenderer as CakeExceptionRenderer;
class ExceptionRenderer extends CakeExceptionRenderer {
public function __construct(\Exception $exception)
{
Notice (8): Undefined index: Categories [CORE/src/ORM/ResultSet.php, line 546]
Code Context
Cake\ORM\ResultSet::_groupResult() - CORE/src/ORM/ResultSet.php, line 546
Cake\ORM\ResultSet::_fetchResult() - CORE/src/ORM/ResultSet.php, line 478
Cake\ORM\ResultSet::valid() - CORE/src/ORM/ResultSet.php, line 269
Cake\ORM\ResultSet::first() - CORE/src/ORM/ResultSet.php, line 291
Cake\ORM\Query::first() - CORE/src/Datasource/QueryTrait.php, line 340
Sitemap\Lib\SitemapEntries::files() - ROOT/plugins/Sitemap/src/Lib/SitemapEntries.php, line 19
Sitemap\Lib\SitemapCollection::files() - ROOT/plugins/Sitemap/src/Lib/SitemapCollection.php, line 37
Sitemap\Controller\SitemapsController::index() - ROOT/plugins/Sitemap/src/Controller/SitemapsController.php, line 31
<?php
namespace Phile\Plugin\Phile\DemoPlugin;
use Phile\Core\Registry;
use Phile\Repository\Page;
class Plugin extends \Phile\Plugin\AbstractPlugin implements \Phile\Gateway\EventObserverInterface
{
public function __construct()