Giter Club home page Giter Club logo

zf2-for-1's Issues

While rendering view in zf1 it throw fatal error.

Hi simple clone it and configure well. While running , it will through exception.
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "error"; resolver could not resolve to a file' in /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php:499 Stack trace: #0 /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/View/View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel)) #1 /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/View/View.php(233): Zend\View\View->render(Object(Zend\View\Model\ViewModel)) #2 /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/View/View.php(198): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel)) #3 /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(102): Zend\View\View->render(Object(Zend\View\Model\ViewModel)) #4 [internal function]: Zend\Mvc\View in /var/www/zf2-for-1-example/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php on line 499

How do i resolve this?.

Make ZF1 bootstrap lazy?

The basic features mention

  • Makes ZF1 application config and bootstrap object available to ServiceManager

What if my ZF2 modules don't need this? I thought about bootstrapping zf2 first and all remaining resources only in the case that it makes a fallback to ZF1. To do that i had to make some modifications.

index.php

$application->bootstrap('Zf2')->run();

\Zf2for1_Resource_Zf2 called a blank bootstrap() before the fallback, based on a triggered zf2 event.

    public function onBootstrap()
    {
        return;
    }

\Zf2for1\Application\Zf2Bootstrap so i put it into the other event (and also moved the part with the frontcontroller).

    public function run()
    {
        $application = $this->getResource('zf2');
        $config = $application->getServiceManager()->get('Config');

        if ($config['zf2_for_1']['silent_zf1_fallback'] === true) {
            $application->getEventManager()->attach('zf1', array($this, 'parentRun'));
        }

        return $application->run();
    }

    public function parentRun($event)
    {
        $this->bootstrap();
        $front = $this->getResource('frontcontroller');
        $front->setParam('bootstrap', $this);
        return Zend_Application_Bootstrap_Bootstrap::run();
    }

I guess now even if a ZF2 module would need ZF1 resources it could just chain the call bootstrap('X')->getResource('X') while ZF1 modules can work as they were.

Any good reasons against this?

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.