Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6212185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:28:11+00:00 2026-05-24T06:28:11+00:00

We’re using ZendFramework at my workplace for our webapps. It’s ok, but it lacks

  • 0

We’re using ZendFramework at my workplace for our webapps. It’s ok, but it lacks some of the best modern practices (like dependency injection and inversion of control, aop, etc).

For a couple of months, I’ve been (on my own) using Ding framework as a container for DI and AOP as a test drive. I really like it, so I’d like to bring it into our projects.

But how? So there’s the question: how to properly integrate Ding in Zend Framework applications? considering ZF controllers cant be beans (as they are instantiated right from the dispatcher), how to propertly inject all dependencies in them?

P.s: Not using Zend Framework is not an option (at least in the middle term).
P.P.S: Anyone care to add “ding” as a new tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:28:12+00:00Added an answer on May 24, 2026 at 6:28 am

    I’m glad Ding is helping you.
    I contributed on this project and also needed to integrate with a Zend Framework application. I used Zend’s application resources and plugin system to achieve this.

    An application resource (you can reuse among projects)

    <?php
    class Application_Resource_Ding extends Zend_Application_Resource_ResourceAbstract
    {
    
        protected $_options = array(
            'factory' => array(
                'bdef' => array(
                    'xml' => array(
                        'filename' => array('beans.xml')
                    ),
                ),
            ),
            'cache' => array(
                'proxy' => array('impl' => 'dummy'),
                'bdef' => array('impl' => 'dummy'),
                'beans' => array('impl' => 'dummy')
            )
        );
    
        public function init()
        {
            // set default config dir before mergin options (cant be set statically)
            $this->_options['factory']['bdef']['xml']['directories'] = array(APPLICATION_PATH .'/configs');
    
            $options = $this->getOptions();
    
            // parse factory properties (if set)
            if (isset($options['factory']['properties'])) {
                $options['factory']['properties'] = parse_ini_file(
                   $options['factory']['properties']
               );
            }
    
            // change log4php_properties for log4php.properties (if exists)
            if (isset($options['log4php_properties'])) {
                $options['log4php.properties'] = $options['log4php_properties'];
                unset($options['log4php_properties']);
            }
            $properties = array(
                'ding' => $options
            );
    
            return Ding\Container\Impl\ContainerImpl::getInstance($properties);
        }
    
    }
    

    An action helper to use inside the controllers:

    <?php
    
    class Application_Action_Helper_Ding extends Zend_Controller_Action_Helper_Abstract
    {
    
        protected $ding = null;
    
        public function init()
        {
            // just once...
            if (null !== $this->ding) {
                return;
            }
    
            // get ding bootstrapped resource
            $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
    
            $ding = $bootstrap->getResource('ding');
    
            if (!$ding) {
                throw new Zend_Controller_Action_Exception(
                    'Ding resource not bootstrapped'
                );
            }
    
            $this->ding = $ding;
        }
    
        public function getBean($bean)
        {
            return $this->ding->getBean($bean);
        }
    
        public function direct($bean)
        {
            return $this->getBean($bean);
        }
    
    }
    

    In your application.ini you should add something like this (plus any extra configuration you need)

    resources.frontController.actionHelperPaths.Application_Action_Helper = "Application/Action/Helper"
    
    resources.ding.factory.properties = APPLICATION_PATH "/configs/ding.properties"
    resources.ding.log4php_properties = APPLICATION_PATH "/configs/log4php.properties"
    

    And then in your controllers, to request a bean:

    $service = $this->_helper->ding('someService');
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.