Symfony 2软件包具有很好的自动加载/扩展应用程序配置文件的功能,例如services.yml.但是,路由不是这样,因为我必须手动编辑应用程序的routing.yml,以便从我的Bundle(Controller或routing.yml本身)加载路由数据.
是否可以无缝地加载这种路由配置?
----编辑
我最终做到了这一点,但它很丑陋地狱:
<?php
use Symfony\Component\Routing\RouteCollection;
$collection = new RouteCollection();
foreach (glob(__DIR__.'/../../src/Vendor/MySystem/Plugins/*Bundle/Controller/', GLOB_ONLYDIR) as $controller) {
$controller = str_replace(__DIR__.'/../../src/Vendor/MySystem/Plugins/', '', $controller);
$collection->addCollection($loader->import("@$controller"));
}
return $collection;
Run Code Online (Sandbox Code Playgroud) 我在使用CMake编译C++ 11/SDL 2.0代码时遇到了一些麻烦.CMakeLists非常简单:
cmake_minimum_required(VERSION 2.6)
project(Test)
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
include_directories(${SDL2_INCLUDE_DIRS})
target_link_libraries(sdl2test ${SDL2_LIBRARIES})
add_definitions(-std=c++0x)
add_executable(Test src/main.cpp)
Run Code Online (Sandbox Code Playgroud)
但是,在编译时,我收到此错误:
Scanning dependencies of target Test
[100%] Building CXX object CMakeFiles/Test.dir/src/main.cpp.o
/var/dev/cmake/src/main.cpp: In function ‘int main(int, char**)’:
/var/dev/cmake/src/main.cpp:11:16: error: ‘nullptr’ was not declared in this scope
/var/dev/cmake/src/main.cpp:17:16: error: ‘nullptr’ was not declared in this scope
make[2]: *** [CMakeFiles/Test.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Test.dir/all] Error 2
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)
cmake版本2.8.9和gcc 4.7.2.有关如何正确使用CMake的C++ 11功能的任何想法?
ps:我也试过-std = c ++ 11
我一直在使用PHPUnit一段时间,但突然碰上了一堵墙:嘲笑LDAP.我有一个小的抽象层,用于使用默认的LDAP PHP扩展与LDAP服务器通信.现在,我不知道如何模拟扩展的连接和功能,以便正确测试我的类.
文件系统和数据库模拟非常常见且易于设置,但目录服务器呢?:(