1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-24 20:06:09 +08:00
2020-01-30 16:51:10 +08:00

31 lines
720 B
PHP

<?php
namespace App\Providers;
use Phalcon\Annotations\Adapter\Files as FileAnnotations;
use Phalcon\Annotations\Adapter\Memory as MemoryAnnotations;
class Annotation extends Provider
{
protected $serviceName = 'annotations';
public function register()
{
$this->di->setShared($this->serviceName, function () {
$config = $this->getShared('config');
if ($config->env == ENV_DEV) {
$annotations = new MemoryAnnotations();
} else {
$annotations = new FileAnnotations([
'annotationsDir' => cache_path() . '/annotations/',
]);
}
return $annotations;
});
}
}