doctrine

Open source projects using Doctrine ORM

Following http://stackoverflow.com/questions/3531490/examples-of-zend-framework-based-apps I'd like to ask: Do you know any open source projects using Doctrine ORM, good for reference purposes? What I recall: ZFPlanet Sympal (Symfony based CMS) ...

Doctrine 2 - problems with "Getting Started XML-Edition" - generating database schema

Having never touched Doctrine before (either 1 or 2), I am following this tutorial for Doctrine 2: http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en I'm at the point where I use the command line to generate the database schema. This is the cli-config.php file, as per the tutorial: <?php $cliC...

Unexpected doctrine validation error about length when setting the field null

I have a field that is defined as follows: class Subcategory extends BaseSubcategory {} abstract class BaseSubcategory extends Doctrine_Record { public function setTableDefinition() { // ... $this->hasColumn('meta_description', 'string', 255); // ... } // ... } Here's what the table looks like...

What does this doctrine query do?

$this->facebook_applications = Doctrine::getTable('FacebookApplication') ->createQuery('a') ->execute(); I don't understand how this works at all. Why is the query just 'a' and why does that seem to get a list of the applications? ...

How set custom path for schema.sql

I need to set custom sql_path in schema.yml, but this not work: in schema.yml: sql_path: `<?php echo sfConfig::get('sf_data_dir') ?>/sql/admin.sql` ...

Doctrine: How to mark object column value as dirty?

I have a column of type object in a model. But if I load a model, and change a property of the object, and then re-save, it doesn't seem re-serialize the object. e.g. $model_instance = $table->find(1); $object = $model_instance->object_column; $object->someProp = 'new value'; $model_instance->save(); //has no effect I think this is be...

How to create a mock object of a doctrine entity?

Hi, I'm trying to write a unit test with phpunit for a model that uses doctrine 2. I want to mock the doctrine entities but I really don't have a clue of how to do this. Can anyone explain to me how I need to do this? I'm using Zend Framework. The model that needs to be tested class Country extends App_Model { public function find...

PHP doctrine many-to-many last identifier problem

Guys, I have small problem when trying to create many-to-many link in doctrine. I have simple scenario here: User and Role with many-to-many relationship defined. $user = new User(); $user->username = 'greg'; $user->save(); $role = new Role(); $role->name = "Administrator"; $role->save(); $role_user = new Role_User(); $role_user->R...

Optimizing SQL to determine unique page views per user

Hello, I need to determine if user has already visited a page, for tracking unique page views. I have already implemented some HTTP header cache, but now I need to optimize the SQL queries. The visit is unique, when: pair: page_id + user_id is found in the visit table or pair: page_id + session_id is found or: page_id + [ip + userag...

Help With Embedded BaseFormDoctrine Forms

Hello, I have the following code blocks: class MerchantStoreForm extends sfForm { public function configure() { $this->disableCSRFProtection(); $this->setWidgets(array( 'brand_id' => new sfWidgetFormDoctrineChoice(array('label'=> 'Store Brand','model'=>'Brand','add_empty'=>'-Select Brand-','method'=>'getName','ke...

Does Zend_DB / Doctrine protect me from SQL injection?

Does using prepared statements in Zend_DB or Doctrine protect me from sql injection? example: $stmt = $db->prepare('SELECT * FROM users WHERE name = ? AND password = ?'); $rs = $stmt->execute('peter', 'secret'); Or do I have to check strings and types types myself? Another quickie: Which of the two is best? I only need the DB abstra...

Doctrine 2.0 in production

I would like to know if Doctrine 2 Beta 3 is stable enough to use for a production project? Do you have any success stories about it? What about api stability in general, and especially in recent betas? ...

symfony doctrine - insert/update Doctrine object from Excel

Hi! On the project which I am currently working, I have to read an Excel file (with over a 1000 rows), extract all them and insert/update to a database table. 1ª Question: in terms of performance, is better to add all the records to a Doctrine_Collection and insert/update them after using the fromArray() method, right? One other possib...

doctrine 2 Annotations and Zend Framework underscore convention

I am working through the doctrine 2 (Beta3) sandbox and trying to apply the Zend Framework coding convention of placing a leading underscore to private class members. When I query Address, while its private members are NOT underscored, i retrieve the object as expected. When I add the underscores, regenerate and repopulate the db, and th...

Zend+Doctrine yml schema question

I managed to get my Zend modular project working with Doctrine 1.2 according to these instructions http://github.com/beberlei/zf-doctrine and I have one question: Can I somehow get rid of writing entity names with prefixes Default_Model_ and Forum_Model_? For example write this prefix only once somewhere in yml and all entities in yml...

Doctrine lazy loading

I'm just getting to grips with Doctrine, and using the suggested lazy loading of models. As per the tutorials, I've created a doctrine bootstrap file: <?php require_once(dirname(__FILE__) . '/libs/doctrine/lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); $manager = Doctrine_Manager::getInstance(); $manager->setA...

loading doctrine models in zend framework scripts

i use zend framework 1.10 and i have a script under scripts library. i run this script from command line. how can i load all the models of doctrine and use them in my script. in the begining of the script i write /** * Doctrine CLI script */ define('APPLICATION_ENV', 'production'); define('APPLICATION_PATH', realpath(dirname(__FIL...

How to make 'symfony doctrine:build-sql' task generate 'DROP' statments ?

Is there a way to make symfony doctrine:build-sql task generate DROP statments before CREATE TABLE ones as it symfony propel:build-sql does ? ? ...

doctrine - DQL query for getting specific columns from the table

Hi! I had created the following table method in order to extract some specific table columns to allow later comparison to values stored on arrays: public function findAllComposedExcelColumns() { $q = Doctrine_Query::create() ->select('p.branch_code, p.state_id, p.state_description, p.account, p.client_name') ->fro...

Symfony Doctrine migrations : removeIndex not working

I'm using Symfony 1.4 with Doctrine. Here's my initial schema: Page: tableName: page columns: ref: type: string(50) notnull: true unique: true I'd like to remove the index on the ref column using migrations. So the schema becomes: Page: tableName: page columns: ref: type: string(50) notn...