I'm using a preDqlSelect() callback to add a "virtual field". But the validation of my query must be happening before the callback get fired because I can't order by that new field when I query that model.
Here's my callback:
class Artist extends BaseArtist
{
public function preDqlSelect(Doctrine_Event $event)
{
// Ad...
I have two tables. A users table and a profile table. The profile table has a foreign key of users_id. The models for the tables are set up with one to one relationships. When I try and save some data I get this error:
Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[23000]: Integrity constrai...
I'm having some issues with altering a table in the migrations of doctrine 2. Following code always throws the error: Operation 'Doctrine\DBAL\Platforms\AbstractPlatform::getAlterTableSQL' is not supported by platform.
This is strange as alter table is supported by sqlite.
public function up(Schema $schema)
{
$user = $schema->getTa...
Hi all,
I want to drop a foreign key in a doctrine 2 migration.
But there is no dropForeignKeyConstraint()
Does anybody know how to drop it?
...
I generated a custom theme by copying
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default"
into
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/mytheme1"
I changed the templates to match my needs (no tables, custom errors display and so on).
./symfony doctrine:generate-module --theme=mytheme1 frontend user...
Hi there,
does anyone know a way to write a Doctrine migration to change the Table Engine of a MySQL Database from MyISAM to InnoDB? Can this be managed via Migrations or do I have to this the old way via SQL-Statements?
...
In some circumstances Doctrine_Core::getTable('%Name%') returns
Doctrine_Table instance instead of %Name%Table one. It's obviously a bug, but are there other ways of getting Table-instances in doctrine besides Doctrine_Core::getTable('%Name%') ?
In order to give a demonstration of this improper behavior : here is schema of small issue
t...
Hi All ,
(i)
FROM User u
LEFT JOIN u.Phonenumbers where u.level > 1
What is u , I assume it is just an ALIAS to User ?
(ii)
$profile = Doctrine_Query::create()
->from('Profile p')
->innerJoin('p.User u')
->where('p.id = ?', 1)
->fetchOne();
What is p and u here ?
Need to quickly learn Doctrine ?
Please can anyone help ?...
I have a Group Entity with the following class member and mapping:
/**
* @ManyToMany(targetEntity="Group", cascade={"persist"})
* @JoinTable(name="groups_children",
* joinColumns={@JoinColumn(name="group_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="child_id", referencedColumnName="id", unique=t...
Hi,
for a doctrine model I'm making I don't always need to fetch all the columns I was hoping that I could solve this using
$query = Doctrine_Query::create()
->select('a');
if(!empty($value)){
$query->select('b');
}
$query->execute();
but this does not work...
Does anyone have a clue how this could be done?
...
I need to set environment specific table prefixes, so i found unperfect solution in inserting this in ProjectConfiguration::configureDoctrine(Doctrine_Manager $manager):
(config/ProjectConfiguration.class.php)
if (sfConfig::get('app_database_table_prefix')) {
$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT,
sfConfig::g...
My script is like this:
$query = Doctrine_Query::create ()
->select('count(p.product_id) as num_a')
->from ( 'ProductComments p' )
->groupBy('p.product_id')
->having('num_a =2 ');
And the generated sql is:
SELECT COUNT(i.product_id) AS i__0 FROM productcomments i GROUP BY i.product_id HAVING num_a=2
Thus I get...
Hi!
I have the following schema for the generation of a table/model class named Account:
Account:
actAs:
Timestampable: ~
SoftDelete:
name: deleted
type: boolean
columns:
branch_code:
type: integer
notnull: true
state_id:
type: integer
notnull: true
state_description:
ty...
Hi all.
I know it might seam slightly strange to user the admin generator.yml in the frontend but every page is either a list or an edit page and it's definitely the easiest things to do.
After struggling with writing a log in module i have installed sfDoctrineGuardPlugin and used the relations to link them to my main user table. Ever...
Product has many product images.
I want to grab a bunch of products, while only getting one product image each. What's the DQL syntax for that?
I'm using Doctrine 1.2.
...
I'm creating a behavior (one template and one listener). In the template class, I'm using the addListener() method to attach the listener to the model.
// Inside the template's setTableDefinition() method
$this->addListener(new RemoraSaveListener);
Pretty standard stuff, it seems.
From within the listener, how to I access the templa...
I'm trying to define conditions on relationships with Doctrine. Is it possible?
I mean something like this:
class User extends Doctrine_Record
{
public function setUp()
{
$this->hasMany('Article as ReallySpecialArticles', array(
'local' => 'id',
'foreign' => 'user_id',
'conditions' =...
I'm using Doctrine ORM 1.2 and Symfony 1.4 and I want to create method in myUser class which will extend Doctrine_Query instance passed as an argument with some additional left joins and conditions. The trick is that I don't always want these these left joins to be made with root component of the query and I need to know with what table ...
Hey All,
I'm contemplating the best way to implement the conditional permissions i.e. Users and Teams are m-to-m. But each Team also has a 1-to-m "Leader" relationship with the User table as well.
For simplicity sake, let's say we have two permission levels, "User" and "Admin". Then lets say, only certain Team administration task i.e. ...
I'm currently using Doctrine 1.2.2 with MySQL on the backend. When I attempt to retrieve a result set for more than one item using the record or lazy load hydration modes, only a single item shows up. However, when I use the array hydration mode, I see all of the results. Consistently, only the last item in the result set is retrieved.
...