Search Results

Search found 383 results on 16 pages for 'doctrine'.

Page 1/16 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Doctrine 2 Cannot find entites

    - by Flyn San
    I'm using Kohana 3 and have a /doctrine/Entites folder with my entities inside. When executing the code $product = Doctrine::em()->find('Entities\Product', 1); in my controller, I get the error class_parents(): Class Entities\Product does not exist and could not be loaded Below is the Controller (classes/controller/welcome.php): <?php class Controller_Welcome extends Controller { public function action_index() { $prod = Doctrine::em()->find('Entities\Product', 1); } } Below is the Entity (/doctrine/Entities/Product.php): <?php /** * @Entity * @Table{name="products"} */ class Product { /** @Id @Column{type="integer"} */ private $id; /** @Column(type="string", length="255") */ private $name; public function getId() { return $this->id; } public function setId($id) { $this->id = intval($id); } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } } Below is the Doctrine module bootstrap file (/modules/doctrine/init.php): class Doctrine { private static $_instance = null; private $_application_mode = 'development'; private $_em = null; public static function em() { if ( self::$_instance === null ) self::$_instance = new Doctrine(); return self::$_instance->_em; } public function __construct() { require __DIR__.'/classes/doctrine/Doctrine/Common/ClassLoader.php'; $classLoader = new \Doctrine\Common\ClassLoader('Doctrine', __DIR__.'/classes/doctrine'); $classLoader->register(); $classLoader = new \Doctrine\Common\ClassLoader('Symfony', __DIR__.'/classes/doctrine/Doctrine'); $classLoader->register(); $classLoader = new \Doctrine\Common\ClassLoader('Entities', APPPATH.'doctrine'); $classLoader->register(); //Set up caching method $cache = $this->_application_mode == 'development' ? new \Doctrine\Common\Cache\ArrayCache : new \Doctrine\Common\Cache\ApcCache; $config = new Configuration; $config->setMetadataCacheImpl( $cache ); $driver = $config->newDefaultAnnotationDriver( APPPATH.'doctrine/Entities' ); $config->setMetadataDriverImpl( $driver ); $config->setQueryCacheImpl( $cache ); $config->setProxyDir( APPPATH.'doctrine/Proxies' ); $config->setProxyNamespace('Proxies'); $config->setAutoGenerateProxyClasses( $this->_application_mode == 'development' ); $dbconf = Kohana::config('database'); $dbconf = reset($dbconf); //Use the first database specified in the config $this->_em = EntityManager::create(array( 'dbname' => $dbconf['connection']['database'], 'user' => $dbconf['connection']['username'], 'password' => $dbconf['connection']['password'], 'host' => $dbconf['connection']['hostname'], 'driver' => 'pdo_mysql', ), $config); } } Any ideas what I've done wrong?

    Read the article

  • Dotrine::Zend::How generate new doctrine models without delete doctrine models classes with my code

    - by Yosef
    Hi, I build zend app with doctrine. The problem is when i add new tables to database and I should generate doctrine models, because I add my own code to Doctine generated classes- I dont wont to delete them. I solve this problem like that: 1. copy old generated doctine models classes to other folder 2. generate doctrine models from database 3. remove same new doctrine models class with old I think my solution stupied, but i cant think about something else. Please help me, Thanks, Yosef

    Read the article

  • How to generate Doctrine models/classes that extend a custom record class

    - by Shane O'Grady
    When I use Doctrine to generate classes from Yaml/db each Base class (which includes the table definition) extends the Doctrine_Record class. Since my app uses a master and (multiple) slave db servers I need to be able to make the Base classes extend my custom record class to force writes to go to the master db server (as described here). However if I change the base class manually I lose it again when I regenerate my classes from Yaml/db using Doctrine. I need to find a way of telling Doctrine to extend my own Base class, or find a different solution to a master/slave db setup using Doctrine. Example generated model: abstract class My_Base_User extends Doctrine_Record { However I need it to be automatically generated as: abstract class My_Base_User extends My_Record { I am using Doctrine 1.2.1 in a new Zend Framework 1.9.6 application if it makes any difference.

    Read the article

  • php doctrine last identifier issue

    - by mike
    I'm running in to the issue below when trying to run the following: $store = new Store(); $store->url =$this->form_validation->set_value('website'); $store->save(); $store_id = $store->identifier(); Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'Couldn't get last insert identifier.' in /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php:932 Stack trace: #0 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(632): Doctrine_Connection_UnitOfWork->_assignIdentifier(Object(Category_store_assn)) #1 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(562): Doctrine_Connection_UnitOfWork->processSingleInsert(Object(Category_store_assn)) #2 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(81): Doctrine_Connection_UnitOfWork->insert(Object(Category_store_assn)) #3 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(Category_store_assn)) #4 /home/yummm/public_html/system/application/controllers/auth.php(375): Doctrine_Reco in /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php on line 932 When I echo $store_id, it seems to be grabbing the last id without any issues. Any idea why this error keeps coming up even though the ID is passing correctly?

    Read the article

  • ZF1 + Doctrine 2 ODM: Call to undefined method AnnotationReader::setDefaultAnnotationNamespace

    - by Rafael
    I am trying to setup a zf1 + doctrine mongo odm 1.0.0BETA4-DEV project. I am using https://github.com/Bittarman/zf-d2-odm branch but when I update doctrine version from 1.0.0BETA3 to 1.0.0BETA4-DEV, I get the following error: SCREAM: Error suppression ignored for ( ! ) Fatal error: Call to undefined method Doctrine\Common\Annotations\AnnotationReader::setDefaultAnnotationNamespace() in C:\htdocs\zf-d2-odm\library\Lupi\Resource\Odm.php on line 34 Call Stack # Time Memory Function Location 1 0.0007 139368 {main}( ) ..\index.php:0 2 0.0217 659008 Zend_Application->bootstrap( ) ..\index.php:25 3 0.0217 659104 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( ) ..\Application.php:355 4 0.0217 659120 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:586 5 0.0314 1127240 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( ) ..\BootstrapAbstract.php:626 6 0.0314 1127368 Lupi_Resource_Odm->init( ) ..\BootstrapAbstract.php:683

    Read the article

  • PHP Doctrine frustration: loading models doesn't work..?

    - by ropstah
    I'm almost losing it, i really hope someone can help me out! I'm using Doctrine with CodeIgniter. Everything is setup correctly and works until I generate the classes and view the website. Fatal error: Class 'BaseObjecten' not found in /var/www/vhosts/domain.com/application/models/Objecten.php on line 13 I'm using the following bootstrapper (as CodeIgniter plugin): <?php // system/application/plugins/doctrine_pi.php // load Doctrine library require_once BASEPATH . '/plugins/Doctrine/lib/Doctrine.php'; // load database configuration from CodeIgniter require_once APPPATH.'/config/database.php'; // this will allow Doctrine to load Model classes automatically spl_autoload_register(array('Doctrine', 'autoload')); // we load our database connections into Doctrine_Manager // this loop allows us to use multiple connections later on foreach ($db as $connection_name => $db_values) { // first we must convert to dsn format $dsn = $db[$connection_name]['dbdriver'] . '://' . $db[$connection_name]['username'] . ':' . $db[$connection_name]['password']. '@' . $db[$connection_name]['hostname'] . '/' . $db[$connection_name]['database']; Doctrine_Manager::connection($dsn,$connection_name); } // CodeIgniter's Model class needs to be loaded require_once BASEPATH.'/libraries/Model.php'; // telling Doctrine where our models are located Doctrine::loadModels(APPPATH.'/models'); // (OPTIONAL) CONFIGURATION BELOW // this will allow us to use "mutators" Doctrine_Manager::getInstance()->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true); // this sets all table columns to notnull and unsigned (for ints) by default Doctrine_Manager::getInstance()->setAttribute( Doctrine::ATTR_DEFAULT_COLUMN_OPTIONS, array('notnull' => true, 'unsigned' => true)); // set the default primary key to be named 'id', integer, 4 bytes Doctrine_Manager::getInstance()->setAttribute( Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS, array('name' => 'id', 'type' => 'integer', 'length' => 4)); ?> Anyone? p.s. I also tried adding the following right after // (OPTIONAL CONFIGURATION) Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE); spl_autoload_register(array('Doctrine', 'modelsAutoload'));

    Read the article

  • Updating textfield in doctrine produces an exception

    - by james-murphy
    I have a textfield that contains say for example the following text:- "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and gravy." This textfield is in a form that simply updates an item record using it's ID. If I edit part of the textfield and replace "and gravy." with "humous." So that the textfield now contains "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and humous." I get the following exception:- Fatal error: Uncaught exception 'Doctrine_Query_Exception' with message 'Unknown component alias humous' in C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php:780 Stack trace: C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(767): Doctrine_Query_Abstract-getQueryComponent('humous') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Set.php(58): Doctrine_Query_Abstract-getAliasDeclaration('humous') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(2092): Doctrine_Query_Set-parse('i.details = 'A ...') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query.php(1058): Doctrine_Query_Abstract-_processDqlQueryPart('set', Array) C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(971): Doctrine_Query-getSqlQuery(Array) C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(1030): Doctrine_Query_Abstract-_execute(Array) C:\Projects\nitrous\lightweight\system\appl in C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php on line 780 I'm using Doctrine 1.0.6 hooked into CodeIgniter 1.7.0 if anyone is interested. My doctrine query that actually performs the update looks as follows:- public function updateItems($id, $arrayItem) { $query = new Doctrine_Query(); $query->update('Item i'); foreach($arrayItem as $key => $value) { $query->set('i.'.$key, "'".$value."'"); } $query->where('i.id = ?', $id); return $query->execute(); } This seems bizarre because if i replace the entire string "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and humous." with something completely different like just "test" it doesn't throw an exception and works just fine. This baffles me... is it a bug in Doctrine or have I missed something?

    Read the article

  • How to escape LIKE %$var% with Doctrine?

    - by Peter Smit
    I am making a Doctrine query and I have to do a wildcard match in the where clause. How should I escape the variable that I want to insert? The query I want to get: SELECT u.* FROM User as u WHERE name LIKE %var% The php code until now: $query = Doctrine_Query::create() ->from('User u') ->where(); What should come in the where clause? The variable I want to match is $name

    Read the article

  • doctrine behaviors , if i did it like this , would be correct ??

    - by tawfekov
    Hi , I am doing a web application in ZF + Doctrine 1.2.3 but i had an old database , it had pretty good structure so i think i can reverse engineer it with doctrine commad ./dcotrine generate-models-db , its amazing but i stopped when i wanted to use some doctrine behaviors like : searchable as an example , my question : if i went to my model and added these two lines : $this->actAs('Searchable', array( 'fields' => array('title', 'content') ) ); i am not sure if that enough and would work as expected , if you had any more tips about creating other behaviors like (versionable , i18n , sluggable or soft delete ) manually or reverse engineer it with doctrine behaviors , could you please list them

    Read the article

  • Doctrine Build-All Task fails in NetBeans - Class not found! Fatal Error: call to evictAll()

    - by Prasad
    When I build my model with the symfony doctrine:build --all --and-load command I have made no major changes to the model/schema, this is something new. I also tried sub-commands like build-model, build-tables, but they all hang.. I'm trying this in net beans. Any clue what this is? This command will remove all data in the following "dev" connection(s): - doctrine Are you sure you want to proceed? (y/N) y >> doctrine Dropping "doctrine" database >> doctrine Creating "dev" environment "doctrine" database >> doctrine generating model classes >> file+ C:\Documents and Settings\Gupte...\Temp/doctrine_schema_69845.yml >> tokens D:/projects/cim/lib/model/doctrine/base/BaseAffiliate.class.php >> tokens D:/projects/cim/lib/model/doctrine/base/BaseContact.class.php >> tokens D:/projects/cim/lib/model/doctr...e/BaseContactLocation.class.php >> tokens D:/projects/cim/lib/model/doctr...se/BaseGroupAffiliate.class.php >> tokens D:/projects/cim/lib/model/doctrine/base/BaseGrouping.class.php >> tokens D:/projects/cim/lib/model/doctrine/base/BaseLocation.class.php >> tokens D:/projects/cim/lib/model/doctr.../base/BasePhonenumber.class.php >> tokens D:/projects/cim/lib/model/doctrine/base/BaseTenant.class.php >> tokens D:/projects/cim/lib/model/doctr...base/BasesfGuardGroup.class.php >> tokens D:/projects/cim/lib/model/doctr...fGuardGroupPermission.class.php >> tokens D:/projects/cim/lib/model/doctr...BasesfGuardPermission.class.php >> tokens D:/projects/cim/lib/model/doctr...asesfGuardRememberKey.class.php >> tokens D:/projects/cim/lib/model/doctr.../base/BasesfGuardUser.class.php >> tokens D:/projects/cim/lib/model/doctr.../BasesfGuardUserGroup.class.php >> tokens D:/projects/cim/lib/model/doctr...sfGuardUserPermission.class.php >> autoload Resetting application autoloaders >> file- D:/projects/cim/cache/frontend/.../config/config_autoload.yml.php >> file- D:/projects/cim/cache/backend/dev/config/config_autoload.yml.php >> doctrine generating form classes [?php /** * Contact form base class. * * @method Contact getObject() Returns the current form's model object * * @package ##PROJECT_NAME## * @subpackage form * @author ##AUTHOR_NAME## * @version SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $ */ abstract class BaseContactForm extends BaseFormDoctrine { public function setup() { $this->setWidgets(array( 'id' Fatal error: Call to a member function evictAll() on a non-object in D:\projects\cim\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Connection.php on line 1239 Call Stack: 0.9552 322760 1. {main}() D:\projects\cim\symfony:0 0.9594 587208 2. include('D:\projects\cim\lib\vendor\symfony\lib\command\cli.php') D:\projects\cim\symfony:14 11.9775 17118936 3. sfDatabaseManager->shutdown() D:\projects\cim\lib\vendor\symfony\lib\database\sfDatabaseManager.class.php:0 11.9775 17118936 4. sfDoctrineDatabase->shutdown() D:\projects\cim\lib\vendor\symfony\lib\database\sfDatabaseManager.class.php:134 11.9775 17118936 5. Doctrine_Manager->closeConnection() D:\projects\cim\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\database\sfDoctrineDatabase.class.php:165 11.9775 17118936 6. Doctrine_Connection->close() D:\projects\cim\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Manager.php:579 11.9776 17120160 7. Doctrine_Connection->clear() D:\projects\cim\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Connection.php:1268 Couldn't find class Similar thing is mentioned here: http://osdir.com/ml/symfony-users/2010-01/msg00642.html

    Read the article

  • How can I store HTML in a Doctrine YML fixture

    - by argibson
    I am working with a CMS-type site in Symfony 1.4 (Doctrine 1.2) and one of the things that is frustrating me is not being able to store HTML pages in YML fixtures. Instead I have to create SQL backups of the data if I want to drop and rebuild which is a bit of a pest when Symfony/Doctrine has a fantastic mechanism for doing exactly this. I could write a mechanism that reads in a set of HTML files for each page and fills the data in that way (or even write it as a task). But before I go down that road I am wondering if there is any way for HTML to be stored in a YML fixture so that Doctrine can simply import it into the database. Update: I have tried using symfony doctrine:data-dump and symfony doctrine:data-load however despite the dump correctly creating the fixture with the HTML, the load task appears to 'skip' the value of the column with the HTML and enters everything else into the row. In the database the field doesn't show up as 'NULL' but rather empty so I believe Doctrine is adding the value of the column as ''. Below is a sample of the YML fixture that symfony doctrine:data-dump created. I have tried running symfony doctrine:data-load against various forms of this including removing all the escaped characters (new lines and quotes leaving only angle brackets) but it still doesn't work. Product_69: name: 'My Product' Developer: Developer_30 tagline: 'Text that briefly describes the product' version: '2008' first_published: '' price_code: A79 summary: '' box_image: '' description: "<div id=\"featureSlider\">\n <ul class=\"slider\">\n <li class=\"sliderItem\" title=\"Summary\">\n <div class=\"feature\">\n Some text goes in here</div>\n </li>\n </ul>\n </div>\n" is_visible: true

    Read the article

  • Is this possible to join tables in doctrine ORM without using relations?

    - by piemesons
    Suppose there are two tables. Table X-- Columns: id x_value Table Y-- Columns: id x_id y_value Now I dont want to define relationship in doctrine classes and i want to retrieve some records using these two tables using a query like this: Select x_value from x, y where y.id="variable_z" and x.id=y.x_id; I m not able to figure out how to write query like this in doctrine orm EDIT: Table structures: Table 1: CREATE TABLE IF NOT EXISTS `image` ( `id` int(11) NOT NULL AUTO_INCREMENT, `random_name` varchar(255) NOT NULL, `user_id` int(11) NOT NULL, `community_id` int(11) NOT NULL, `published` varchar(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=259 ; Table 2: CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `city` varchar(20) DEFAULT NULL, `state` varchar(20) DEFAULT NULL, `school` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ; Query I am using: $q = new Doctrine_RawSql(); $q ->select('{u.*}, {img.*}') ->from('users u LEFT JOIN image img ON u.id = img.user_id') ->addComponent('u', 'Users u') ->addComponent('img', 'u.Image img') ->where("img.community_id='$community_id' AND img.published='y' AND u.state='$state' AND u.city='$city ->orderBy('img.id DESC') ->limit($count+12) ->execute(); Error I am getting: Fatal error: Uncaught exception 'Doctrine_Exception' with message 'Couldn't find class u' in C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php:290 Stack trace: #0 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php(240): Doctrine_Table- >initDefinition() #1 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.php(1127): Doctrine_Table->__construct('u', Object(Doctrine_Connection_Mysql), true) #2 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\RawSql.php(425): Doctrine_Connection- >getTable('u') #3 C:\xampp\htdocs\fanyer\doctrine\models\Image.php(33): Doctrine_RawSql- >addComponent('img', 'u.Image imga') #4 C:\xampp\htdocs\fanyer\community_images.php(31): Image->get_community_images_gallery_filter(4, 0, 'AL', 'ALBERTVILLE') #5 {main} thrown in C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php on line 290

    Read the article

  • Doctrine lazy loading classes takes 100 ms?!

    - by ropstah
    I'm lazy loading my Doctrine classes in my website. Benchmarking has showed that Doctrine::loadModels('models') takes over 100 ms to complete! I have 118 tables in total, but still... setting attribute to conservative loading: Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE); running the benchmark part: $CI->benchmark->mark('Doctrineload_start'); Doctrine::loadModels(APPPATH.'models'); $CI->benchmark->mark('Doctrineload_end'); And the result: Doctrineload 0.1085 (seconds) Is this 'normal'? 'context': Loading Time Base Classes 0.0233 Doctrineinit 0.0435 //doctrine_pi.php file, doctrine configuration + db account Doctrineload 0.1085 Masterpageset 0.0001 Userload 0.1208 //1 db query Masterpageaddcontent 0.1565 //1 db query, loading view with some <?=?> php parsing Masterpageshow 0.0203 //loading view Controller Execution Time ( Home / Index ) 0.3591 Total Execution Time 0.3826

    Read the article

  • Preventing Doctrine from Dropping / Recreating Database When using build --all

    - by Levi Hackwith
    The problem: I have a database that's running on a shared server. I do not have permission to drop/ create a database via the command line doctrine SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'opnsrce'@'173.236.128.0/255.255.128.0' to database 'dev'. Failing Query: "DROP DATABASE dev" doctrine Creating "all" environment "doctrine" database doctrine SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'opnsrce'@'173.236.128.0/255.255.128.0' to database 'dev'. Failing Query: "CREATE DATABASE dev" This error occurs when I run /dh/cgi-system/php5.cgi symfony doctrine:build --all --no-confirmation The Question: How do I run build-all while simultaneously telling doctrine to not drop / create the database (it already exists)?

    Read the article

  • Doctrine stupid or me stupid?

    - by ropstah
    I want to use a single Doctrine install on our server and serve multiple websites. Naturally the models should be maintained in the websites' modelsfolder. I have everything up (and not running) like so: Doctrine @ /CustomFramework/Doctrine Websites @ /var/www/vhosts/custom1.com/ /var/www/vhosts/custom2.com/ Generating works fine, all models are delivered in /application_folder/models and /application_folder/models/generated for the correct website. I've added Doctrine::loadModels('path_to_models') in the bootstrap file for each website, and also registered the autoloaded. But.... This is the autoloader code: public static function autoload($className) { if (strpos($className, 'sfYaml') === 0) { require dirname(__FILE__) . '/Parser/sfYaml/' . $className . '.php'; return true; } if (0 !== stripos($className, 'Doctrine_') || class_exists($className, false) || interface_exists($className, false)) { return false; } $class = self::getPath() . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; if (file_exists($class)) { require $class; return true; } return false; } Am I stupid, or is the autoloader really doing this: $class = self::getPath() . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; or, in other words: Does it require me to have ALL my generated doctrine classes inside the Doctrine app directory? Or in other words, do I need a single Doctrine installation for each website? I'm getting an error that the BaseXXX class cannot be found. So the autoloading doesn't function correctly. I really hope i'm doing something wrong.. anyone?

    Read the article

  • Should I choose Doctrine 2 or Propel 1.5/1.6, and why?

    - by Billy ONeal
    I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus Propel 1.3/1.4, and both ORMs went through significant redesigns in their recent revisions. For example, most of the criticism of Propel seems to center around the "ModelName Peer" classes, which are deprecated in 1.5 in any case. Here's what I've accumulated so far (And I've tried to make this list as balanced as possible...): Propel Pros Extremely IDE friendly, because actual code is generated, instead of relying on PHP magic methods. This means IDE features like code completion are actually helpful. Fast (In terms of database usage -- no runtime introspection is done on the database) Clean migration between schema versions (at least in the 1.6 beta) Can generate PHP 5.3 models (i.e. namespaces) Easy to chain a lot of things into a single database query with things like useXxx methods. (See the "code completion" video above) Cons Requires an extra build step, namely building the model classes. Generated code needs rebuilt whenever Propel version is changed, a setting is changed, or the schema changes. This might be unintuitive to some and custom methods applied to the model are lost. (I think?) Some useful features (i.e. version behavior, schema migrations) are in beta status. Doctrine Pros More popular Doctrine Query Language can express potentially more complicated relationships between data than easily possible with Propel's ActiveRecord strategy. Easier to add reusable behaviors when compared with Propel. DocBlock based commenting for building the schema is embedded in the actual PHP instead of a separate XML file. Uses PHP 5.3 Namespaces everywhere Cons Requires learning an entirely new programming language (Doctrine Query Language) Implemented in terms of "magic methods" in several places, making IDE autocomplete worthless. Requires database introspection and thus is slightly slower than Propel by default; caching can remove this but the caching adds considerable complexity. Fewer behaviors are included in the core codebase. Several features Propel provides out of the box (such as Nested Set) are available only through extensions. Freakin' HUGE :) This I have gleaned though only through reading the documentation available for both tools -- I've not actually built anything yet. I'd like to hear from those who have used both tools though, to share their experience on pros/cons of each library, and what their recommendation is at this point :)

    Read the article

  • doctrine findby relation

    - by iggnition
    I'm having trouble selecting a subset of data with doctrine. I have 3 tables Location Contact Contact_location The contact and location tables hold a name and an id the other table holds only ID's. For instance: Location loc_id: 1 name: detroit Contact contact_id: 1 name: Mike Contact_location loc_id: 1 contact_id: 1 In doctrine there is a many to many relation between the location and contact tables with contact_location as the ref_class. What i want to do is on my location page i want to find all contacts where for instance the loc_id = 1. I tried: $this->installedbases = Doctrine::getTable('contact')->findByloc_id(1); hoping doctrine would see the relation and get it, but it does not. How can i make doctrine search in relevant related tables? I read it can be done using Findby but i find the documentation unclear.

    Read the article

  • Doctrine does not export relation properly

    - by iggnition
    Hi, I've got a MySQL 5.1.41 database which i'm trying to fill with doctrine, but doctrine does not insert the relations correctly. My YAML is: Locatie: connection: doctrine tableName: locatie columns: loc_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true org_id: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false naam: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false straat: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer: type: integer(4) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer_achtervoegsel: type: string(3) fixed: false unsigned: false primary: false notnull: false autoincrement: false plaats: type: string(25) fixed: false unsigned: false primary: false notnull: true autoincrement: false postcode: type: string(6) fixed: false unsigned: false primary: false notnull: true autoincrement: false telefoon: type: string(12) fixed: false unsigned: false primary: false notnull: true autoincrement: false opmerking: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false inloggegevens: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Organisatie: local: org_id foreign: org_id type: one onDelete: CASCADE onUpdate: CASCADE Organisatie: connection: doctrine tableName: organisatie columns: org_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true naam: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false straat: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer: type: integer(4) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer_achtervoegsel: type: string(3) fixed: false unsigned: false primary: false notnull: false autoincrement: false plaats: type: string(25) fixed: false unsigned: false primary: false notnull: true autoincrement: false postcode: type: string(6) fixed: false unsigned: false primary: false notnull: true autoincrement: false telefoon: type: string(12) fixed: false unsigned: false primary: false notnull: true autoincrement: false opmerking: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Locatie: local: org_id foreign: org_id type: many Now if a make an organisation and then create a location which has a foreignkey to organisation everything is fine. but when i try to update the org_id with phpmyadmin i get a contraint error. If i manually set the foreign key to ON_UPDATE CASCADE it does work. Why does doctrine not set this option? I got it to work in Propel, but i really want to use doctrine for this.

    Read the article

  • symfony doctrine build-sql error

    - by user313571
    I have some big problems with symfony and doctrine at the beginning of a new project. I have created database diagram with mysql workbench, inserted the sql into phpmyadmin and then I've tried symfony doctrine:build-schema to generate the YAML schema. It generates a wrong schema (relations don't have on delete/on update) and after this I've tried symfony doctrine:build --sql and symfony doctrine:insert-sql The insert-sql statement generates error (can't create table ... failing query alter table add constraint ....), so I've decided to take a look over the generated sql and I've found out some differences between the sql generated from mysql workbench (which works perfect, including relations) and the sql generated by doctrine. I'll be short from now: I have to tables, EVENT and FORM and a 1 to n relation (each event may have multiple forms) so the correct constraint (generated with workbench) is ALTER TABLE `form` ADD CONSTRAINT `fk_form_event1` FOREIGN KEY (`event_id`) REFERENCES `event` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; doctrine generated statement is: ALTER TABLE event ADD CONSTRAINT event_id_form_event_id FOREIGN KEY (id) REFERENCES form(event_id); It's totally reversed and I am sure here is the error. What should I do? It's also correct like this?

    Read the article

  • symfony + doctrine + inheritance, how to make them work?

    - by imac
    I am beginning to work with Symfony, I've found some documentation about inheritance. But also found this discouraging article, which make me doubt if Doctrine handles inheritance any good at all... Has anyone find a smart solution for inheritance in Symfony+Doctrine? As an example, I have already structured the database something like this: CREATE TABLE `poster` ( `poster_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(50) NOT NULL, PRIMARY KEY (`poster_id`), UNIQUE KEY `id` (`poster_id`), ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; CREATE TABLE `user` ( `user_id` int(11) NOT NULL, `real_name` varchar(50) DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `user_id` (`user_id`), CONSTRAINT `user_fk` FOREIGN KEY (`user_id`) REFERENCES `poster` (`poster_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; From that, Doctrine generated this "schema.yml": Poster: connection: doctrine tableName: poster columns: poster_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true user_name: type: string(50) fixed: false unsigned: false primary: false notnull: true autoincrement: false relations: Post: local: poster_id foreign: poster_id type: many User: local: poster_id foreign: user_id type: many Version: local: poster_id foreign: poster_id type: many User: connection: doctrine tableName: user columns: user_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false real_name: type: string(50) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Poster: local: user_id foreign: poster_id type: one User creation for this structure with Doctrine auto-generated forms does not work. Any clue will be appreciated.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >