Skip to content

Instantly share code, notes, and snippets.

@luckily
luckily / views_database_connector.views.inc
Created February 12, 2017 13:57
views database connector bug fixed. look at this.
<?php
/**
* @file
* Responsible for hooking views to add each database and its tables.
*/
/**
* Implements hook_views_data().
*/
@luckily
luckily / SellRecordService.php
Last active March 10, 2016 04:18
Skilltree TDD Day1 HomeWork
<?php
namespace App;
/**
* 銷售記錄商業邏輯
* Class SellRecordService
* @package App
*/
class SellRecordService
@luckily
luckily / autoload.php
Created March 7, 2016 04:12
練習autoload
<?php
function autoload($className)
{
if(strpos($className, '\\') === false) {
$psr4Paths = [
'MyNamespace\\Alice\\',
'MyNamespace\\Joel\\',
];
@luckily
luckily / ActiveEagerLoader.php
Last active November 24, 2015 09:54
yii 1.1 CActiveRecord eager load behavior
<?php
class ActiveEagerLoader extends CActiveRecordBehavior
{
private $_relationKeys = array();
public function with($keys = array())
{
if(!is_array($keys))
throw new Exception('Only support array type values');
@luckily
luckily / Joel.php
Last active September 24, 2015 09:26
Yii create component
<?php
// protected/components/Joel.php
class Joel extends CApplicationComponent
{
public $speed = 'Fast';
protected $sex = 'Man';
private $_name;
public function setName($name)
{