Ticket #314 (closed defect: invalid)
No good include's
| Reported by: | Ivo | Owned by: | hans |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Generator | Version: | 1.2.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I use a windows machine (for development)and a WAMP instalation (with PHP 5.1).
I have installed propel with pear (and the requirements also with pear)
Then I have generate the book database with this settings:
runtime-conf.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- This new XML configuration format is the default format for properties files. You can also used the old INI-based .properties format, but support for this will be removed in next major Propel version. --> <config> <!-- # # L O G G I N G # # We use PEAR-compatible Log for all Propel logging and we embed the # log conf properties within our application configuration. # # type - the type of log (default 'file') # name - the name of log or path to file. (default './propel.log') # ident - the text used to identify the log messages # level - the log level # PEAR_LOG_EMERG 0 # PEAR_LOG_ALERT 1 # PEAR_LOG_CRIT 2 # PEAR_LOG_ERR 3 # PEAR_LOG_WARNING 4 # PEAR_LOG_NOTICE 5 # PEAR_LOG_INFO 6 # PEAR_LOG_DEBUG 7 <== DEFAULT --> <log> <ident>propel-bookstore</ident> <level>7</level> </log> <!-- # # P R O P E L P R O P E R T I E S # # Note that you can configure multiple datasources; for example if your # project uses several databases. --> <propel> <datasources default="bookstore"> <datasource id="bookstore"> <!-- the Propel adapter (usually same as phptype of connection DSN) --> <adapter>mysql</adapter> <!-- Connection DSN. See PEAR DSN format for other supported parameters. --> <connection> <phptype>mysql</phptype> <hostspec>localhost</hostspec> <database>bookstore</database> <username>****</username> <password>******</password> </connection> </datasource> </datasources> </propel> </config>
build.properties
propel.project = bookstore
propel.database = mysql
propel.database.url = mysql://root:Panda55@localhost/bookstore
propel.targetPackage = bookstore
propel.addGenericAccessors = true
propel.addGenericMutators = true
# directories
project.home = E:/projects/PHPTest
propel.output.dir = ${project.home}/website
propel.php.dir = ${propel.output.dir}/classes
propel.phpconf.dir = ${propel.output.dir}/conf
propel.sql.dir = ${propel.output.dir}/db/sql
propel.runtime.phpconf.file = propel-config.php
and my index.php file uses the classes in this way:
<?php
'''include('classes/bookstore/Author.php');'''
$author = new Author();
$author->setFirstName("John");
$author->setLastName("Smith");
$publisher = new Publisher();
$publisher->setName("Penguin");
// Create J.Smith's book
$book = new Book();
$book->setISBN("111-2222-3333");
$book->setTitle("Fake Title");
$book->setPublisher($publisher);
$book->setAuthor($author);
$book->save();
?>
When I run the PHP file I get the following error's:
Warning: require_once(bookstore/om/BaseAuthor.php) [function.require-once]: failed to open stream: No such file or directory in D:\Program Files\xampp\htdocs\phpeclipse\PHPtest\website\classes\bookstore\Author.php on line 3 Fatal error: require_once() [function.require]: Failed opening required 'bookstore/om/BaseAuthor.php' (include_path='.;d:\Program Files\xampp\php\pear\') in D:\Program Files\xampp\htdocs\phpeclipse\PHPtest\website\classes\bookstore\Author.php on line 3
the BaseAuthor.php uses this include path's:
require_once 'propel/om/BaseObject.php'; require_once 'propel/om/Persistent.php'; include_once 'propel/util/Criteria.php'; include_once 'bookstore/AuthorPeer.php';
What is wrong propel (or my installation)?
thnx in advance,
Ivo Trompert
Change History
Note: See
TracTickets for help on using
tickets.
Excepted behavior - your propel project directory has to be in the include path:
D:\Program Files\xampp\htdocs\phpeclipse\PHPtest\website\classes\
For more info consider reading the docs and asking the user mailing list.
Thanks!