benturkia / zendframeworkstorefront

Automatically exported from code.google.com/p/zendframeworkstorefront
0 stars 0 forks source link

Action .php plugin not called. #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I've attached a note concerning the problem

expected: site with catalog displayed
Produced: site minus catalog
version of the product: Book Chapter 5 4220_Code
operating system: Windows 7
see attachment

Original issue reported on code.google.com by ma...@michaelafox.org on 7 Jul 2011 at 8:31

Attachments:

GoogleCodeExporter commented 8 years ago
could you post the full contents of the .ini please. Looks like the autoloader 
is either not configured correctly or the include path is wrong.

Original comment by mute.p...@googlemail.com on 8 Jul 2011 at 7:08

GoogleCodeExporter commented 8 years ago
Here is the .ini file:

[bootstrap]
Autoloadernamespaces[] = "Zend_"
Autoloadernamespaces[] = "SF_"
phpSettings.display_errors = 0
phpSettings.error_reporting = 8191
phpSettings.date.timezone = "America/Los_Angeles"

bootstrap.path = APPLICATION_PATH "/modules/storefront/Bootstrap.php"

appnamespace="Storefront"

plugin.path = APPLICATION_PATH "/../library/SF/Model" 

resources.frontController.moduledirectory = APPLICATION_PATH "/modules/"
resources.frontController.defaultmodule = "storefront"
resources.frontController.params.prefixDefaultModule = true
resources.frontController.throwexceptions= false
storefront.resources.frontcontroller.plugins.action =  "SF_Plugin_Action"
storefront.resources.frontController.plugins.admin = "SF_Plugin_AdminContext"

resources.db.adapter = "PDO_MYSQL"
resources.db.isdefaulttableadapter = true
resources.db.params.dbname = "storefront"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.hostname = "localhost"
resources.db.params.charset = "UTF8"

resources.view = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "main"

resources.modules[] =

product.index = APPLICATION_PATH"/../data/index/product"

errorhandling.graceful = true

[production: bootstrap]

[staging : bootstrap]

[test : bootstrap]

[development : bootstrap]
phpsettings.display_errors = 1
resources.frontController.throwExceptions = true
errorhandling.graceful = false

Original comment by ma...@michaelafox.org on 8 Jul 2011 at 4:54

GoogleCodeExporter commented 8 years ago
You'r right the plugin SF_Plugin_Action has not been registered as the code 
below, which I put in main.phtm shows:

$front = Zend_Controller_Front::getInstance();
$loger->log($front->getPlugin("SF_Plugin_Action"), Zend_Log::INFO);
returns FALSE
I don't know why it is not registered.

Original comment by ma...@michaelafox.org on 8 Jul 2011 at 11:44

GoogleCodeExporter commented 8 years ago
Try changing:

storefront.resources.frontcontroller.plugins.action =  "SF_Plugin_Action"
storefront.resources.frontController.plugins.admin = "SF_Plugin_AdminContext"

to

resources.frontcontroller.plugins.action =  "SF_Plugin_Action"
resources.frontController.plugins.admin = "SF_Plugin_AdminContext"

Original comment by mute.p...@googlemail.com on 9 Jul 2011 at 4:56

GoogleCodeExporter commented 8 years ago
I started with
resources.frontcontroller.plugins.action =  "SF_Plugin_Action"
resources.frontController.plugins.admin = "SF_Plugin_AdminContext"
and that's how I go the message:
"include_once(SF\Plugin\Action.php) [function.include-once]: failed to open 
stream: No such file or directory in 
D:\ZendFramework\ZendFramework-1.11.4\library\Zend\Loader.php on line 146"
So I put in the prefix storefront. The message went away but the plugin is not 
registered.
I put in the line:
plugin.path = APPLICATION_PATH "/../library/SF/Model"  
but this made no difference.

Original comment by ma...@michaelafox.org on 9 Jul 2011 at 5:22

GoogleCodeExporter commented 8 years ago
resources.frontcontroller.plugins.action =  "SF_Plugin_Action"
resources.frontController.plugins.admin = "SF_Plugin_AdminContext"

This should be correct, you need to make sure your include path is correct, the 
autoloader is trying to open the plugin but it can't find it.

What have you got in application.php?

Original comment by mute.p...@googlemail.com on 9 Jul 2011 at 8:05

GoogleCodeExporter commented 8 years ago
Thanks for your help.
I'm using Application/public/index.php as under:
I notice that if I comment out the function _initPluginLoaderCache() in 
bootstrap.php
I no longer get the Zend_Controller_Router_Route Object  array object displayed 
at the top of the page, but no other difference. I have tried, without success, 
to explicitly add the plugin suing $front->registerPlugin(new 
SF_Plugin_Action()), but
SF_Plugin_Action is not known.

<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
//
//if (!defined('ZENDLIBRARY')) {
//    define('ZENDLIBRARY', APPLICATION_PATH.'/configs/zendpath.ini');
//  }
//  
// path to Zend

defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('ZENDPATH') ? null : define('ZENDPATH', 
'D:'.DS.'ZendFramework'.DS.'ZendFramework-1.11.4'.DS.'library');

// Ensure library/ is on include_path
$paths = array( 
    get_include_path(),
        '/../library',
        ZENDPATH,
        );

$set_include_path = set_include_path(implode(PATH_SEPARATOR,  $paths));
//require_once 'Zend/Loader/Autoloader.php';
require_once 'Zend/Application.php';
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/store.ini'
);

$application->bootstrap()
->run();
echo("finished back in index.php");

Original comment by ma...@michaelafox.org on 9 Jul 2011 at 11:33

GoogleCodeExporter commented 8 years ago
Something very basic concerning the AutoLoader is either wrong or missing in my 
version opf the code, 
which is essentially the same as chapter 5 of the book.

First I changed the spelling of frontcontroller to frontController in
resources.frontController.plugins.action = "SF_Plugin_Action"
I still got the error 
(SF\Plugin\Action.php) [function.include-once]: failed to open stream: ....
Then I added the following include at the top of bootstrap.php
include_once(PATH_TO. "/Plugin/Action.php");
this resulted in the error:
include_once(SF\Model\Abstract.php) [function.include-once]: failed to open 
stream:
then I added includes for:
"/Model/Interface.php" and "/Model/Abstract.php" and got:
Class 'Storefront_Resource_Category' not found in D:\PHP 
Projects\storeFront\library\SF\Model\Abstract.php on line 104
So I think I have a fundamental problem with the loader.the loader 

Original comment by ma...@michaelafox.org on 10 Jul 2011 at 11:10

GoogleCodeExporter commented 8 years ago
I had the following error:
Message: No adapter found for Storefront_Resource_Category

changing the below code in the application.ini file from this:

resources.frontController.plugins.action = "SF_Plugin_Action"
resources.frontController.plugins.admin = "SF_Plugin_AdminContext"

to this

resources.frontcontroller.plugins.action = "SF_Plugin_Action"
resources.frontcontroller.plugins.admin = "SF_Plugin_AdminContext"

fixed the problem.

Original comment by garyw3...@gmail.com on 16 Dec 2011 at 3:28

GoogleCodeExporter commented 8 years ago
If the replacement code is the same as the existing code, which I have.

Original comment by ma...@michaelafox.org on 16 Dec 2011 at 7:41