benturkia / zendframeworkstorefront

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

class Storefront_Resource_User not found but code is there #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Concerning Storefront Code chapter 5 and chapter 6

Following my post of July7 2011.
1) in order to get any of the classes that depend on the DB I have had to add 
require_once(...) 
for each of the classes e.g. include_once(<path to>. "/Model/Interface.php");to 
bootstrap.php
With this I am able to get Chapter 5 code to work.

2) Chapter 6 code. The registration form comes up but when validating the 
email, although the constructor in UniqueEmail.php 
is entered, Storefront_Resource_User  is not found in 
storeFront\library\SF\Model\Abstract.php about line 100 
$this->_resources[$name] = new $class();
I don't understand what is wrong as the code is structurally similar to the 
category and project class  definitions and occupy the same file structure. 

Original issue reported on code.google.com by ma...@michaelafox.org on 4 Aug 2011 at 6:50

GoogleCodeExporter commented 8 years ago
This must be an autoloader issue if you are having to put includes in.

You can see whats registered in the autoloader:

$a = Zend_Loader_Autoloader::getInstance();
var_dump($a->getRegisteredNamespaces());
var_dump($a->getAutoloaders());

This will show you all the configured namespaces such as Zend, SF etc and the 
autoloaders you have registered.

Here's my module autoloader for my current project, you should have something 
similar.

object(Zend_Application_Module_Autoloader)[15]
      protected '_basePath' => string '/home/keith/www/application/modules/max' (length=52)
      protected '_components' => 
        array
          'Max_Model_DbTable' => string '/home/keith/www/application/modules/max/models/DbTable' (length=67)
          'Max_Model_Mapper' => string '/home/keith/www/application/modules/max/models/Mapper' (length=66)
          'Max_Form' => string '/home/keith/www/application/modules/max/forms' (length=58)
          'Max_Model' => string '/home/keith/www/application/modules/max/models' (length=59)
          'Max_Plugin' => string '/home/keith/www/application/modules/max/plugins' (length=60)
          'Max_Service' => string '/home/keith/www/application/modules/max/services' (length=61)
          'Max_View_Helper' => string '/home/keith/www/application/modules/max/views/helpers' (length=66)
          'Max_View_Filter' => string '/home/keith/www/application/modules/max/views/filters' (length=66)
          'Max_Model_Repository' => string '/home/keith/www/application/modules/max/models/Repository' (length=70)
          'Max_Model_Validator' => string '/home/keith/www/application/modules/max/models/Validator' (length=69)
      protected '_defaultResourceType' => string 'model' (length=5)
      protected '_namespace' => string 'Max' (length=3)
      protected '_resourceTypes' => 
        array
          'dbtable' => 
            array
              ...
          'mappers' => 
            array
              ...
          'form' => 
            array
              ...
          'model' => 
            array
              ...
          'plugin' => 
            array
              ...
          'service' => 
            array
              ...
          'viewhelper' => 
            array
              ...
          'viewfilter' => 
            array
              ...
          'mapper' => 
            array
              ...
          'repository' => 
            array
              ...
          'validator' => 
            array
              ...

Original comment by mute.p...@googlemail.com on 5 Aug 2011 at 11:43

GoogleCodeExporter commented 8 years ago
I added:
include_once(APPLICATION_PATH. 
"/modules/storefront//models/resources/User/Interface.php");
include_once(APPLICATION_PATH. 
"/modules/storefront//models/resources/User.php");
to get chapter 6 to successfully work.
I printed out the dumps of RegisteredNamespaces and Autoloaders;
Except for entries for repository and validator they look like yours(above). 
Also I have two identical elements in the autoloader array.
I attach  The dumps.
Thanks again

Original comment by ma...@michaelafox.org on 5 Aug 2011 at 9:32

Attachments:

GoogleCodeExporter commented 8 years ago
could you post the contents of your application.ini please, it looks like the 
autoloaders are not correct to me, it could be the appnamespace setting....

Original comment by mute.p...@googlemail.com on 6 Aug 2011 at 1:47

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_ROOTY "/../library/SF/Model/Plugin" 

resources.frontController.moduledirectory = APPLICATION_PATH "/modules/"
resources.frontController.defaultmodule = "storefront"
resources.frontController.params.prefixDefaultModule = true
resources.frontController.throwexceptions= false
resources.frontController.plugins.action = "SF_Plugin_Action"
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 = false

Original comment by ma...@michaelafox.org on 6 Aug 2011 at 3:52

GoogleCodeExporter commented 8 years ago
Ok, try removing the appnamespace and also do another test with 
appnamespace="storefront" instead of "Storefront"

Original comment by mute.p...@googlemail.com on 6 Aug 2011 at 5:13

GoogleCodeExporter commented 8 years ago
appnamespace="storefront"  and removing appnamespace both result i the message:

Fatal error: Class 'Storefront_Model_Catalog' not found in D:\PHP 
Projects\storeFront\application\modules\storefront\controllers\CategoryControlle
r.php on line 24

line 24 reads $catalogModel = new Storefront_Model_Catalog();
The line numbers are different from yours as I have some logging information 
inc;luded.

Original comment by ma...@michaelafox.org on 6 Aug 2011 at 10:21

GoogleCodeExporter commented 8 years ago
Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Section 
'@ENVIRONMENT@' cannot be found in "path/application/config/store.ini". help me!

Original comment by tronga...@gmail.com on 13 Nov 2012 at 4:42