Hi,
I'm reading through the Doctrine documentation but I can't find a way to implement the type of inheritance I want to use.
I would like to set up a hierarchy like so:
Node -> Something -> Something Else
With Node being the main parent.
I would like to store data common to everything in a node table, eg date of creation, update e...
Hi,
I have a table that is related to another. Is it possible to use the auto incremented Id of table one as the foreign key of table two in one statement, rather than using lastInsertId and performing a separate save on each table?
Any advice appreciated.
Thanks.
...
Hey all.
I'm using Doctrine 1.2 as my ORM for a Zend Framework Project. I have defined the following Model for a File.
File:
columns:
id:
primary: true
type: integer(4)
unsigned: true
code:
type: string(255)
unique: true
notblank: true
p...
Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected.
I am generating models from the db (MySQL 4) using:
Doctrine::generateModelsFromDb($pathToModels);
Then generating YAML from the models using:
Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels);
In the generated m...
Hi,
I'm using Symfony 1.2 with Doctrine. I have a Place model with translations in two languages. This Place model has also a nested set behaviour.
I'm having problems now creating a new place that belongs to another node. I've tried two options but both of them fail:
1 option
$this->mergeForm(new PlaceTranslationForm($this->obje...
Hi,
I'm going through tutorials for doctrine and have come across a problem. Does the autoload function not apply on behaviours?
This is the tutorial I've been following. It should automatically create relations between the tables mentioned upon generation, however I just get an error message saying that the respective foreign id colu...
Hi,
Does anyone know if it is possible to specify an interface for a Doctrine model to implement within YAML?
I cannot find anything within the documentation.
Thanks
...
Hi, I have the following YAML schema for organising users in Doctrine:
Person:
tableName: people
columns:
id:
type: integer
primary: true
autoincrement: true
firstname:
type: string
notnull: true
lastname:
type: string
notnull: true
User:
inheritance:
extends: Person
t...
Just working on a project where I have a class called 'Product' and a class called 'Image'. Each product has two types of images, one 'front' image and one 'back' image, so I defined two fields, one called image_front_id and one called image_back_id.
In the method BaseProduct::setUp(), I defined the relation for the front images as foll...
In brief, what happens when you add a column to a table? What happens when you remove one?
In more details, suppose you have the following:
class User extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('username', 'string', 255);
$this->hasColumn('password', 'string', 255);
}
}...
Hi,
I'm generating my models from database and I get something like this:
public function setUp()
{
parent::setUp();
$this->hasOne('Articles', array(
'local' => 'article_id',
'foreign' => 'id'));
$this->hasOne('Users', array(
'local' => 'voter_id',
'foreign' => 'id'));
$this->hasOne(...
Hi,
I am pretty new to doctrine. I made two small projects with doctrine for my own but now I am about to create big project for my client. The project will have more than 50 tables. Is there any way of generating schema.yml? I tried DB Designer and converted it to schema.yml, but I still had to check and rewrite the definitions by hand...
What's the best way to make small schema updates to your symfony/doctrine application?
My issue is, I'm working on a new side-project and occasionally find myself adding a new column here, a new column there as i find the need. However, my DB already has existing data and I dont want to run a complete rebuild and drop my DB with the ch...
Hi there,
I have a site where the users can view quite a large number of posts. Every time this is done I run a query similar to UPDATE table SET views=views+1 WHERE id = ?. However, there are a number of disadvantages to this approach:
There is no way of tracking when the pageviews occur - they are simply incremented.
Updating the ta...
Hello, i just started using PHP namespaces. I have two models classes in separate files
In both files first i declare namespace
namespace eu\ed\sixImport\importViewer\models;
first class:
class Log extends \Doctrine_Record
$this->hasMany('eu\ed\sixImport\importViewer\models\DataSource as DataSource', array(
'local' => '...
I am using Symfony 1.2 with the sfDoctrinePlugin.
I couldn't find any command to call the down method on a migration, neither the documentation suggests any related arguments to the existing doctrine migrate command.
What would be a way to rollback the migration I just ran successfully? Creating a new migration to undo is an option, but...
In this document, it explains how to use mutators and accessors in Doctrine, but does not explain what they are.
Could anyone explain what mutators and accessors do and what they are?
Thanks in advance.
...
Hello, I'm using Doctrine 1.1.5 and I'd like to know if there is some option for remove table prefix from files and class names when calling Doctrine::generateModelsFromDb or Doctrine::generateModelsFromYaml.
Edit:
For example I have tables like mo_article, mo_language, mo_article_text, etc. When Doctrine generates the models (using th...
Hi,
I'm using doctrine and trying to validate some models.
I have the following in my YAML schema:
User:
package: User
columns:
username:
type: string
notnull: true
notblank: true
minlength: 4
password:
type: string
notnull: true
If I create a new user, it always validates, regardless o...
I am using Doctrine ORM for php and Zend MVC. I have a mysql database. When I insert into the database it is escaping quotes. In other-words when I enter
<input name="customer_name" value="Test'ed user"> ...
into my form, and assign to a doctrine object and save.
When I look at the database through the mysql command line I get
Tes...