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 3618116
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:42:37+00:00 2026-05-18T22:42:37+00:00

I want to follow Zend file naming convention . I have Object.php file with

  • 0

I want to follow Zend file naming convention.

I have Object.php file with a class and a function in it.

MyZendProject->application->models->Test->Object.php

class Model_Test_Object {     
   public function test() {
    echo "Test"; 
   }
} 

Now I want to access above test function in following file but it is not finding it.

MyZendProject->application->modules->test->controllers->TestController.php

$testModel = new Model_Test_Object();
$testModel->test();

But when I name the class Application_Model_Test_Object in Object.php and call it in TestController like this then it works.

$testModel = new Application_Model_Test_Object();
$testModel->test();

Problem is that I don’t want to use Application in class name because it is too long and ugly. Is there any way that I name the class Model_Test_Object and access it anywhere in application without including any file. I have seen somewhere in Botstrap.php to solve this issue but I did not remember it and unable to find it again.

Any help will be appreciated.

Thanks

  • 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-18T22:42:38+00:00Added an answer on May 18, 2026 at 10:42 pm

    You have to write Your own autoloader
    in bootstrap:

      protected function _initAutoload()
      {
        $autoLoader = Zend_Loader_Autoloader::getInstance(); 
        $autoLoader->registerNamespace('My_'); 
        $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
            'basePath'  =>  APPLICATION_PATH,
            'namespace' =>  '',
            'resourceTypes' =>  array(
                'form'  =>  array(
                    'path'  =>  'forms/',
                    'namespace' =>  'Form_'
                ),
                'model' =>  array(
                    'path'  =>  'models/',
                    'namespace' =>  'Model_'
                )
            )
        ));
        return $autoLoader;
      }
    

    This will also register namespace My_ for Your own libraries

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

Sidebar

Related Questions

I want to new a StringArray as follow: class Test { public: QString* str[];
I believe I have found a weird bug as follow: I want to delete
I am pretty new to PHP classes and I want to follow the standard
Using the Zend Framework , I have a menu and want to put it
I'm planning some simple application and want to follow the single responsibility and encapsulation
i have a zend form with an element $recipe_name as follows.. i want to
We are trying to follow these guidelines. For this I want to set application
Zend framework. I want to autoload my models classes inside models folder, from within
I want to follow the Jenkins PHP template as much as possible, but I've
I am having a problem with method naming. I want to follow the method

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.