Giter Site home page Giter Site logo

sense's People

Contributors

alwar avatar asiermarques avatar drzippie avatar nilportugues avatar vicenteherrera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sense's Issues

Instalable como plugin

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.

Unknown property "requirements" on annotation

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.

Añadir interceptores

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"]);
      }

}

How to use routes

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.