simettric / sense Goto Github PK
View Code? Open in Web Editor NEWA MVC Framework designed to build complex websites and web applications based on WordPress.
A MVC Framework designed to build complex websites and web applications based on WordPress.
Hacer que Sense pueda ser instalado como un plugin. De esta forma se pueden desarrollar themes y plugins que puedan convivir sin conflictos de declaraciones duplicadas.
As shown in the documentation when trying to customize regular expression for action routes can not set the requirements
parameter in the annotation because its checked if it exist.
In the Annotations\Route
class, should we use regexp
parameter instead of requirements
?
But later in that class is using, I belive, a undefined variable called requirements
, setting the default regular expression for matching route parameters, and avoiding any pattern customization.
Los interceptores actuarían como los controladores pero en lugar de otorgar control total sobre la vista y respuesta, actuarían a modo de filtro antes de servir la plantilla html determinada en el Template Hierarchy.
Los interceptadores se suscribirían a la acción pre_get_posts.
Ejemplo de configuración:
is_front_page:
- [Interceptors:Producto:metodo, ["@wp_query", "@theme_model"] ]
Ejemplo de interceptor:
namespace Interceptors;
class ProductoInterceptor extends AbstractInterceptor{
function metodoAction(\WP_Query $wp_query, AbstractTheme $theme){
$sense = $this->getContainer();
//asignamos un modelo en la variable productos que desde el template front-page.php será accesible mediante: _sense("productos"), pudiendo realizar operaciones en esa vista como por ejemplo: _sense("productos")->getAll() o _sense("productos")->find(get_the_ID())
$theme->assign("productos", $sense["model.products"]);
}
}
Hi Asier,
Trying to learn to use Sense, I have some doubts that I don't know if are caused by me not know how to do something, or lacking some info on the documentation (recently sent a pull request extending it), or maybe a bug.
So I'm creating a test controller, but instead of using:
class TestController extends AbstractController {
/**
* @Route("/demo/{name}", method="GET", name="test_route")
*/
public function demoAction(Request $request, WP_Query $query) {
As I’m working on a namespace like in the examples, I have to use fully qualified classes for parameter types
<?php
namespace Simettric\Plugin\Controller;
use Simettric\Sense\Annotations\Route; //Needed for the @Route comment anotation
use Simettric\Sense\Controller\AbstractController;
class TestController extends AbstractController {
/**
* @Route("/demo/{name}", method="GET", name="test_route")
*/
public function demoAction(\Symfony\Component\HttpFoundation\Request $request, \WP_Query $query) {
Then, trying to get the $name as a parameter of the method, it doesn't work... it always gives me an error saying that only 2 parameters are expected, and first is expected to be of Request class:
class TestController extends AbstractController {
/**
* @Route("/demo/{name}", method="GET", name="test_route")
*/
public function demoAction($name, \Symfony\Component\HttpFoundation\Request $request, \WP_Query $query) {
//doesn't work as intended
So instead of that, this is what works for me:
/**
* @Route("/demo/{name}", method="GET", name="test_route")
*/
public function demoAction(\Symfony\Component\HttpFoundation\Request $request, \WP_Query $query) {
$name = $request->get('name');
Then, trying to use the requirements clause in the Route, I've already figured out that instead of how it's told in documentation, you have to use like in the following example... but then, request->get('name') doesn't work any more.
class TestController extends AbstractController {
/**
* @Route("/demo/{name}", requirements={"name":"\w+"}, method="GET", name="test_route")
*/
public function demoAction(\Symfony\Component\HttpFoundation\Request $request, \WP_Query $query) {
$name = $request->get('name');
//Now $name is empty
If you tell me a working example of use of requirements and passing an URL parameter, I’ll update the documentation.
The first issue can be a typo. ;)
When an action from a controller does not return an ActionResult
, Route
raises an exception with the action name, but the method getActionName
does not exists, should it be getActionMethod?
Project is still alive?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.