[DC-1040] allow queries with table joins across different databases Created: 17/Nov/11  Updated: 17/Nov/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: 1.2.3

Type: Improvement Priority: Blocker
Reporter: Fabrice Agnello Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows XP SP3, Apache 2, PHP 5.3, MySQL 5.1.36, Symfony 1.4.8, Doctrine 1.2.3


Attachments: File Query.php    

 Description   

I'm currently working on a project which relies upon several databases declared in databases.yml in symfony 1.4.8.

I was facing an issue that has already been raised by other people, namely that you can't join tables which reference each other among different mysql databases.

I've dug a bit in the Doctrine_Query class and came to a solution that is acceptable for us, and allows now to make joins accross databases. Description follows :

first change is in the Doctrine_Core class, that gets stuffed with a new constant :
const ATTR_DATABASE_NAME = 0x1DB;

this constant allows us to add a new attribute to the databases.yml file as in :
gesdoc:
class: sfDoctrineDatabase
param:
dsn: mysql:host=127.0.0.1;dbname=gesdoc
username: root
password:
attributes:

  1. ************* NEW ATTRIBUTE BELOW ************
    database_name: gesdoc
    default_table_collate: utf8_general_ci
    default_table_charset: utf8

after that, a few changes have been done in the Doctrine_Query class which is attached to this issue for the sake of readability.

This may not be optimal, and probably need some regression testing, but it is currently working fine on our test server.

after this is done, I was able to issue queries like the following :
$x = DocumentTable::getInstance()->createQuery('d')
->distinct()
->leftJoin('d.Travail t')
->leftJoin('t.CdcIndInt ci')
->leftJoin('ci.CdcIndExt ce')
->leftJoin('ce.Cahierdescharge cdc')
->where('cdc.cdc_chro = ?', $cdc_chro)
->addWhere('d.id != ?', $document_id)
->execute();

where the referenced tables are in different databases. The necessary object binding has been done in every model class following the paradigm :

Doctrine_Manager::getInstance()->bindComponent('CdcIndInt ', 'gescdc');
abstract class BaseCdcIndInt extends sfDoctrineRecord
{
...
}

I don't know if this description is clear enough, so let me know if something is missing/wrong.






[DC-1025] Doctrine is unable to handle table names with spaces Created: 02/Aug/11  Updated: 02/Aug/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1, 1.2.2, 1.2.3
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: Daniel Borg Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP Version 5.2.14
Apache 2
MySQL
Windows Xp


Attachments: File doctrineTest.php     File tbl.php     File tbl_1.php    

 Description   

When trying to query a table which contains spaces I get the following exception

I have attached an simple example to reproduce

C:\Documents and Settings\daniel\Dokumenter\NetBeansProjects\test>php doctrineTest.php

Fatal error: Uncaught exception 'Doctrine_Query_Exception' with message 'Unknown table alias with' in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php:856
Stack trace:
#0 C:\Doctrine-1.2.3\Doctrine\Query.php(1022): Doctrine_Query_Abstract->getComponentAlias('with')
#1 C:\Doctrine-1.2.3\Doctrine\Query.php(1239): Doctrine_Query->_buildSqlFromPart()
#2 C:\Doctrine-1.2.3\Doctrine\Query.php(1133): Doctrine_Query->buildSqlQuery(true)
#3 C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php(958): Doctrine_Query->getSqlQuery(Array)
#4 C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
#5 C:\Documents and Settings\daniel\Dokumenter\NetBeansProjects\test\doctrineTest.php(18): Doctrine_Query_Abstract->execute()
#6

{main}

thrown in C:\Doctrine-1.2.3\Doctrine\Query\Abstract.php on line 856






[DC-1021] i am executing doctrine type query i am geting error please gave me reply Created: 24/Jul/11  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: cherukuri Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

windows ,wamp,php



 Description   

$query = new Doctrine_Query();
$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,c.country_id,c.country_name')
//$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,ea.Country')
->from('Entities e')
->leftJoin('e.EntityAddresses ea ON ea.entity_id = e.entity_id AND ea.address_type ="M"')
->leftJoin('ea.Country c ON ea.country = c.country_id')
->leftJoin('e.ActiveFactories s')
->where('e.status=1');
if(!empty($alpha))
{
$query->andWhere("e.entity_name like '".$alpha."%'");
}
$query->andWhere("s.company_id=".$parentId)
->andWhere("e.entity_type=2")
->andWhere('s.status=1')
->groupBy('e.entity_id');






[DC-962] Broken logic when doctrine translates limit's into subqueries, with joins. (with patch) Created: 02/Feb/11  Updated: 02/Feb/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: Ben Davies Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

All


Attachments: Text File Query.php.patch     Text File Tests.patch    

 Description   

Problem exists when Doctrine formulates a subquery to perform a limit when a join in included.

The problem is that the where clause that doctrine creates for the subquery (the WHERE IN clause) is inserted as the first where clause.
This will break the parameter duplicate done at Doctrine_Query_Abstract:969, as the order of the parameters is now wrong.

Consider:

 
select * from table
join metadata WITH c = ?
where a = ? and b = ?
limit 1

with parameters be (1, 2, 3)

Doctrine will translate this to

 
select * from table
join metadata WITH c = ?
where table.id IN (
    select id from table
    join metadata WITH c = ?
    where a = ? and b = ?
    limit 1
)
and a = ? and b = ?

Doctrine will duplicate the params (Doctrine_Query_Abstract:969) to (1, 2, 3, 1, 2, 3), but now they are in the wrong order completely.
They should be (1,1,2,3,2,3).

The easy fix is to move the limit subquery to the LAST where clause, which would reuslt in a query like so:

 
select * from table
join metadata WITH c = ?
where a = ? and b = ?
and table.id IN (
    select id from table
    join metadata WITH c = ?
    where a = ? and b = ?
    limit 1
)

Attached is a patch to fix this issue, along with a patch that fixes all unit tests referring to the old query format.



 Comments   
Comment by Ben Davies [ 02/Feb/11 ]

upping to blocker since this breaks very basic queries





[DC-701] Aggregates functions do not return proper values when using many relationships and limits Created: 24/May/10  Updated: 17/Apr/14

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: will ferrer Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

XP Xamp


Attachments: Text File DC_701_adds_disbaleLimitSubquery_testcase.patch     Text File DC_701_adds_hydrateArrayShallow_testcase.patch     Text File DC_701_fix_adds_arrayShallow.patch     Text File DC_701_fix_adds_disableLimitSubQuery.patch    

 Description   

Hi All

I have encountered a problem that seems very core to the way that doctrine works – if you apply an aggregate function to a column in a table and then join to another table via a many relationship while also using a limit, like so:

$q = Doctrine_Query::create();
$q->from('Customer Customer'); 
$q->addSelect('COUNT(Customer.id) as COUNT_customer_id');
$q->addSelect('Customer_Order.id as order_id'); 
$q->leftJoin('Customer.Order Customer_Order'); // Many relationship here
$q->limit(20);

It produces this correct DQL:

SELECT COUNT(Customer.id) as COUNT_customer_id, Customer_Order.id as order_id 
FROM Customer Customer 
  LEFT JOIN Customer.Order Customer_Order 
LIMIT 20

However the SQL it produces will not return an accurate count – the count is restricted by the limit:

SELECT COUNT(p.id) AS p__0, p2.id AS p2__1 
FROM product_customers p 
  LEFT JOIN product_orders p2 ON p.id = p2.customer_id 
WHERE p.id IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20')

This produces a count of 21 instead of what it should be (1000).

The reason for this is because Doctrine's internal functionality does an intermediary query where it gets gets the ids needed from the customer table in order to use them as the IN portion of the constraints on the final query – like so:

SELECT DISTINCT p3.id FROM product_customers p3 LIMIT 20

It may seem strange that I am applying a limit to a query which will aggregate to 1 to row . In the actual queries that alerted me to this problem I am using a group by. The reason I am not reporting this bug with a group by in my example however is that you can not use a group by with a many relationship and a limit in doctrine 1.2.2 as it works currently (see bug: DC-594). However I am personally able to use a limit with a group by and many relationship since I am using a version of the code I patched my self to repair bug DC-594.

Here is my sample schema in case its helpful.

detect_relations: false
package: Example
options:
  type: INNODB
  charset: utf8
Order:
  tableName: orders
  columns:
    order_id:
      type: integer(4)
      primary: true
      notnull: true
    customer_id:
      type: integer(4)
    order_date: timestamp
  relations:
    Customer:
      type: one
      local: customer_id
      foreign: customer_id
  options:
    type: InnoDB
Customer:
  tableName: customers
  columns:
    customer_id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    firstname:
      type: string(45)
    lastname:
      type: string(45)
    streetaddress:
      type: string(45)
    city:
      type: string(45)
    state:
      type: string(45)
    postalcode:
      type: string(45)
  relations:
    Order:
      type: many
      local: customer_id
      foreign: customer_id
  options:
    type: InnoDB

Thanks much.

Will Ferrer

edit: split SQL code to make the discussion readable without huge horizontal scrolling...



 Comments   
Comment by Jonathan H. Wage [ 08/Jun/10 ]

Is this still a problem? I am not sure if this can be patched easily. The limit subquery algorithm is flawed deeply but also a core part of the current way Doctrine 1 works.

Comment by will ferrer [ 08/Jun/10 ]

Hi Jon

This bug is still an issue for me but I think it may be VERY hard to patch since it seems very core to the way Doctrine 1 works.

The project I am working on at the moment is a visual query builder that is highly reliant on Doctrine. In order to prevent users from making queries that would trigger this bug I am currently giving an alert when ever a query that would trigger this bug is created.

It would be great if this were patchable but if not I should be able to get by.

Does Doctrine 2 fix this problem?

Thanks for the help.

Will Ferrer

Comment by Jonathan H. Wage [ 08/Jun/10 ]

In Doctrine 2 the limit subquery algorithm does not exist. It is now up to the developer to write the query to handle the scenario instead of Doctrine "trying" to automate it for you. Since the situation where it is needed it is so rare, and each case can be slightly different it is better to let the developer handle it in those cases.

Comment by will ferrer [ 08/Jun/10 ]

Hi Jon

Does that mean that Doctrine 2 can no longer intelligently handle limits with many relationships, and doesn't have the ability to hydrate a return with sub arrays in it for many relationships?

Thanks again for your help.

Will Ferrer

Comment by Jonathan H. Wage [ 09/Jun/10 ]

That is correct. We do not automatically try and limit the relationships with a "limit subquery" as it causes more problems then it helps.

Comment by will ferrer [ 10/Jun/10 ]

Hi Jon

I was thinking about what you said here – that the "limit subquery" causes more harm than good. It occur to me that I really do like being able to use this method (it comes in very handy very often) but some times it would really help to be able to turn it off (the bug in this thread is a good example such a time). So I figured why not just make an option to turn it off and have the best of both worlds? I looked at the code and found it was really very easy to put in a property which can be set on the query object to enable or disable the use of the limit subquery.

I made the change in my code base and found it very useful for several situations I was dealing with in my own project.

The one thing I couldn't do is make a test case for this new feature – I couldn't find an existing test case that was actually triggering the limit subquery as I understood it to work (I couldn't find a test case that would put an WHERE IN constraint with all the ids gathered in the limit subquery. I tried some test cases that I THOUGHT would activate this feature but it didn't seem that they did).

After adding this feature to my code base I also wanted a new hydrator – one that worked like scalar but would put in array key names that were the same as the ones you would see in HYDRATE_ARRAY. I noticed that HYDRATE_SCALAR already had the ability to do this but it required that a value of false be passed into the $aliasPrefix argument of the _gatherRowData function. I made a custom hydrator I call HYDRATE_ARRAY_SHALLOW that passes in this false value. I then realized this might be handy to add to doctrine so I integrated it into my code base and made a few test cases for it.

There are 2 patches I am now attaching this to thread:

disableLimitSubquery_2010-06-10_Doctrine_1.2_SVN.patch – this patch adds the disableLimitSubquery property to query objects so that users can turn off the use of the subquery for those times when they don't want to use that behavior (fixing the bug in this thread and probably others)

and

disableLimitSubquery_and_HYDRATE_ARRAY_SHALLOW_2010-06-10_Doctrine_1.2_SVN.patch – this is the same as the first patch but also contains the HYDRATE_ARRAY_SHALLOW hydration type I mentioned above (which tends to go well with disableLimitSubquery turned on).

I put these in 2 patches incase you liked 1 feature but disliked the other.

If you like either of this features I would be very happy to see them added to doctrine.

Also if you have any advice on how to improve these features (or info on how to make a good test case for disableLimitSubquery) please let me know.

Hope you are well.

Will Ferrer

Comment by will ferrer [ 10/Jun/10 ]

Reopened because I added a patch that I think in essence fixes the issues.

Comment by Jonathan H. Wage [ 01/Sep/10 ]

Thanks for the issue and patches.

Fixed here http://github.com/doctrine/doctrine1/commit/2ad78e62e360133efc04bf6897bf679c7f3d833b

Comment by will ferrer [ 01/Sep/10 ]

individual patch for this issue with out other features included

Comment by will ferrer [ 01/Nov/10 ]

adding test cases for these features

Comment by will ferrer [ 01/Nov/10 ]

reopened because I posted some test cases to add to doctrine along with the patchs previously posted





[DC-1058] Warning: Invalid argument supplied for foreach() in SqlWalker.php line 899 Created: 29/Jul/12  Updated: 29/Jul/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Alexander Cucer Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: paginator
Environment:

Linux, Ubuntu 12, php 5.4



 Description   

Hallo, i get the error
Warning: Invalid argument supplied for foreach() in /var/www/phverbose/vendor/doctrine/Doctrine/ORM/Query/SqlWalker.php line 899

Here is the line
foreach ($assoc['relationToTargetKeyColumns'] as $relationColumn => $targetColumn) {

Here are the relations and the query
http://pastie.org/4352511
http://pastie.org/4352498

Here is the dump of $assoc before warning

array(16) {
["fieldName"]=>
string(5) "sites"
["joinTable"]=>
array(0) {
}
["targetEntity"]=>
string(13) "Entities\Site"
["mappedBy"]=>
string(6) "emails"
["inversedBy"]=>
NULL
["cascade"]=>
array(1)

{ [0]=> string(7) "persist" }

["orphanRemoval"]=>
bool(false)
["fetch"]=>
int(2)
["type"]=>
int(8)
["isOwningSide"]=>
bool(false)
["sourceEntity"]=>
string(14) "Entities\Email"
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(true)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
}






[DC-1052] limit() get lost on multiple joins Created: 20/Mar/12  Updated: 20/Mar/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Michael Kempf Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

$strSql = UserFeedTable::getInstance()>createQuery('q')>
select('q., f., fi., fav.')->
leftJoin('q.Feed f')->
leftJoin('f.FeedItem fi')->
leftJoin('fi.Favorite fav')->
andWhere('q.profile_id = ?', $intUserId)->
andWhere('q.is_active = ?', true)->
limit(10)->getSqlQuery();
var_dump($strSql);

string(1075) "SELECT u.id AS u_id, u.name AS uname, u.image AS uimage, u.lead AS ulead, u.headline AS uheadline, u.sort AS usort, u.is_active AS uis_active, u.is_favorite AS uis_favorite, u.feed_id AS ufeed_id, u.profile_id AS uprofile_id, u.category_id AS ucategory_id, u.created_at AS ucreated_at, u.updated_at AS uupdated_at, f.id AS fid, f.url AS furl, f.name AS fname, f.created_at AS fcreated_at, f.updated_at AS fupdated_at, f2.id AS f2id, f2.lead AS f2lead, f2.description AS f2description, f2.image AS f2image, f2.pub_date AS f2pub_date, f2.link AS f2link, f2.feed_id AS f2feed_id, f2.created_at AS f2created_at, f2.updated_at AS f2updated_at, f3.id AS f3id, f3.profile_id AS f3profile_id, f3.feed_item_id AS f3feed_item_id, f3.created_at AS f3created_at, f3.updated_at AS f3_updated_at FROM user_feed u LEFT JOIN feed f ON u.feed_id = f.id LEFT JOIN feed_item f2 ON f.id = f2.feed_id LEFT JOIN favorite f3 ON f2.id = f3.feed_item_id WHERE u.id IN ('7', '8', '9', '10', '11') AND (u.profile_id = ? AND u.is_active = ?)"

As you can see, the limit is missing.






[DC-932] Queries fail when a model contains underscore and we try to apply a limit Created: 19/Nov/10  Updated: 19/Nov/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Noel GUILBERT Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Doctrine 1.2, Symfony 1.4.6, MySQL, Postgresql



 Description   

Actually, I've a dead simple schema.yml, with two tables:

T_Media:
actAs:
Timestampable: ~
columns:
media_id:

{ type: integer, primary: true, autoincrement: true }

name: string(25)

J_Acl:
columns:
media_id: integer
relations:
Media:

{ class: T_Media, local: media_id, foreign: media_id, onDelete: CASCADE }

I have some fixtures:
T_Media:
m1:
name: foobar

J_Acl:
a1:
Media: m1

And then, the DQL query I want to execute:

"From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1"

But if I run this query, for instance in CLI, I got an error:
./symfony doctrine:dql "From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1"

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test_noel.t2__media' doesn't exist.
Failing Query: "SELECT DISTINCT t2.media_id FROM t2_media t2 INNER JOIN j2_acl j2 ON t2.media_id = j2.media_id ORDER BY t2.created_at LIMIT 1"

Notes:

  • the query works if I do not apply the limit clause.
  • if I remove the underscore from the model, or if I set manually the tableName to remove the double underscore, it works





[DC-802] Alias in select and having Created: 28/Jul/10  Updated: 07/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Vasiliy Altunin Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows XP sp3



 Description   

i have query

$q = Doctrine_Query::create()
->select('g.,gp.,st.,np.,v.,s.,max(gp.card_date) as md')
->from('gragdans as g')
->innerJoin('g.Pribs_ gp')
->leftJoin('gp.Streets_ st')
->leftJoin('gp.Viddocs_ v')
->leftJoin('gp.Sobits_ s')
->leftJoin('st.Npunkts_ np')
->where('g.grid in '.$idlst,1)
->orderby('fam')
->having('gp.card_date=md');

When it runs i have error:

<b>Fatal error</b>: Uncaught exception
'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]:
Column not found: 1054 Unknown column 'md' in 'having clause'' in Z:
\home\new\www\system\application\plugins\doctrine\lib\Doctrine
\Connection.php:1082

SQL for it looks like:

SELECT g.grid AS g_grid, g.fam AS gfam, g.nam AS g_nam, g.otc AS
g_otc, g.date_rogd AS gdate_rogd, g.gosgrid AS g_gosgrid,
g.rogd_place AS g_rogd_place, g.pol AS g_pol, g.reg_date AS
g_reg_date, g.deesp AS gdeesp, p.pribid AS p_pribid, p.grid AS
p_grid, p.strid AS pstrid, p.hom AS phom, p.cor AS p_cor, p.kva
AS p_kva, p.reg_date AS preg_date, p.vidid AS p_vidid, p.pas_ser
AS p_pas_ser, p.pas_no AS ppas_no, p.org_name AS p_org_name,
p.pas_date AS p_pas_date, p.sobid AS p_sobid, p.reg_expire AS
p_reg_expire, p.card_date AS pcard_date, s.strid AS s_strid,
s.npid AS s_npid, s.name AS sname, v.vidid AS v_vidid, v.name AS
v_name, s2.sobid AS s2sobid, s2.cod_s AS s2_cod_s, s2.cod_oi AS
s2_cod_oi, s2.name AS s2name, n.npid AS nnpid, n.name AS n_name,
n.sid AS n_sid, MAX(p.card_date) AS p_0 FROM gragdans g INNER JOIN
prib p ON g.grid = p.grid LEFT JOIN streets s ON p.strid = s.strid
LEFT JOIN viddoc v ON p.vidid = v.vidid LEFT JOIN sobit s2 ON p.sobid
= s2.sobid LEFT JOIN npunkt n ON s.npid = n.npid WHERE (g.grid in (4,
13, 19, 20)) HAVING p.card_date=md ORDER BY g.fam

But i need Query looks like:

SELECT g.grid AS g_grid, g.fam AS gfam, g.nam AS g_nam, g.otc AS
g_otc, g.date_rogd AS gdate_rogd, g.gosgrid AS g_gosgrid,
g.rogd_place AS g_rogd_place, g.pol AS g_pol, g.reg_date AS
g_reg_date, g.deesp AS gdeesp, p.pribid AS p_pribid, p.grid AS
p_grid, p.strid AS pstrid, p.hom AS phom, p.cor AS p_cor, p.kva
AS p_kva, p.reg_date AS preg_date, p.vidid AS p_vidid, p.pas_ser
AS p_pas_ser, p.pas_no AS ppas_no, p.org_name AS p_org_name,
p.pas_date AS p_pas_date, p.sobid AS p_sobid, p.reg_expire AS
p_reg_expire, p.card_date AS pcard_date, s.strid AS s_strid,
s.npid AS s_npid, s.name AS sname, v.vidid AS v_vidid, v.name AS
v_name, s2.sobid AS s2sobid, s2.cod_s AS s2_cod_s, s2.cod_oi AS
s2_cod_oi, s2.name AS s2name, n.npid AS nnpid, n.name AS n_name,
n.sid AS n__sid, MAX(p.card_date) AS md FROM gragdans g INNER JOIN
prib p ON g.grid = p.grid LEFT JOIN streets s ON p.strid = s.strid
LEFT JOIN viddoc v ON p.vidid = v.vidid LEFT JOIN sobit s2 ON p.sobid
= s2.sobid LEFT JOIN npunkt n ON s.npid = n.npid WHERE (g.grid in (4,
13, 19, 20)) group by fam HAVING p.card_date=md

This query run fine and give me what i need.

Doctrine dont use 'md' alias instead it convert it to 'p__0'






[DC-747] Sequence name of build process is different to the one used in UnitOfWorks (based on DC521 with updated TestCase) Created: 17/Jun/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Enrico Stahn Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

doctrine 1.2.4, symfony 1.4, snow leopard, php 5.3.1, postgresql 8.3


Attachments: File DC747TestCase.php    

 Description   

I moved our project from doctrine 1.2.1 to 1.2.4. The build process stops because of this patch. We are using primary keys with an alias. It seems that the generation of the sequence name in the build-process is different to the one used in UnitOfWorks.

Example:

Authority:
columns:
a_id:

{ name: a_id as id, type: integer, primary: true, autoincrement: true }

name:

{ type: string }

This will generate a sequence called "authority_a_id", but it will try no "currval" the sequence "authority_id".

I'll try to provide a UnitTest. The current seems broken.

php -l Ticket/DC521TestCase.php
PHP Parse error: syntax error, unexpected $end, expecting T_FUNCTION in Ticket/DC521TestCase.php on line 143

Parse error: syntax error, unexpected $end, expecting T_FUNCTION in Ticket/DC521TestCase.php on line 143
Errors parsing Ticket/DC521TestCase.php



 Comments   
Comment by Enrico Stahn [ 17/Jun/10 ]

Here is the test updated with the current ticket number.

Comment by Enrico Stahn [ 17/Jun/10 ]

Updated. Now it should work/not work as expected.

Comment by Enrico Stahn [ 17/Jun/10 ]

This isn't a blocker anymore because of the workaround i've found.

  • remove autoincrement
  • add sequence name manually

Example:

Authority:
columns:
a_id:

{ name: a_id as id, type: integer, primary: true, sequence: authority_a_id }

name:

{ type: string }




[DC-690] Wrong data type for oracle integer Created: 18/May/10  Updated: 08/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Arian Maykon de Araújo Diógenes Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Trying to migrate from doctrine 1 to 1.2 and this problem came up to me, i cant map a column to integer(7) (which should create a number(7) column) using Oracle, he always create a NUMBER(20) field.

Taking a look at Doctrine_DataDict_Oracle i realize the problem is here.



 Comments   
Comment by Jonathan H. Wage [ 08/Jun/10 ]

We made a bunch of changes/fixes related to oracle. This was to fix another bug I believe. I can't remember the user that is responsible for these changes. Does anyone else remember or know anything?





[DC-1054]  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.title' in 'field list' Created: 31/Mar/12  Updated: 31/Mar/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: suriyakala Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

window vista



 Description   

this is the my table creation .

CREATE TABLE billboard(id BIGINT AUTO_INCREMENT,title VARCHAR (255),country_id BIGINT,zone_id BIGINT,place VARCHAR(255),occassion VARCHAR(255),itinerary VARCHAR(255),created_at DATETIME NOT NULL,description TEXT NOT NULL,PRIMARY KEY(id)) ENGINE=INNODB;

public static function getInstance()

{ return Doctrine_Core::getTable('Billboard'); }

this is the my Doctrine Table

// public function getBillboardsForAUser($userId, $limit, $offset=0)
public function getBillboardsForAUser($userId,$limit,$offset=0)
{
$query = $this->createQuery('b')
->where('b.title=?',$title);
// ->where('b.owner_id = ?', $userId);
$followings = Doctrine::getTable('Follow')->getAllFollowing($userId);
foreach($followings as $following)

{ $query->orWhere('b.owner_id = ? ',$following->getOwnerId()); $query->orWhere('b.poster_id = ? ',$following->getOwnerId()); }

$query->orderBy('b.created_at DESC')
->limit($limit)
->offset($offset);
return $query->execute();

}

plz help me what is the problem.



 Comments   
Comment by Benjamin Eberlei [ 31/Mar/12 ]

Doctrine 1, not 2 ticket.





[DC-1046] Connection MSSQL replaceBoundParamsWithInlineValuesInQuery Created: 15/Dec/11  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Peter Eisenberg Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Revision: 104


Attachments: Text File replaceBoundParamsWithInlineValuesInQuery.patch    

 Description   

Hello,

We found a bug in Doctrine1 MSSQL Connection.
When you would like to use the following functionality: find(One)By(p1,p2)
if you use the old functionality (Symfony 1.4 support it) like this: findBy("idAnddata", array("id" => ..., "date" => ..)), you got an MSSQL error, because the values wasn't changed.

Please find the patch for it, I hope it helps to you as well.

Kind regards
Peter



 Comments   
Comment by Peter Eisenberg [ 15/Dec/11 ]

Small changes:
Unfortunately the notice wasn't set in my test environment, and I didn't realized this small error:

please use the following instead of the original:
$replacement = 'is_null(\$value) ? \'NULL\' : \$this->quote(\$params[\'\\1\'])';

another case you got the following error: Use of undefined constant xxx - assumed xxx.

Kind regards,
Peter





[DC-1043] Error:"When using..ATTR_AUTO_ACCESSOR_OVERRIDE you cannot.. name "data" ..." when running doctrine:build-schema ... except I'm NOT using that word Created: 30/Nov/11  Updated: 01/Dec/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Maurice Stephens Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Mac OSX 10.6.8 running MAMP Pro 2.0.5 with PHP 5.3.6 ... this is a local symfony install which is also using the apostrophe cms.



 Description   

Was able to resolve this - see comment below - but still think it counts as a bug since the source of the error is so unclear

Hello,
I'm familiarizing myself with symfony at this point, but doctrine seems like a very accessible ORM tool overall. This install will also use the apostrophe plugin though that is more a client request and it is seeming to complicate a lot of issues from what I can see. Right now, I am just trying to create some db tables in schema.yml and build them with doctrine. When running $ php symfony doctrine:build-schema I get the following error: When using the attribute ATTR_AUTO_ACCESSOR_OVERRIDE you cannot use the field name "data" because it is reserved by Doctrine. You must choose another field name.

Which would be clear enough except I'm NOT using "data" as a field name in my schema file: here's what I'm using:

sfTravelLodgingLocationsType:
columns:
lodging_name:

{ type: string(255) }

lodging_code:

{ type: string(255) }

sfTravelLodgingLocations:
columns:
lodging_type_code:

{ type: integer, notnull: true }

name:

{ type: string(255), notnull: true }

address:

{ type: string(255), notnull: true }

city:

{ type: string(255), notnull: true }

distance:

{ type: integer, notnull: true }

phone:

{ type: string(255), notnull: true }

known_2b_sold_out:

{ type: boolean, notnull: true, default: 0 }

relations:
Travel_Lodging_LocationsType:

{ local: type_id, foreign: id }

I'm assuming this is a misnamed error call ... I have found a few references to that same error in other threads but none that resolve it



 Comments   
Comment by Maurice Stephens [ 01/Dec/11 ]

I was able to find a way to override the ATTR_AUTO_ACCESSOR_OVERRIDE with a method in the appConfiguration.class.php file

based on this thread ... http://stackoverflow.com/questions/7266293/attr-auto-accessor-override

But it is still a difficult error to troubleshoot ... not clear on what the reserved keyword "data" had to do with it ... considering I wasn't even using it in the schema

Would be interested in finding some resources that go into detail on the implications of the command line context that symfony relies on





[DC-1038] Missing Foreign Key Constraint in SQL Created: 24/Sep/11  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Stephan Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

I have the problem, that a foreign key constraint is not created in the SQL schema. This occurs, when the primary key is not the column 'id'.

Here is an example:

User:
columns:
username:
type: string(30)
notnull: false
email:
type: string(80)
notnull: true
gender:
type: enum
values: [0,m,f]
notblank: true
notnull: true
birthday:
type: date

Address:
columns:
user_id:
type: integer(4)
unsigned: 1
notnull: true
primary: true
some_data:
type: string(100)
relations:
User:
local: user_id
foreign: id
foreignType: one

The foreign key from contacts to users is not created in der SQL schema. But if I delete the attribute 'primary' at the column 'user_id' (and a primary key 'id' will generated), everything is okay.

Can you help me please?

With kind regards
Stephan






[DC-1033] [PATCH] Use multibyte version of strtolower Created: 28/Aug/11  Updated: 28/Aug/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Jonas Flodén Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.3.7, Symfony 1.4.13


Attachments: Text File 0001-Use-multibyte-version-of-strtolower.patch    

 Description   

While trying to develop a new Symfony frontend to an existing database - whcih unfortunately contains non-ascii character names - I ran into a lot of problems where non-ascii characters had been mangled.
After installing XDebug and digging into the issue I found that the use of strtolower on the column names was the issue, since it's not safe to use on UTF-8 strings.
I replaced all calls to strtolower with mb_strtolower and UTF-8 encoding which solved my issue. I don't know if that is the correct way of doing it or if there is a better way.
I saw one other use of mb_strtolower in doctrine and it was guarded with an if function exists... Also it might be an issue in other files as well...
I provide my patch file incase it is of any use.



 Comments   
Comment by Jonas Flodén [ 28/Aug/11 ]

Here is a Git pull request with the same patch:
https://github.com/doctrine/doctrine1/pull/39





[DC-1023] i am executing doctrine type query i am geting error please gave me reply my query i am typed in descrition field Created: 24/Jul/11  Updated: 26/Jul/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: cherukuri Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

$query = new Doctrine_Query();
$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,c.country_id,c.country_name')
//$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,ea.Country')
->from('Entities e')
->leftJoin('e.EntityAddresses ea ON ea.entity_id = e.entity_id AND ea.address_type ="M"')
->leftJoin('ea.Country c ON ea.country = c.country_id')
->leftJoin('e.ActiveFactories s')
->where('e.status=1');
if(!empty($alpha))
{
$query->andWhere("e.entity_name like '".$alpha."%'");
}
$query->andWhere("s.company_id=".$parentId)
->andWhere("e.entity_type=2")
->andWhere('s.status=1')
->groupBy('e.entity_id');






[DC-1024] i am executing Created: 22/Jul/11  Updated: 26/Jul/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: cherukuri Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

$query = new Doctrine_Query();
$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,c.country_id,c.country_name')
//$query->select('e.entity_name,e.entity_id,s.id,s.parent_id,e.ffc_entity_id,ea.Country')
->from('Entities e')
->leftJoin('e.EntityAddresses ea ON ea.entity_id = e.entity_id AND ea.address_type ="M"')
->leftJoin('ea.Country c ON ea.country = c.country_id')
->leftJoin('e.ActiveFactories s')
->where('e.status=1');
if(!empty($alpha))

{ $query->andWhere("e.entity_name like '".$alpha."%'"); }

$query->andWhere("s.company_id=".$parentId)
->andWhere("e.entity_type=2")
->andWhere('s.status=1')
->groupBy('e.entity_id');






[DC-1002] Typos in filename and php tags Created: 02/May/11  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: nervo Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Two typos in Doctrine files prevents usage of symfony core_compile.yml system, or any similar compiler system :

  • According to its class name, "Doctrine_Validator_HtmlColor", the file "Doctrine/Validator/Htmlcolor.php", should be named "HtmlColor.php" (note the uppercase "C" of "Color")
  • The php tag of the file "Doctrine/Locking/Exception.php" is uppercased. It should be "<?php" instead of "<?PHP"





[DC-982] Options for building models aren't forwarded from CLI to Manager instance Created: 04/Mar/11  Updated: 04/Mar/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Maciej Strzelecki Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I.e.: generate_models_options and classPrefix option isn't forwared from CLI configuration to create table task (which uses the Manager's options).






[DC-966] Default Order By incorrectly propagating to relations Created: 12/Feb/11  Updated: 12/Feb/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jason Yang Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 7 WAMP, PHP 5.3, MySQL 5.1.36, Apache 2.2.11



 Description   

Symfony Version 1.4.9 ORM: Doctrine

Schema.yml:

Table1:
actAs:
Timestampable: ~
options:
orderBy: sort_order ASC
columns:
name:

{ string(255), notnull: true }

sort_order:

{ string(255), notnull: true }

Table2:
columns:
table1_id:

{ integer, notnull: true }

value:

{ string(255), notnull: true }

relations:
Table1:

{ local: table1_id, foreign: id, foreignAlias: Table2 }

This generates models and I can see the following: BaseTable?1.class.php: $this->option('sort_order', 'sort_order ASC');

BaseTable?2.class.php: No option for sort_order

But when I run the following, I get errors: Doctine::getTable('Table1')>createQuery('t')>leftJoin('t.Table2 t2').execute();

Error: Column not found: 1054 Unknown column 't2.sort_order' in 'order clause'

Looking at the sql executed, it included t1.sort_order ASC, but also incorrectly added t2.sort_order ASC as well even though it was never defined anywhere.

I am unsure if this is a Doctrine problem or a symfony one, so I will post i on both bug tracking systems.






[DC-957] MSSQL doctrine inner join group by problem Created: 20/Jan/11  Updated: 20/Jan/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mehmet Uysal Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

mssql, doctrine 1.2.3 , symfony



 Description   

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/dql-doctrine-query-language/en#group-by,-having-clauses

$q = Doctrine_Query::create()
->select('u.username')
->addSelect('COUNT(p.id) as num_phonenumbers')
->from('User u')
->leftJoin('u.Phonenumbers p')
->groupBy('u.id');

SELECT
u.id AS u__id,
u.username AS u__username,
COUNT(p.id) AS p__0
FROM user u
LEFT JOIN phonenumber p ON u.id = p.user_id
GROUP BY u.id

i should create

SELECT
COUNT(p.id) AS p__0
FROM user u
LEFT JOIN phonenumber p ON u.id = p.user_id
GROUP BY u.id

MSSQL doesnt support this use of group by sql. Id have to be in aggregrate function or group by. I do not need id but doctrine creates it in sql.

"invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."






[DC-954] tinyint(1) with default value in schema.yml generates blank default value, gives SQLSTATE[42000] Created: 09/Jan/11  Updated: 09/Jan/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Colin Stuart Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Win7 64-bit
Netbeans 6.9.1
Symfony 1.4.8



 Description   

doing a
doctrine:build --all --and-load
with a schema.yml of

Foo:
tableName: foo
options:
charset: utf8
columns:
bar:
type: tinyint(1)
default: 0

results in a blank value generated for the default keyword, and the following error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ENGINE = INNODB' at line 1. Failing Query: "CREATE TABLE foo (id BIGINT AUTO_INCREMENT, bar tinyint(1) DEFAULT , PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ENGINE = INNODB". Failing Query: CREATE TABLE foo (id BIGINT AUTO_INCREMENT, bar tinyint(1) DEFAULT , PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ENGINE = INNODB

I've also tried combinations of tinyint, tinyint(4), single-quoting the default value, and different default values.

Changing the type to int makes the issue disappear






[DC-953] Doctrine fails when using link() on OneToMany because of failing save Created: 04/Jan/11  Updated: 04/Jan/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Buster Neece Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.2.10, MySQL database connection


Attachments: File test.php     File test.yml    

 Description   

I have continually run into a very particular bug when using OneToMany relationships between Doctrine tables. When attempting to call "link()" to generate a relationship between records in related tables, Doctrine attempts to set the ID of the "one" portion of the record to 0, then save it.

This is best demonstrated by the sample YML and PHP that I have attached. It establishes a OneToMany relationship where the "one" table has another foreign key constraint. This causes the DB to trigger a foreign key constraint error when Doctrine tries to set the ID to 0, making the error easier to see.

From looking into the relevant sections of the codebase, the following appears to be happening:

  • Calling "link" properly adds the relationship to the "many" record.
  • Calling "save" triggers the saving of the "many" record and all associated records.
  • With the "one" record now listed as an associated record, its own "save" function is called as a result.
  • Its "save" function works properly, except that for some reason, the ID key is not present in the $_data internal array (but oddly is present in the $_id array, allowing it to be returned in other places).
  • Seeing a difference, Doctrine attempts to execute an "UPDATE" query setting the ID to 0.

I've made it this far in looking into it, but for the life of me I can't figure out what is triggering the identifier being reset in this case. I should note, however, that it happens consistently in every such situation on every server I've tested it on.



 Comments   
Comment by Buster Neece [ 04/Jan/11 ]

Further research into the issue has revealed the exact area where the problem is being caused:

Doctrine_Collection (272): Function "setReference", called from Doctrine_Relation_ForeignKey (80).

For each of the elements in the collection (in this case, the related items), that function is setting the "reference field" value to the record being related to. Apparently, it's getting the field names confused, because it's overwriting "id" with a reference to the entire related object, which has a different ID.

I can't tell if this is only an issue when both the relation tables use the same identifier ("id"), but this is surely common enough to warrant a fix.





[DC-951] Error in generating the field size and error in the generation of the date fields for postgres Created: 24/Dec/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: fernando guerrero Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

apacha2, linux, Symfony 1.4



 Description   

collaboration of vtamara@pasosdejesus.org and jeronimo0000@gmail.com

While we developed a tool with symfony 1.4 and postgresql database we found errors in the generated schema.yml which I describe below

1 - Error in generating of field size of varchars
2 - Error in the generation of date fields

We found the following solution

— Doctrine/Import/Pgsql.php.orig 2010-12-23 17:48:00.160271000 -0500
+++ Doctrine/Import/Pgsql.php 2010-12-23 18:01:59.252271002 -0500
@@ -168,11 +168,14 @@
$columns = array();
foreach ($result as $key => $val) {
$val = array_change_key_case($val, CASE_LOWER);

  • if (strtolower($val['type']) === 'character varying') {
    + if (strtolower($val['type']) === 'varchar') { // get length from varchar definition $length = preg_replace('~.*\(([0-9]*)\).*~', '$1', $val['complete_type']); $val['length'] = $length; }

    + if ($val['type'] == 'date')

    { + $val['type'] = $val['complete_type'] = 'timestamp'; + }

$decl = $this->conn->dataDict->getPortableDeclaration($val);






[DC-942] fromArray makes unnessesary cals to database Created: 03/Dec/10  Updated: 03/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ivo Võsa Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If I do toArray(true) on record with realtions and later fromArray($array, true) on with same data unnessesary calls to database are made.

$message = new Message();
$message->Sender = new User(); // if i leave out this line sender will first get loaded from database and then overwritten with provided data
$message->Receiver = new User();   // if i leave out this line receiver will first get loaded from database and then overwritten with provided data
$message->fromArray($data);

In Doctrine_Record::fromArray()

if ($deep && $this->getTable()->hasRelation($key)) {
    if ( ! $this->$key) {                                           --> data gets loaded from db here, refreshRelated is not even executed.
        $this->refreshRelated($key);
    }
...
}

Is this desired behavour? Wouldnt it be smarter to create empty object automaticly instead of loading it from db?
Also have look at http://trac.doctrine-project.org/ticket/1434






[DC-939] Patch for Doctrine ..... to identify in some cases autoincremented fields in oracle Created: 25/Nov/10  Updated: 24/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Edwin Alexander Herrera Saavedra Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP Version 5.2.4-2ubuntu5.10
Copyright (c) 1997-2007 The PHP Group
Oracle database 10gR2
Symfony 1.4.4



 Description   

Patch for Doctrine ..... to identify in some cases autoincremented
fields.
[Solution found thanks to Vladimir Tamara - vtamara AT pasosdejesus DOT org]

Doctrine/Import/Oracle.php

// Heuristic to check autoincremented fields.
// We check if there is a trigger on the field.
// We could also check if there is a sequence on the field.
// Side effect: slower generation of scheme
$q = "SELECT * FROM all_trigger_cols WHERE
table_name='$table' AND column_name='" . $val['column_name'];

$res2 = $this->conn->fetchColumn($q);
if (count($res2) > 0)

{ $descr[$val['column_name']]['autoincrement'] = true; }

}

return $descr;



 Comments   
Comment by Edwin Alexander Herrera Saavedra [ 24/Dec/10 ]

when new tables are created, the auto-increment is shown in all fields of the table in the schema, to avoid this problem has generated the following improvements to a validation of the auto-increment column is only when the primary key

Solution found thanks to
Vladimir Tamara - vtamara AT pasosdejesus DOT org
and Alexander Herrera

if($descr[$val['column_name']]['primary']==1){
// Heuristic to check autoincremented fields.
// We check if there is a trigger on the field.
// We could also check if there is a sequence on the field.
// Side effect: slower generation of scheme
//SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%TS_DIS_REG_PK%' AND COLUMN_NAME='FECHA_PROC';
$q="SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%".$table."_PK%' AND COLUMN_NAME='".$val['column_name']."'

";
// echo $descr[$val['column_name']]['primary']."\n";
$s = "SELECT * FROM all_trigger_cols WHERE table_name='$table' AND column_name='" . $val['column_name'] . "'";
//echo $q."\n";
$res2 = $this->conn->fetchColumn($q);
$res3 = $this->conn->fetchColumn($s);
if (count($res2) > 0 && count($res3)>0)

{ $descr[$val['column_name']]['autoincrement'] = true; }

}





[DC-921] The ability to add WITH ROLLUP to a group by in a query Created: 09/Nov/10  Updated: 18/Nov/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: will ferrer Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

XP XAMP



 Description   

I figured it would be handy to have a WITH ROLLUP be add able to the group by clause.

I added this feature but I can't post the patch because my patches are starting to run together - the syntax with in the generated patch would also contain parts of other patches I have posted to jira but have not yet been included in the doctrine svn.

I still wanted to make this post because it will give me a ticket number to base my test cases around.

Will Ferrer



 Comments   
Comment by will ferrer [ 09/Nov/10 ]

In order to illustrate what this patch fixes I am posting my test case for the patch below

<?php
/*
 *  $Id$
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */

/**
 * Doctrine_Ticket_DC921_TestCase
 *
 * @package     Doctrine
 * @author      Will Ferrer
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @category    Object Relational Mapping
 * @link        www.doctrine-project.org
 * @since       1.0
 * @version     $Revision$
 */
class Doctrine_Ticket_DC921_TestCase extends Doctrine_UnitTestCase 
{
  
    public function testAggregateValueMappingSupportsLeftJoinsWithRollUp()
    {
        $q = new Doctrine_Query();

        $q->select('MAX(u.name), u.*, p.*')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id');
		$q->setWithRollUp(true);
        $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP');
    }

}
Comment by will ferrer [ 18/Nov/10 ]

I have updated my implemenation of this feature. Here is the new test case:

<?php
/*
 *  $Id$
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */

/**
 * Doctrine_Ticket_DC921_TestCase
 *
 * @package     Doctrine
 * @author      Will Ferrer
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @category    Object Relational Mapping
 * @link        www.doctrine-project.org
 * @since       1.0
 * @version     $Revision$
 */
class Doctrine_Ticket_DC921_TestCase extends Doctrine_UnitTestCase 
{
  
    public function testAggregateValueMappingSupportsLeftJoinsWithRollUp()
    {
        $q = new Doctrine_Query();

        $q->select('MAX(u.name), u.*, p.*')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id');
		$q->withRollUp();
        $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP');
        $this->assertEqual($q->getDql(), 'SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP');
    }
	
	public function testAggregateValueMappingSupportsLeftJoinsWithRollUpDql()
    {
        $q = new Doctrine_Query();
        $q->parseDqlQuery("SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP");
        $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id WITH ROLLUP');
        $this->assertEqual($q->getDql(), 'SELECT MAX(u.name), u.*, p.* FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id WITH ROLLUP');
    }
	
	


}




[DC-911] A way of checking if a model has been loaded via the loaded loadModels method Created: 01/Nov/10  Updated: 02/Nov/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: will ferrer Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

XP Xamp


Attachments: Text File DC_911_fix.patch    

 Description   

I needed a way to check if a model has been loaded — checking to see if the model was included in the _loadedModelFiles property of core.

I put in a simple function that allows me to test for this.

I will post the patch after building a test case for this ticket.

Will Ferrer



 Comments   
Comment by will ferrer [ 02/Nov/10 ]

Changed the name of the method to modelLoaded (seemed more appropriate)





[DC-968] I18n and PostgreSQL and DmVersionable Created: 03/Nov/10  Updated: 15/Feb/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sasha Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.3.2, PostgreSQL 8.4.5, Diem 5.1.x



 Description   

I am using PHP 5.3.2 and PostgreSQL 8.4.5, Diem passed all checks in green - OK.

I started with "A week of Diem Ipsum" and all went ok until I reached building of blog engine. Blog engine example fails in step:

php symfony doctrine:migrate

with error message:

The following errors occurred:

    * SQLSTATE[42830]: Invalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table "article_translation". Failing Query: "ALTER TABLE article_translation_version ADD CONSTRAINT article_translation_version_id_article_translation_id FOREIGN KEY (id) REFERENCES article_translation(id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE"
    * SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_image ON article (image)"
    * SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_author ON article (author)"
    * SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_translation_id ON article_translation (id)"
    * SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. Failing Query: "CREATE INDEX article_translation_version_id ON article_translation_version (id)"

I removed i18n support in blog engine example and after that migrate went ok. But in Admin interface when I wanted to add
blog article, although Diem confirmed it saved article, article would not show up in the list, I checked db table, it was empty also.
Further, if I try to loremize, for 1 fixture I get no error but table is again empty, and for more fixtures then 1, Diem reports error:

SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block.

Again I reviewed the model and removed DmVersionable, migrated again and after that I could loremize or create articles without errors.

Additionally, not related directly to this blog engine example but doctrine related, I noticed errors in Diem Admin interface
itself when I try to access System->Configuration->Settings . If I access System settings over link
admin_dev.php/system/configuration/settings/index it shows settings. But when I click on
dmin_dev.php/system/configuration in menu path and after again to settings
admin_dev.php/system/configuration/settings/index, error is generated:

500 | Internal Server Error | Doctrine_Connection_Pgsql_Exception
SQLSTATE[08P01]: <>: 7 ERROR: bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000008" requires 2

Are this bugs corrected?






[DC-904] Doctrine_Query (execute / fetchOne) memory leak Created: 29/Oct/10  Updated: 03/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Marcin Dryka Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 3
Labels: None
Environment:

$ ./symfony -V
symfony version 1.4.8 (/home/marcin.dryka/htdocs/leak/lib/vendor/symfony/lib)

$ php -v
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Ubuntu Server (lucid)



 Description   

I've created new symfony 1.4.8 project:

$ ./symfony -V
symfony version 1.4.8 (/home/marcin.dryka/htdocs/leak/lib/vendor/symfony/lib)

$ php -v
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

and set the database schema as follows:

$ cat config/doctrine/schema.yml
Example:
columns:
col1: string(255)
col2: string(255)
col3: string(255)
col4: string(255)
col5: string(255)
col6: string(255)

I created a task that contains a Doctrine_query call

(...)
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();

while(1)
{
$m = xdebug_memory_usage();
$q = Doctrine_Query::create()
->from('Example');
$o = $q->fetchOne();

if (false !== $o))

{ $o->free(true); }

unset($q, $o);

printf("Delta: %s Value: %s\n",
xdebug_memory_usage()-$m,
xdebug_memory_usage()
);
}
}
(...)

Unfortunately, memory usage is increasing:
./symfony leak
Delta: 3285264 Value: 10651596
Delta: 12944 Value: 10664448
Delta: 12952 Value: 10677308
Delta: 12932 Value: 10690148
Delta: 12932 Value: 10702988
Delta: 12932 Value: 10715828
Delta: 12932 Value: 10728668
Delta: 12932 Value: 10741508
Delta: 12932 Value: 10754348
Delta: 12932 Value: 10767188

Tested with and without data in database - result is the same.



 Comments   
Comment by sonic wang [ 03/Dec/10 ]

i found this bug too.

$rcs = $query->execute(array(),\Doctrine_Core::HYDRATE_ON_DEMAND);
$query->free();
//write to new table
foreach ($rcs as $rc)

{ $new = $table->create($rc->toArray()); $new->save(); $new->free(true); //free memory $rc->free(true); }

hydrate not cause memory leak

bug hydrate record will cause leak

so iterate Doctrine_collection will cause memory leak

Comment by Marcin Dryka [ 03/Dec/10 ]

Changing hydration doesn't work for me. Same result for:
HYDRATE_ON_DEMAND
HYDRATE_RECORD
HYDRATE_ARRAY





[DC-875] One-to-many relationship returns Doctrine_Record instead of Doctrine_Collection Created: 30/Sep/10  Updated: 14/Sep/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Patrik Åkerstrand Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

WAMP:
Windows 7 - 64bit
Apache 2.2
PHP 5.3.1
MySQL 5.1.41



 Description   

I've run into a bit of a snag in my application where a relationship defined as a one-to-many relationship returns a model object (instance of Doctrine_Record) instead of a Doctrine_Collection when I try to access it as $model->RelatedComponent[] = $child1. This, of course, yields an exception like so:

Doctrine_Exception: Add is not supported for AuditLogProperty
#0 path\library\Doctrine\Access.php(131): Doctrine_Access->add(Object(AuditLogProperty))
#1 path\application\models\Article.php(58): Doctrine_Access->offsetSet(NULL, Object(AuditLogProperty))
#2 path\library\Doctrine\Record.php(354): Article->postInsert(Object(Doctrine_Event))
#3 path\library\Doctrine\Connection\UnitOfWork.php(576): Doctrine_Record->invokeSaveHooks('post', 'insert', Object(Doctrine_Event))
#4 path\library\Doctrine\Connection\UnitOfWork.php(81): Doctrine_Connection_UnitOfWork->insert(Object(Article))
#5 path\library\Doctrine\Record.php(1718): Doctrine_Connection_UnitOfWork->saveGraph(Object(Article))
#6 path\application\modules\my-page\controllers\ArticleController.php(26): Doctrine_Record->save()
#7 path\library\Zend\Controller\Action.php(513): MyPage_ArticleController->createAction()
#8 path\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('createAction')
#9 path\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 path\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#11 path\library\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap->run()
#12 path\public\index.php(11): Zend_Application->run()
{{#13

{main}

}}

This is what my yaml-schema looks like (excerpt):

schema.yml
AuditLogEntry:
  tableName: audit_log_entries
  actAs:
    Timestampable:
      updated: {disabled: true}
  columns:
    user_id: {type: integer(8), unsigned: true, primary: true}
    id: {type: integer(8), unsigned: true, primary: true, autoincrement: true}
    type: {type: string(255), notnull: true}
    mode: {type: string(16)}
    article_id: {type: integer(8), unsigned: true}
    comment_id: {type: integer(8), unsigned: true}
    question_id: {type: integer(8), unsigned: true}
    answer_id: {type: integer(8), unsigned: true}
    message_id: {type: integer(8), unsigned: true}
  indexes:
#   Must index autoincrementing id-column since it's a compound primary key and 
#   the auto-incrementing column is not the first column and we use InnoDB.
    id: {fields: [id]}
    type: {fields: [type, mode]}
  relations:
    User:
      local: user_id
      foreign: user_id
      foreignAlias: AuditLogs
      type: one
      onDelete: CASCADE
      onUpdate: CASCADE
AuditLogProperty:
  tableName: audit_log_properties
  columns:
    auditlog_id: {type: integer(8), unsigned: true, primary: true}
    prop_id: {type: integer(2), unsigned: true, primary: true, default: 1}
    name: {type: string(255), notnull: true}
    value: {type: string(1024)}
  relations:
    AuditLogEntry:
      local: auditlog_id
      foreign: id
      type: one
      foreignType: many
      foreignAlias: Properties
      onDelete: CASCADE
      onUpdate: CASCADE

Now, if we look at the generated class-files, it looks fine:

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
/**
 * @property integer $user_id
 * @property integer $id
 * @property string $type
 * @property string $mode
 * @property integer $article_id
 * @property integer $comment_id
 * @property integer $question_id
 * @property integer $answer_id
 * @property integer $message_id
 * @property integer $news_comment_id
 * @property User $User
 * @property Doctrine_Collection $Properties
 * @property Doctrine_Collection $Notifications
 */
abstract class BaseAuditLogEntry extends Doctrine_Record

/**
 * @property integer $auditlog_id
 * @property integer $prop_id
 * @property string $name
 * @property string $value
 * @property AuditLogEntry $AuditLogEntry
 */
abstract class BaseAuditLogProperty extends Doctrine_Record

However, when I later try to add properties I get the exception posted in the beginning of the question:

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$auditLog = new AuditLogEntry();
$prop1 = new AuditLogProperty();
$prop1->name = 'title';
$prop1->value = $this->Content->title;
$prop2 = new AuditLogProperty();
$prop2->name = 'length';
$prop2->value = count($this->Content->plainText);
$auditLog->Properties[] = $prop1;
$auditLog->Properties[] = $prop2;
$auditLog->save();

If I do the following:

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
var_dump(get_class($auditLog->Properties));

I get that Properties is of type AuditLogProperty, instead of Doctrine_Collection.

I use version 1.2.3 of Doctrine.



 Comments   
Comment by Trevor Wencl [ 14/Sep/11 ]

I am having the same issue and it is killing my application. Using your example, when I call:

var_dump(get_class($auditLog->Properties));

... and there are no AuditLogProperty records, I would expect either an empty Doctrine_Collection or null, but instead I get a new instance of AuditLogProperty with null values for the properties.





[DC-869] calling getLastModified() after saving the object without any modifications returns the last modified fields Created: 17/Sep/10  Updated: 17/Sep/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Keszeg Alexandru Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

symfony-1.4.6



 Description   

_resetModified() function in Record.php fails to reset $this->_lastModified the second time the object is saved.






[DC-866] Bug In Debian "Can't parse dsn.."! Created: 13/Sep/10  Updated: 15/Sep/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: sonic wang Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Debian4 PHP 5.3.1



 Description   

config dsn: sqlite:///root/db3.db

i find parse_url will cause the problem

------------------
$dsn = str_replace("////", "/", $dsn);
$dsn = str_replace("
", "/", $dsn);
$dsn = preg_replace("/\/\/\/(.*):\//", "//$1:/", $dsn);

this fix will be correct in windows ,because dsn is sqlite://C:/aa/wafdb.db3

--------------------------------------------------------------

but in debian it will be fail.






[DC-854] having not work as expected and described Created: 02/Sep/10  Updated: 02/Sep/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Petronel MALUTAN Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

$this->q1 = Doctrine_Query::create()
->select('m.questionaire')
->addSelect('m.aszero')
->addSelect('COUNT(f.id) as bref')
->from('machine m')
->leftJoin('m.relations r ON r.machine_id=m.id')
->leftJoin('r.ref f ON f.id=r.ref_id AND f.part_number LIKE "B%"')
->groupBy('m.questionaire')
->having('bref=0')
;
is producing

"SELECT m.id AS m_id, m.questionaire AS mquestionaire, m.aszero AS maszero, COUNT(r2.id) AS r2_0 FROM machine m LEFT JOIN relation r ON (r.machine_id = m.id) LEFT JOIN ref r2 ON ((r2.id = r.ref_id AND r2.part_number LIKE "B%")) GROUP BY m.questionaire HAVING bref=0 "

but it should be

"SELECT m.id AS m_id, m.questionaire AS mquestionaire, m.aszero AS maszero, COUNT(r2.id) AS r20 FROM machine m LEFT JOIN relation r ON (r.machine_id = m.id) LEFT JOIN ref r2 ON ((r2.id = r.ref_id AND r2.part_number LIKE "B%")) GROUP BY m.questionaire HAVING r2_0=0 "

http://www.doctrine-project.org/docu mentation/manual/1_1/en/dql-doctrine-query-language%3Agroup-by,-having-clauses

With kind regards

Petronel

I use symfony 1.4 and not sure if doctrine is 1...






[DC-856] Doctrine_Core::getPath() not working when inside phar, due to a bug in php Created: 03/Sep/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Miha Vrhovnik Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

It seems that there is a bug in php, and realpath doesn't work when path is inside of phar archive.
function Doctrine_Core::getPath()
if ( ! self::$_path)

{ self::$_path = realpath(dirname(__FILE__) . '/..'); }

can be easily changed to
if ( ! self::$_path)

{ self::$_path = dirname(dirname(__FILE__)); }

 Comments   
Comment by Pierre-Gildas MILLON [ 04/Jan/11 ]

http://bugs.php.net/bug.php?id=52769





[DC-853] I am using symfony 1.4 Created: 01/Sep/10  Updated: 02/Sep/10

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Petronel MALUTAN Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Symfony 1.4



 Description   

$q1 = Doctrine_Query::create()
->select('m.questionaire, COUNT(f.id) AS bref')
->from('machine m')
->leftJoin('m.relations r ON r.machine_id=m.id')
->leftJoin('r.ref f ON r.ref_id=f.id AND f.part_number LIKE "B%"')
->groupBy('m.questionaire')
;
$r1 = $q1->execute();
$q1q = $q1->getSqlQuery();

$q2 = Doctrine_Query::create()
->select('m.questionaire, COUNT(f.id) AS nonbref')
->from('machine m')
->leftJoin('m.relations r ON r.machine_id=m.id')
->leftJoin('r.ref f ON r.ref_id=f.id AND f.part_number NOT LIKE "B%"')
->groupBy('m.questionaire')
;
$r2 = $q2->execute();
$q2q = $q2->getSqlQuery();

$this->reports->setQuery(Doctrine_Query::create()
->select('')
->from('(SQL:'.$q1q.'} q1')
->leftJoin('(SQL:'.$q2q.') q2 ON q1.questionaire=q2questionaire')
);
echo $this->reports->getQuery()->getSqlQuery(); die;

This outputs Couldn't find class (SQL

How to use in such a case ?



 Comments   
Comment by Jonathan H. Wage [ 01/Sep/10 ]

What is the SQL: syntax you are using here? That is definitely not something that is "supported"

Comment by Petronel MALUTAN [ 02/Sep/10 ]

Dear Jonathan

The example I've tried is based on the :
http://www.symfony-project.org/cookbook/1_2/en/retrieving_data_with_doctrine
Please find Sub-Queries in this article and see what I mean.

My problem started from a SQL query created in phpmyadmin, I've tried to convert to doctrine. Following is the mysql query which nicely work:

select * from (select m1.questionaire, COUNT(f1.id) AS n1_refs
from machine AS m1
left join relation AS r1 on m1.id=r1.machine_id
left join ref AS f1 on f1.id=r1.ref_id and f1.part_number LIKE 'B%'
group by m1.questionaire) as a1

left join

(select m2.questionaire, COUNT(f2.id) AS n2_refs
from machine AS m2
left join relation AS r2 on m2.id=r2.machine_id
left join ref AS f2 on f2.id=r2.ref_id and f2.part_number not LIKE 'B%'
group by m2.questionaire) as a2
on a1.questionaire=a2.questionaire

and my trying was to create 2 easier DQL queries and than join them:

$this->q = Doctrine_Query::create()
->select('')
;

$this->q1 = $this->q->createSubquery()
->select('m.questionaire, m.aszero, COUNT(f.id) AS bref')
->from('machine m')
->leftJoin('m.relations r ON r.machine_id=m.id')
->leftJoin('r.ref f ON f.id=r.ref_id AND f.part_number LIKE "B%"')
->groupBy('m.questionaire')
;
//$r1 = $q1->fetchArray();
//$this->r1=$this->q1->execute(array(),Doctrine_Core::HYDRATE_RECORD);

$this->q2 = $this->q->createSubquery()
->select('m.questionaire, m.aszero, COUNT(f.id) AS nonbref')
->from('machine m')
->leftJoin('m.relations r ON r.machine_id=m.id')
->leftJoin('r.ref f ON f.id=r.ref_id AND f.part_number NOT LIKE "B%"')
->groupBy('m.questionaire')
;
//$this->r2=$this->q2->execute(array(),Doctrine_Core::HYDRATE_RECORD);

$this->q->from($this->q1->getDql() . ' q1)')
>leftJoin($this>q2->getDql() . ' q2 ON q1.questionaire=q2questionaire');

echo $this->q->getSqlQuery(); die;

This is outputting :

500 | Internal Server Error | Doctrine_Exception
Couldn't find class SELECT

so please tell me is it now more clear and make some sense ?
How to make it work ?

With kind regards

Petronel

Comment by Jonathan H. Wage [ 02/Sep/10 ]

Can you make a test case that I can run on my machine to see the problem?





[DC-850] Error in Doctrine method execute() Created: 31/Aug/10  Updated: 31/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: fernando guerrero Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In the execute method when doctrine runs a sql query, the process is
interrupted. The review found that the process is interrupted in the fetch method in class Doctrine::Hidrator::Graph.php

In the line $stmt->fetch(Doctrine_Core::FETCH_ASSOC);

I appreciate the partnership that I can provide.

Thanks



 Comments   
Comment by Jonathan H. Wage [ 31/Aug/10 ]

Can you provide some more information?





[DC-847] Can not set a default value of 'CURRENT_TIMESTAMP' in a table definition for mysql Created: 31/Aug/10  Updated: 25/Sep/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: will ferrer Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

XAMP Windows


Attachments: Text File DC_847_fix.patch     Text File DC_847_fix_BC.patch    

 Description   

Hi

I recently I discovered that I needed o put a default value of 'CURRENT_TIMESTAMP' on some of my fields. This was breaking the build of my mysql base for 2 different reasons – for one columns with a type of timestamp were being switched instead to have a type of datetime, and for two the words: CURRENT_TIMESTAMP were being quote encapsulated in the create table statement.

I looked around a bit and couldn't find a solution so I made a patch to fix the issue. This patch however broke some test cases that were expecting datetimes to be returned instead of timestamps (so i fixed the tests).

I may be breaking something that I am not aware of by doing this, or perhaps there was another solution to the problem that I could not find – if any one has any input on this I would appreciate it.

I will post my patch in this thread but it is worth mention that it contains several bug fixes and a few new features which I have posted in other threads several months ago but never heard back regarding (most notably, beyond bug fixes it introduces a new hydration type and allows the disabling of the some times useful some times problematic limit subquery feature of doctrine).

Thanks to all who have any input.

Will Ferrer



 Comments   
Comment by will ferrer [ 31/Aug/10 ]

Here is the patch

Comment by will ferrer [ 01/Sep/10 ]

Found a small error in my last patch (some debug code I hadn't removed) and added some more comments (links to jira above each change) to clarify the fixes and new features the patch has in it.

Comment by will ferrer [ 01/Sep/10 ]

individual patch for this issue with out other features included

Comment by Jonathan H. Wage [ 02/Sep/10 ]

Hi, this one breaks the tests and backwards compatibility. Previously if you have a timestamp field in Doctrine, it would create a datetime column in mysql. Now it is creating a timestamp column. I don't think we can make this change in a stable version.

Comment by Jonathan H. Wage [ 02/Sep/10 ]

At any rate, it is breaking the tests still. If we do decide to make the change, can you run all the tests and fix any of the other failures?

Comment by will ferrer [ 02/Sep/10 ]

Hi Jon

I added more test case fixes to the patch. I can see how this would still cause backwards compatibility issues though – any one who built their db using the none patched version of doctrine would end up with different field types if they rebuilt using the patched version and this could affect the functionality of their existing code.

Thanks for the help .

Hope you are well.

Will

Comment by Jonathan H. Wage [ 03/Sep/10 ]

Can you think of anyway it could be tweaked so that it is BC?

Comment by will ferrer [ 03/Sep/10 ]

Good question...

Here is an idea – how about I put a flag in the options for the field that changes the behavior. So if some one wants to use real timestamps instead of datetime fields they could set an option of: "useRealTimestamps : true" on the field.

I think that would be a good solution because by default everything would work as does is now (providing BC) but users could switch it over if they required the additional functionality that timestamps provide.

What do you think?

Will

Comment by will ferrer [ 11/Sep/10 ]

Hi Jon

Here is a backwards compatible patch using the method I proposed in my last comment.

To make a timestamp field use a type of timestamp (instead of datatime) include an option of: userealtimestamp=>true

Let me know if you think this method will work out.

Hope you are well.

Will

Comment by will ferrer [ 25/Sep/10 ]

I found some issues with this patch when I moved it off my local machine our production server – there was a case sensitivity issue that I have since resolved. Here is the fixed version.





[DC-844] DataDict for MySQL excludes the possibility to have an actual floating point column Created: 27/Aug/10  Updated: 27/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Roberto González Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Not environment dependent



 Description   

Extracted from Doctrine/DataDict/Mysql.php:

Mysql.php
            case 'float':
                $length = !empty($field['length']) ? $field['length'] : 18;
                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine_Core::ATTR_DECIMAL_PLACES);
                return 'FLOAT('.$length.', '.$scale.')';
            case 'double':
                $length = !empty($field['length']) ? $field['length'] : 18;
                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine_Core::ATTR_DECIMAL_PLACES);

If the user does not specify length and decimal places, MySQL creates a floating point number. However Doctrine behavior forces FLOATs and DOUBLEs to be fixed-width.






[DC-842] Alias linking wrong Created: 26/Aug/10  Updated: 26/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sjaakmans Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When you create this kind of query:
$q = Doctrine_Query::create()
->select( 'p.name, a.key, count( a.key ) as amount' )
->from( 'Actions a, ActionPage p' )
->where( 'a.key = p.id' )
->andWhere( 'a.type = 1' )
->andWhere( 'p.type = 2' )
->andWhere( 'a.date >= 0' )
->andWhere( 'p.name not like \'%&ru=%\'' )
->groupBy( 'a.key' )
->orderBy( 'amount' )
->execute( array(), Doctrine::HYDRATE_ARRAY );

You get the folowing error:
Fatal error: Uncaught exception 'Doctrine_Hydrator_Exception' with message '"ActionPage" with an alias of "p" in your query does not reference the parent component it is related to.

There is no relation between those 2 tables. You can solve it by creating a default SQL query. But my guess is that this shouldn't be the right way.






[DC-838] "Primary columns are implied to be notnull in Doctrine" but are not Created: 24/Aug/10  Updated: 24/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jonathan Melnick (Doghouse Media) Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Latest doctrine git commit: bfa24eb68640c412ff6115103ba044bbe1b4333b
Ubuntu 10.4 x64
MySQL server 5.1.41-3ubuntu12.6
PHP 5.3.2



 Description   

Doctrine says : "Primary columns are implied to be notnull in Doctrine" (line 563 in lib/Doctrine/Import/Builder.php)

But when generating (My)SQL statements, primary fields are not set to "NOT NULL" even if it is specified in the YAML and/or Model file.

If doctrine unsets the 'notnull' option on line 565 in lib/Doctrine/Import/Builder.php (as it does), it should make sure to add the "NOT NULL" to the SQL when appropriate :

  • in getNotNullFieldDeclaration() method (line 798) in lib/Doctrine/Export.php
    AND
  • in getDeclaration() method (line 272) in lib/Doctrine/Export/Mysql.php

Solution #1: In both places, check if field is primary, and if so, add "NOT NULL" to SQL, since "Primary columns are implied to be notnull in Doctrine".

Solution #2: Change Doctrine as to not enforce this behaviour (eg. remove the check in lib/Doctrine/Import/Builder.php on line 565)

Thx for this great ORM.

~ Jonathan






[DC-837] Add support for AFTER in migration addColumn function Created: 23/Aug/10  Updated: 23/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Exien Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

It's imperative that the migration utility support specifying where the column is created and not just created at the end of the table, otherwise the migration utility is pretty much useless. I want to keep my database schema clean and tidy.

I would say the default use case of this method is to specify where the new column is created.

Please add the ability to specify where the new column goes to this function:
Doctrine_Migration::addColumn().



 Comments   
Comment by Jonathan H. Wage [ 23/Aug/10 ]

I understand your desire to want to control where a column is added but to use words like "imperative" and "useless" is crazy! Where the column goes is in no way a blocker or major problem. If someone wants this bad enough and provides a patch we can consider including it.





[DC-817] Nested aggregate fields do not hydrate to the right object Created: 12/Aug/10  Updated: 12/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Patrick Nagurny Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I'm trying to run a query that gets a forum, its threads and the number of replies for each thread. The following query works as per the documentation:

$threads = Doctrine_Query::create()
->select('p.*, COUNT(c.id) as num_replies)
->from('Posts p')
->leftJoin('p.Children c')
->where('p.parent_id IS NULL')
->groupBy('p.id')
->fetchArray(array(), Doctrine_Core::HYDRATE_ARRAY);

As expected, I can access $threads[0]['num_replies'] and I get the COUNT() of the number of children for the thread.

However, when I run this query:

$forum = Doctrine_Query::create()
->select('f., p., COUNT(c.id) as num_replies)
->from('Forum f')
->leftJoin('f.Posts p WITH p.parent_id IS NULL')
->leftJoin('p.Children c')
->where('f.slug = ?', $params[0])
->groupBy('p.id')
->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);

Instead of num_replies being assigned to each Posts[] object, it is only being assigned once to the Forum object, rendering it totally useless.






[DC-907] when I delete fields from a table in oracle 10g and I execute build schema keeps bringing me those same fields that no longer exist. Created: 28/Jul/10  Updated: 31/Oct/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: fernando guerrero Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have a table in oracle that i was using but I had to change it so i remove some fields and add others when i run the task buils schema it generates the file schema.yml it created the new fields added but continued to bringing those field who had been eliminated and no longer existed in the database, it generates an error because the file schema.yml are those field but the database does not ...



 Comments   
Comment by Benjamin Eberlei [ 15/Sep/10 ]

Is this a Doctrine 1 or 2 bug? Is this a caching issue maybe?





[DC-790] Doctrine_Inflector::unaccent() Problem with array keys for Norwegian characters Created: 16/Jul/10  Updated: 16/Jul/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: bat Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Inflector.php, on line 221, there are missing keys (or values) for values 'å' and 'aa' in $chars.
This generates a bug with $string which contains "0" or "1".

l221
// Norwegian characters
'Å'=>'Aa','Æ'=>'Ae','Ø'=>'O','æ'=>'a','ø'=>'o','å','aa'
);






[DC-782] Generated SQL for indexes is faulty Created: 11/Jul/10  Updated: 11/Jul/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Christian Schmitz Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

LAMP, PHP 5.2.6, PostgreSQL 8.3



 Description   

We have the following YAML:

Yaml
User:
  columns:
    id:
      type: integer
      unsigned: 1
      primary: true
      autoincrement: true
    username: 
      type: string(255)
      notnull: true
  indexes:
    username_index:
      fields:
        username:
          type: unique

The resulting record-class looks like this, which is still fine:

Class
class User extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('users');
        $this->hasColumn('id', 'integer', null, array(
             'type' => 'integer',
             'unsigned' => 1,
             'primary' => true,
             'autoincrement' => true,
             ));
        $this->hasColumn('username', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => '255',
             ));
 

        $this->index('username_index', array(
             'fields' => 
             array(
              'username' => 
              array(
              'type' => 'unique',
              ),
             ),
             ));
    }

    public function setUp()
    {
        parent::setUp();
    }
}

But the resulting SQL looks like this, which is faulty because of the Array stuff at the index:

SQL
CREATE TABLE "users" ("id" BIGSERIAL, "username" VARCHAR(255) NOT NULL, PRIMARY KEY("id"));
CREATE INDEX "username_index" ON "users" ("Array");





[DC-1061] ORACLE CHARSET DOCUMENTATION Created: 10/Jul/10  Updated: 28/Dec/13

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: fernando guerrero Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None
Environment:

ORACLE db SYMFONY



 Description   

Openning an Oracle Database with Doctrine and Symfony doesn't support by default utf8 charset.

To support it, it is necessary to specify charset=AL32UTF8 in the dsn of the database in config/databases.yml. Analogous to the example shown at
http://groups.google.com/group/doctrine-user/browse_thread/thread/d0d22145d8bdc83
however we have been able to use it fully only with the oracle driver (instead of oci), for example:

oracle:dbname=//192.168.2.9:1521/nomina_dev;charset=AL32UTF8

Documentation by Alexia Velásquez (alexia.velasquez@hotmail.es, Vladimir Tàmara (vtamara@pasosdeJesus.org) and Fernando Guerrero



 Comments   
Comment by Steve Müller [ 26/Nov/13 ]

I know this ticket is very old. But there is an option to set the charset for OCI8. See:

http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#pdo-oci-oci8

Comment by Steve Müller [ 28/Dec/13 ]

This is a legacy ticket related to Doctrine 1.





[DC-765] Incorrect query for inherited many-to-many relation Created: 24/Jun/10  Updated: 24/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jorgo Miridis Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP Version 5.3.0
System Windows NT ZEUS 5.1 build 2600 (Windows XP Professional Service Pack 3) i586
symfony version 1.4.6-DEV
sfDoctrinePlugin revision 29679



 Description   

Column Aggregation Inheritance, Many to Many

Inspired by post on symfonyexperts.com (http://symfonyexperts.com/question/show/id/48) I tried to setup a similar scenario whith 1 'Entity' Model and many-to-many relations between them.
The different types of relations between them are implemented by inheritance.

It seems that Doctrine is omitting the type of the key field in the generated queries.
I put up an example to reproduce it:

Model (YAML)
---------------------------------------
Entity:
columns:
name:

{ type: varchar(20) }

relations:
Owners:

{ class: Entity, local: src_entity_id, foreign: dst_entity_id, refClass: EntityRelationOwner }

Compatibles:

{ class: Entity, local: src_entity_id, foreign: dst_entity_id, refClass: EntityRelationCompatible }

EntityRelation:
columns:
src_entity_id:

{ type: integer(4), primary: true }

dst_entity_id:

{ type: integer(4), primary: true }

type:

{ type: string(10) }

EntityRelationOwner:
inheritance:
extends: EntityRelation
type: column_aggregation
keyField: type
keyValue: owner

EntityRelationCompatible:
inheritance:
extends: EntityRelation
type: column_aggregation
keyField: type
keyValue: compatible

Action:
---------------------------------------
..
$entity = Doctrine::getTable('Entity')->find(1);
$entity->getOwners()
..

SQL:
---------------------------------------
SELECT entity.id AS entity__id,
entity.name AS entity__name,
entity_relation.src_entity_id AS entity_relation__src_entity_id,
entity_relation.dst_entity_id AS entity_relation__dst_entity_id,
entity_relation.type AS entity_relation__type
FROM entity
INNER JOIN entity_relation ON entity.id = entity_relation.dst_entity_id
WHERE entity.id IN (
SELECT dst_entity_id FROM entity_relation WHERE src_entity_id = '1'
)
ORDER BY entity.id ASC

To my understanding, the inner SQL statement is missing the type restriction and should be:

SELECT dst_entity_id FROM entity_relation WHERE src_entity_id = '1' AND type = 'owner'






[DC-769] Variable type different for return value from Doctrine_Record->toArray() depending on whether the object is from a select, or a save. Created: 27/Jun/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: 1.2.1, 1.2.2

Type: Bug Priority: Major
Reporter: Dennis Gearon Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu9.10, PHP 5.2.6, Symfony 1.4.1, Postgres8.4



 Description   

With a object that is created via a save(), and the record's primary key is a INT fed by a SEQUENCE, the type of the variable is an INT.

With an object that is hydrated from the database via a SELECT, the record's primary key INT will come back in 'toArray()' as a STRING.

That means that checking for type has to know what context it came from, user, INSERT, or SELECT. Not fun.

This also screws up converting arrays to JSON, 'cause the STRINGS get quotation marks and the INTS do not.

As a general rule, everything FROM the database seems to be strings. Yes, I know, everything 'on the wire' or 'through a socket' comes out as text. And it's a lot faster to leave it that way.

But having the type be different depending on the database operation? Not sure I like that.



 Comments   
Comment by Jonathan H. Wage [ 24/Aug/10 ]

Can you provide a test case so that we can see if we can come up with a patch?





[DC-761] MSSQL Server: No support for transaction savepoints Created: 24/Jun/10  Updated: 24/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Craig Marvelley Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows XP
PHP 5.3.2


Attachments: Text File doctrine_transaction_mssql_savepoints.patch    

 Description   

Doctrine_Transaction_MSSQL doesn't provide methods for working with transaction savepoints. I've attached a patch to address this.

N.B. As far as I can see, SQL Server doesn't support the release of savepoints, so I've just stubbed that method out.






[DC-756] Cannot use named parameters in a 'limit(':max') clause Created: 21/Jun/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dennis Gearon Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

ubuntu, apache, symfony version 1.4.4


Attachments: Text File DC-756.partial.patch    

 Description   

$modulus=5;
$offset=2;
$this->Statuses['ready']=1;

This works
---------------------------------
$DetailsList=
Doctrine_Query::create()->from('Data s')
->where('s.status_id=:status_id')
->andWhere('((s.id % :modulus) - :offset)=0')
->orderBy('s.id')
->limit($maxDaysDetailsToProcess)
>execute(array(':status_id'=>$this>Statuses['ready'],
':modulus'=>$modulus,
':offset'=>$offset), Doctrine::HYDRATE_ARRAY);

This does not, it gets the whole table
---------------------------------
$DetailsList=
Doctrine_Query::create()->from('Data s')
->where('s.status_id=:status_id')
->andWhere('((s.id % :modulus) - :offset)=0')
->orderBy('s.id')
->limit(':max')
>execute(array(':status_id'=>$this>Statuses['ready'],
':modulus'=>$modulus,
':offset'=>$offset,
':max'=>$maxDaysDetailsToProcess), Doctrine::HYDRATE_ARRAY);



 Comments   
Comment by Dennis Gearon [ 24/Jun/10 ]

I noticed an error in the code, which does not solve the problem, only confuse whomever works on it Please add

$maxDaysDetailsToProcess=3;

as the fourth line in the code.

Comment by Juan Antonio Galán [ 07/Sep/10 ]

I think I found a solution but it's making some tests fail. Let me explain you what I did:

First I removed any casting to int of the limit value, in order to keep the named parameter in the LIMIT part of the query. Actually this named parameters were converted to 0 due to those int castings.

Then I realized that the params are bound as strings so the resulting query looks like ... LIMIT "2" or whatever you put in the limit value, and mysql throws and error. Then I tryed to modify the function that binds the paramters to bind them as integers when they're not strings. Everything seems to work fine and you could put named parameters in the limit clause, but some tests are failing. If you look at the tests that are failing you'll see that they're failing because of a wrong phone number, the test it's expecting a number large number like 6155139185 but the result array has a number like 1860171889. I'm wondering if there's something wrong when binding numbers bigger than mysql INT as integers.

I attach a diff file with the changes I did, hope it helps





[DC-748] Warning: implode(): Invalid arguments passed in /Doctrine/Table.php on line on line 922 Created: 17/Jun/10  Updated: 17/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Victor Paladiychuk Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

mysql 5.1.40, php 5.3.1


Attachments: File Table.php    

 Description   

Calling to function implode() while not checked if second argument is an array.
Arrives anywhere on trying to create and get Doctrine_Query and Doctrine_Collection objects. Also on using Doctrine_Cli commands.
Here is a fragment that generates warning:

class Doctrine_Table extends Doctrine_Configurable implements Countable
{
...

public function unique($fields, $options = array(), $createdUniqueIndex = true)
{
if ($createdUniqueIndex)

{ $name = implode('_', $fields) . '_unqidx'; // this line generates warning $definition = array('type' => 'unique', 'fields' => $fields); $this->addIndex($name, $definition); }

$this->_uniques[] = array($fields, $options);
}
...
}






[DC-722] String(512) is being implemented as TEXT instead varchar(512) on MySQL Created: 08/Jun/10  Updated: 08/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mateo Tibaquirá Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

LAMP over Ubuntu 10.04



 Description   

Well
the titles says it all.

Just now I realized the TEXT type for fields that I've defined in the code as String(512).
What I understand is that TEXT has performance disvantages. Why not use varchar when there are little needs instead TEXT?

Thanks in advice.
Greetings!






[DC-723] String = 512 becomes TEXT Created: 08/Jun/10  Updated: 09/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Karma Dordrak (Drak) Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I don't know if this is a feature or a bug, but if I define a field type = string, length = 512, Doctrine creates this as a TEXT field in MySQL. Seems to do this for a length over 255 characters, e.g. 256. This seems like overkill possibly. Feels like the field should be defined either as TINYTEXT or VARCHAR (which can go up to 63335 characters in length).

Is there any way to control this behavior?



 Comments   
Comment by Jonathan H. Wage [ 09/Jun/10 ]

No, it is not possible right now. The portable Doctrine types and lengths are converted to certain types for the different databases. In Doctrine2 you can specify the SQL that will create your column in the mapping if you desire something more customize or database specific





[DC-661] Subquery Doctrine Couldn't find class Created: 04/May/10  Updated: 08/Jun/10

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mauro E. Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I'm trying to create a query like this one :

SELECT nombre, (select count( * ) from alojamiento a left join localidad l on a.localidad_id=l.id where p.id=l.provincia_id and a.activo=true) as total from provincia p

$q = Doctrine_Query::create()
->select('p.nombre')
->addSelect('(select count( * ) from alojamiento a left join
localidad l on a.localidad_id=l.id where p.id=l.provincia_id and
a.activo=true)')
->from('provincia p');

but it fails : error 500, couldn't find class a.

And :
$q = Doctrine_Query::create() ->select('nombre') ->addSelect('(select count( * ) from alojamiento left join localidad on
alojamiento.localidad_id=localidad.id where
provincia.id=localidad.provincia_id and alojamiento.activo=true)') ->from('provincia');

leads to : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.localidad_id' in 'on clause'.



 Comments   
Comment by Jonathan H. Wage [ 08/Jun/10 ]

You are using table names in your query and not model names.

For future reference, the Jira is for reporting bugs/issues. You can ask user questions on the Doctrine mailing lists: http://www.doctrine-project.org/community

Comment by Mauro E. [ 08/Jun/10 ]

My model names are: alojamiento, localidad and provincia I don't use table names.

Comment by Jonathan H. Wage [ 08/Jun/10 ]

Can you provide a test case because I am not able to reproduce any problems. All of our subquery tests are passing currently and I can't seem to find any problems like you describe.

Comment by Mauro E. [ 08/Jun/10 ]

Hope it is not my stupid fault, I apologize if it's my fault.

My schema.yml is:

Alojamiento:
actAs:
Timestampable:
Sluggable:
unique: true
fields: [nombre]
canUpdate: true
SoftDelete:
columns:
id:
type: integer(4)
primary: true
unique: true
notnull: true
autoincrement: true
localidad_id:
type: integer(4)
notnull: true
nombre:
type: string(255)
notnull: true
activo:
type: boolean
notnull: true
default: false
relations:
Localidad:
foreignType: one

Localidad:
actAs:
Sluggable:
unique: true
fields: [nombre]
canUpdate: true
columns:
id:
type: integer(4)
primary: true
unique: true
notnull: true
autoincrement: true
nombre:
type: string(250)
unique: true
notnull: true
provincia_id:
type: integer(4)
notnull: true
relations:
Provincia:
onDelete: CASCADE
local: provincia_id
foreign: id

Provincia:
actAs:
Sluggable:
unique: true
fields: [nombre]
canUpdate: true
columns:
id:
type: integer(4)
primary: true
unique: true
notnull: true
autoincrement: true
nombre:
type: string(250)
unique: true
notnull: true
relations:
Localidades:
type: many
class: Localidad
local: id
foreign: provincia_id
orderBy: nombre

Comment by Jonathan H. Wage [ 08/Jun/10 ]

You can read about how to create unit tests here http://www.doctrine-project.org/projects/orm/1.2/docs/manual/unit-testing/en#unit-testing





[DC-643] Doctrine_Collection problem duplicate record Created: 22/Apr/10  Updated: 22/Apr/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Thomas Tourlourat - Armetiz Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

$oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
$oVideo = new Model_Video ();
$oVideo->assignIdentifier (500);

$oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
$oVideo->tags->clear ();
$oVideo->tags[] = $oTag;
$oVideo->save ();

The previous code can be execute a lot of time.

Now, let us create the Doctrine_Collection.

$oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
$oVideo = new Model_Video ();
$oVideo->assignIdentifier (500);

$oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
$oVideo->tags = new Doctrine_Collection ("Model_Tag");
$oVideo->tags[] = $oTag;
$oVideo->save ();

Doctrine create a relation between the video and tag. It doesn't update it.
If the relation already exists into the database, Doctrine create an other record, or the DB throw an integrity error if you have constraint.






[DC-609] Symfony doctrine doesnt save an M:M table if one of the tables is in a 1:1 relationship with another table Created: 30/Mar/10  Updated: 31/Mar/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Chris F Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

MAC, Symfony PHP framework


Attachments: File Ad.yml     File Amenity.yml     File Housing.yml     File HousingAmenity.yml     PNG File Screen shot 2010-03-31 at 3.30.56 AM.png     PNG File Screen shot 2010-03-31 at 3.31.37 AM.png     PNG File Screen.png    

 Description   

Symfony doctrine doesnt save an M:M table if one of the tables is in a 1:1 relationship with another table. Refer to Screen.png for ER diagram.

I have included the schema files as attachments.

You will notice in Screen shot 2010-03-31 at 3.30.56 AM.png, an item is selected in "Amenities list". When the form is submitted, everything saves in the db except for the item in the "Amenities list" (Screen shot 2010-03-31 at 3.31.37 AM.png)



 Comments   
Comment by Chris F [ 31/Mar/10 ]

The problem could be because i am embedding a form that has a M:M relation with another table.

Which is a similar issue to http://trac.symfony-project.org/ticket/5867

Many have mentioned to override the saveEmbeddedForms() function inside BaseFormDoctrine.

The patch at: http://trac.symfony-project.org/ticket/5867 doesnt work. How can we fix this?





[DC-585] Hydrate Array does not return full array, when Hydrate Scalar does Created: 18/Mar/10  Updated: 02/Mar/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: James Solomon Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 4
Labels: None
Environment:

OS : Ubuntu 9.04
PHP : PHP 5.2.6-3ubuntu4.5


Attachments: Text File Doctrine-DC-585-b.patch     Text File Doctrine-DC-585-c.patch    

 Description   

Description : Upon hydrating as array I will receive one row returned. If I am to hydrate as Scalar, I will get 200+ rows. Also, if i echo the sql ($q->getSqlQuery()) and run that raw, it will also return around 200+ rows.

$q = Doctrine_Query::create()
->select('DISTINCT(co.name) AS field, co.name AS value')
->from('Model_Country co')
->leftJoin('co.City ci');

//here we will get only the first row
$results = $q->execute(array(), Doctrine::HYDRATE_ARRAY);

//Here we will get all 200+ rows
$results = $q->execute(array(), Doctrine::HYDRATE_SCALAR);

I have yet to dig to deep into this, but if it is indeed a bug, my guess is it is in Doctrine_Hydrator_Graph::hydrateResultSet()

I can provide more data if needed.



 Comments   
Comment by James Solomon [ 18/Mar/10 ]

I have found this in the google group, and he provides more detailed info, and appears to be the same exact issue : http://groups.google.com/group/doctrine-user/msg/8e4a8a673428fff0

Comment by James Solomon [ 18/Mar/10 ]

seems to be another similar issue here : http://www.doctrine-project.org/jira/browse/DC-328

Comment by Juan Antonio Galán [ 19/May/10 ]

I'm having that problem and I taked a look into the code, found this:

I have a query that looks like this:
$q = Doctrine_Query::create()
->select('af.id as id, af.user_id as user')
->from('ActivityFeed af')
->innerJoin('af.user as afu')
->orderBy('af.time DESC');

The sql query without aliases in SELECT or without join is built that way:
SELECT a.id AS a_id, a.user_id AS a_user_id ... -> This is returning all the records

The sql query with aliases in SELECT is built that way:
SELECT a.id AS a_0, a.user_id AS a_1 FROM ... -> This is returning only one record

In Doctrine_Hydrator_Graph::_gatherRowData, line 288 there's the following call:

$fieldName = $table->getFieldName($last);
Where $last is the last part of the column alias, for example "0" in "a__0". This way the call asks the table for the name of the "0" field and the table returns "0" so I think we're not getting the right field name (it must be "id").

I'm not understanding the whole hydration process but replacing

$fieldName = $table->getFieldName($last);

with:

if(isset($this->_queryComponents[ $cache[$key]['dqlAlias']]['agg']))

{ $fieldName = $table->getFieldName($this->_queryComponents[ $cache[$key]['dqlAlias']]['agg'][$last]); }

else

{ $fieldName = $table->getFieldName($last); }

solves the problem almost in my case.

Hope it will help to solve the issue.

Comment by Jonathan H. Wage [ 08/Jun/10 ]

It seems the suggested change causes many failures in our test suite. Can you give it a try and confirm?

Comment by Ben Davies [ 28/Jul/10 ]

Just commenting to say that I can confirm this bug exists. It's happening for me too.
I will try and dig deeper when I have some time.

Comment by Juan Antonio Galán [ 28/Aug/10 ]

As the error is located in Doctrine_Hydrator_Graph, HYDRATE_RECORD has the same behaviour.

I'm trying to find a solution.

Comment by Ben Davies [ 31/Aug/10 ]

This only occurs if your alias your identifier field.
Doctrine needs to know which field is the identifier to hydrate records.
The identifier aliases is formed to x__0, and then, as other commented has found.
Doctrine then has no way of determining which field is the identifier.

Comment by Enrico Stahn [ 15/Oct/10 ]

Hi everybody,

we really need a unit test here. The provided patch breaks all aliased queries in our application. I will provide a patch and it hopefully solves your problem Juan. If not, please provide more information or add another test-method to the provided unit test.

I had to rewrite some of the unit tests cause the order of the fields in the generated sql statement has changed due the provided patch.

Enrico

http://github.com/doctrine/doctrine1/commit/e3ae69c2260dae6dfbceb4e24138b2379f3da2e6#commitcomment-169495
http://github.com/estahn/doctrine1/tree/DC-585

Comment by Pierrot Evrard [ 04/Mar/11 ]

Hi,

I have a little issue with this bug report...

I'm currently using Doctrine 1.2 at revision 7691, and I've encounter a bug when select the primary key of a model with a custom alias (typically $query->addSelect( 'r.id as my_id' )), the issue was that Doctrine automatically add `r`.```id``` AS `r_1` to the select clause, in addition to the correct `r`.`id` AS `r_1` part.

So, I've browse the code to finally found where does this strange thing comes from, and I've found it on Doctrine_Query::parseSelect() method, just at the line 663:

// Fix for http://www.doctrine-project.org/jira/browse/DC-585
// Add selected columns to pending fields
if (preg_match('/^([^\(]+)\.(\'?)(.*?)(\'?)$/', $expression, $field)) {
$this->_pendingFields[$componentAlias][$alias] = $field[3];
}

So I'm wonder : where does this patch is related to this bug report?

Whatever, the bug I've encounter is very simple : the regular expression that extract the field name takes care about ' but not ´.

You will find a patch for the bug DC-585-b in a few minutes... This patch just make the regular expression taking account of ' and ´ and also remove all useless parentheses in expression (by this way PCRE get less matches to capture and we can earn some precious microseconds).

Also, this patch should be completed because the query still have two `r`.`id` AS `r_1` parts, that may cause some other issues with some databases...

IMPORTANT NOTE: The previous revision 7674 of Doctrine_Query does not cause the bug encounter with the few lines of code above, just because they were not there. They really must be review.

Loops

Comment by Pierrot Evrard [ 28/Apr/11 ]

Damn, the bug above was corrected during a few weeks and comes back with the new branch of Doctrine 1.2.14.

Does anybody can re-apply the corrective patch (renamed DC-585-c), please ?

I repeat it agin, but these few lines of code really need to be review.

Loops

Comment by klemen nagode [ 13/Jan/12 ]

I also have this problem .. Anyone know howt o fix it?

$query->execute(array(), Doctrine::HYDRATE_ARRAY); // returns one row only
$query->execute(array(), Doctrine::HYDRATE_RECORD); // returns one row only

$query->execute(array(), Doctrine::HYDRATE_SCALAR); // returns result as expected

Comment by klemen nagode [ 14/Jan/12 ]

I found solution for my problem:

Table had ID field but it was not primary key. When I deleted this column, doctrine started to work as expected.

Comment by Lacton [ 02/Mar/12 ]

I have run into the same issue.

Using the default hydration, I get only one record.

Using "$query->execute(array(), Doctrine::HYDRATE_SCALAR);", I get all the expected records.





[DC-519] ->where() add parentheses Created: 23/Feb/10  Updated: 23/Feb/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Alessandro Gaspari Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have this method

public function getOpenBalances()

{ $q = $this->createQuery('a') ->select('a.*') ->where('a.invoice_id IN ( SELECT ac.invoice_id FROM AccountingCustomers ac GROUP BY ac.invoice_id HAVING (SUM(ac.dedit) - SUM(ac.credit)) > 0)'); return $q->execute(); }

and yhis is the error generated in symfony:

SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" at character 456. Failing Query: "SELECT a.id AS a_id, a.customer_id AS acustomer_id, a.invoice_id AS ainvoice_id, a.credit AS acredit, a.duedate AS aduedate, a.debit AS adebit, a.paymentdate AS apaymentdate, a.note AS anote, a.created_at AS acreated_at, a.updated_at AS aupdated_at FROM accounting_customers a WHERE (a.invoice_id IN (SELECT a2.invoice_id AS a2_invoice_id FROM accounting_customers a2 GROUP BY a2.invoice_id HAVING (SUM(ac.dedit) - SUM(a2.credi))) > 0))"

At the end ther is a parentheses that the code haven't. ))) > 0))

and another problem is that SUM(ac.credit) is changed in SUM(a2.credi)






[DC-496] Doctrine should warn when a columns / table name match a reserved word Created: 12/Feb/10  Updated: 12/Feb/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Brice Maron Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux / ALL



 Description   

Today i looked for quite a long time why doctrine doesn't acte like i wish...

it turns out that it was because of a column named 'system_id'... doctrine use this for internal use.

no pbm with that, but please notify users that they will experience pbm when a column or table name match X or Y or Z.

i've experienced pbm with : table_name, system_id, and some other id too.






[DC-417] Unexpected results with equal many-to-many relations Created: 11/Jan/10  Updated: 14/Jan/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.1.6, 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ivo Võsa Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7 (cli) (built: Nov 26 2009 14:52:57)
MySQL 5.0.84-0.dotdeb.0
Doctrine-1.1.6-Sandbox



 Description   

print_r's before refresh represent what i hoped to get and after that what was inserted into db.

INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] => 2
    [1] => 1
)


UPDATE match_reference SET match_id = ? WHERE user_id = ? AND match_id = ?
Array
(
    [0] => 1
    [1] => 1
    [2] => 2
)


INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] => 3
    [1] => 2
)


INSERT INTO match_reference (match_id, user_id) VALUES (?, ?)
Array
(
    [0] => 4
    [1] => 2
)
Array
(
    [0] => Array
        (
            [id] => 2
            [username] => 2
        )

)
Array
(
    [0] => Array
        (
            [id] => 1
            [username] => 1
        )

    [1] => Array
        (
            [id] => 3
            [username] => 3
        )

    [2] => Array
        (
            [id] => 4
            [username] => 4
        )

)
Array
(
)
Array
(
    [0] => Array
        (
            [id] => 3
            [username] => 3
        )

    [1] => Array
        (
            [id] => 4
            [username] => 4
        )

)

schema/schema.yml

---
User:
  columns:
    username: string(255)
  relations:
    Matches:
      class: User
      local: user_id
      foreign: match_id
      refClass: MatchReference
      equal: true
      cascade: [delete]

MatchReference:
  columns:
    user_id:
      type: integer
      primary: true
    match_id:
      type: integer
      primary: true

index.php

require_once('config.php');

Doctrine::loadModels('models');

Doctrine_Query::create()
    ->delete('User')
    ->execute();

Doctrine_Query::create()
    ->delete('MatchReference')
    ->execute();

$u1 = new User();
$u1->id = $u1->username = 1;
$u1->save();

$u2 = new User();
$u2->id = $u2->username = 2;
$u2->save();

$u3 = new User();
$u3->id = $u3->username = 3;
$u3->save();

$u4 = new User();
$u4->id = $u4->username = 4;
$u4->save();

$profiler = new Doctrine_Connection_Profiler();
Doctrine_Manager::getInstance()->getCurrentConnection()->addListener($profiler);

$user_1 = Doctrine::getTable('User')->find(1);

$matches = Doctrine_Query::create()
    ->from('User')
    ->whereIn('id', array(2))
    ->execute(array(), Doctrine::HYDRATE_ARRAY);

$match = $matches[0];

$user_1->link('Matches', array($match['id']));
$user_1->save();

$user_2 = Doctrine::getTable('User')->find(2);

$matches = Doctrine_Query::create()
->from('User')
->whereIn('id', array(3, 4))
->execute(array(), Doctrine::HYDRATE_ARRAY);

foreach ($matches as $match) {
    $user_2->link('Matches', array($match['id']));
}

$user_2->save();

foreach ($profiler as $event) {
    if (in_array($event->getName(), array('execute')) && preg_match('/^(INSERT|UPDATE)/', $event->getQuery())) {
        echo print_r($event->getQuery(), true) . "\n";
        echo print_r($event->getParams(), true) . "\n\n";
    }
}

print_r($user_1->Matches->toArray());
print_r($user_2->Matches->toArray());

$user_1->refresh(true);
$user_2->refresh(true);

print_r($user_1->Matches->toArray());
print_r($user_2->Matches->toArray());



 Comments   
Comment by Ivo Võsa [ 11/Jan/10 ]

Just tested it on 1.2.1 with same results.





[DC-449] Duplicate entry integrity constraint error when updating Searchable record with indexed fields from a template Created: 25/Jan/10  Updated: 25/Jan/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jack Sleight Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have the following:

<?php
class JS_Page extends Doctrine_Record
{
	public function setTableDefinition()
	{
		$this->setTableName('page');
		$this->hasColumns(array(
			'id' => array(
				'type'		=> 'integer',
				'length'	=> 4,
				'primary'	=> true,
				'autoincrement'	=> true,
			),
			'content' => array(
				'type'		=> 'array',
				'length'	=> 65536,
				'notnull'	=> true,
				'default'	=> array(),
			),
		));
	}

	public function setUp()
	{
		$this->actAs(new JS_Template_Meta());
		$this->actAs('Searchable', array(
			'fields'	=> array('title', 'description', 'keywords'),
			'tableName'	=> 'page_index',
		));
	}
}

class JS_Template_Meta extends Doctrine_Template
{
	public function setTableDefinition()
	{
		$this->hasColumns(array(
			'title' => array(
				'type'		=> 'string',
				'length'	=> 255,
				'notnull'	=> true,
			),
			'description' => array(
				'type'		=> 'string',
			),
			'keywords' => array(
				'type'		=> 'string',
				'length'	=> 255,
			),
		));
	}
}

When a Page record is updated I get this error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'application-title-0-3' for key 1

If I only index fields from Page it works.

I tracked this down to the code in Doctrine_Search that deletes the existing indexed data before re-indexing a record (I'm not using batchUpdate). For reasons I don't understand the DELETE query is not executing correctly before re-indexing, and so any unchanged data is being added to the index twice, causing the error.

I managed to work around this by adding my own template and listener before Searchable, with a preSave event that deletes the index data:

...
		$this->actAs(new JS_Template_Searchable());
		$this->actAs('Searchable', array(
			'fields'	=> array('title', 'description', 'keywords'),
			'tableName'	=> 'page_index',
		));
...

class JS_Template_Searchable extends Doctrine_Template
{
	public function setTableDefinition()
	{
		$this->addListener(new JS_Template_Searchable_Listener());
	}
}

class JS_Template_Searchable_Listener extends Doctrine_Record_Listener
{
	public function preSave(Doctrine_Event $event)
	{
		$invoker = $event->getInvoker();
		$class = get_class($invoker) . 'Index';
		$query = Doctrine_Query::create()
			->delete()
			->from("{$class} i")
			->where("i.id = ?", $invoker['id'])
			->execute();
	}
}

Obviously that's an ugly hack, but it works.






[DC-432] ::isValidType fails when input format is different from php default format Created: 15/Jan/10  Updated: 08/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jón Ragnarsson Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows XP (XAMPP Apache) & Linux


Attachments: File Validator.php    

 Description   

In Validator::isValidType():
return (string)$var == strval(floatval($var));

floatval($var) returns only the integer part if the decimal character is anything other than ".".
Therefore this evaluation fails.

I've added a small function 'ParseFloat' which takes locale settings into consideration.
There might be a better solution.



 Comments   
Comment by Jonathan H. Wage [ 08/Jun/10 ]

Can you provide the changes as patch?





[DC-427] Record Hydration error Created: 14/Jan/10  Updated: 14/Jan/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Diordienko Mykhail Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 9.04
Apache 2.2.9
PHP 5.2.6-3ubuntu4.2 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:14:44)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans
MySQL 5.0.75-0ubuntu10.2 (Ubuntu)
Symfony 1.4.1



 Description   

schema.yml

CheCategory:
options:
collate: utf8_unicode_ci
charset: utf8
actAs:
Timestampable: ~
NestedSet: ~
columns:
name:
type: string(255)
CheItem:
options:
collate: utf8_unicode_ci
charset: utf8
actAs:
Timestampable: ~
columns:
name:
type: string(255)
category_id:
type: integer(12)
relations:
CheItemPhoto:
type: many
local: id
foreign: item_id
CheItemAttribute:
type: many
local: id
foreign: item_id
CheCategory:
local: category_id
foreign: id

CheAttribute:
options:
collate: utf8_unicode_ci
charset: utf8
columns:
name:
type: string(255)
attr_type:
type: integer(2)
label:
type: string(255)
sort_order:
type: integer(5)
default: 9999
relations:
CheItemAttribute:
local: id
foreign: attribute_id

CheItemAttribute:
options:
collate: utf8_unicode_ci
charset: utf8
columns:
item_id:
type: integer(12)
attr_value:
type: clob
attribute_id:
type: integer(12)
relations:
CheItem:
local: item_id
foreign: id
CheAttribute:
local: attribute_id
foreign: id

CheItemPhoto:
options:
collate: utf8_unicode_ci
charset: utf8
actAs:
Timestampable: ~
columns:
item_id:
type: integer(12)
basefile:
type: string(255)
caption:
type: string(255)
is_default:
type: boolean
default: false
relations:
CheItem:
local: item_id
foreign: id

fixtures.yml

CheAttribute:
Attr_price:
name: Price
label: price
sort_order: 1
attr_type: <?php echo CheAttribute::ATTR_STRING."\n" ?>
Attr_desc:
name: Desc
label: desc
sort_order: 2
attr_type: <?php echo CheAttribute::ATTR_HTML."\n" ?>

CheCategory:
Cat_0:
name: Items category
children:
Cat_1:
name: Cups
children:
Cat_2:
name: Beer
Cat_3:
name: Tea
children:
Cat_5:
name: China
Cat_6:
name: Russian
Cat_4:
name: Coffee

CheItem:
Item_8:
name: Vobla
CheCategory: Cat_1
Item_1:
name: Vobla2
CheCategory: Cat_2

CheItemAttribute:
Ite_attr_0:
CheItem: Item_1
CheAttribute: Attr_price
attr_value: 10
Ite_attr_1:
CheItem: Item_1
CheAttribute: Attr_desc
attr_value: abcsdd
Ite_attr_2:
CheItem: Item_8
CheAttribute: Attr_price
attr_value: 123
Ite_attr_3:
CheItem: Item_8
CheAttribute: Attr_desc
attr_value: test

code:

$b = Doctrine::getTable("CheAttribute")>createQuery("A2")>leftJoin("A2.CheItemAttribute IA2 WITH IA2.item_id = ?", 2)>addOrderBy("A2.sort_order ASC")>execute();

var_dump($b[0]>getCheItemAttribute()>getAttrValue());

$tb = Doctrine::getTable("CheAttribute")>createQuery("A")>leftJoin("A.CheItemAttribute IA WITH IA.item_id = ?", 1)>addOrderBy("A.sort_order ASC")>execute();

var_dump($tb[0]>getCheItemAttribute()>getAttrValue());
exit();

in browser i see:

string '10' (length=2)

string '10' (length=2)

but expected:

10

123

With hydration Array & Scalar hydrated data is ok.






[DC-426] Doctrine incorrectly assigns a NULL value to primary key fields Created: 14/Jan/10  Updated: 14/Jan/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Timo A. Hummel Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

in my project (MySQL 5.x, PHP 5.2.x), I use a combined primary key which looks as follows:

$this->hasColumn("guid", "string", 32, array('primary' => true));
$this->hasColumn("revision", "integer", 4, array('primary' => true));
$this->hasColumn("language", "string", 32, array('primary' => true));

My project automatically initializes the GUID and revision fields, but language is left empty. Doctrine assumes that NULL is a good value, and uses the NULL value after saving an object to reload it. This results in the following statement, generated by the find()-Method within Table.php:

SELECT b.guid AS b_guid, b.revision AS brevision, b.language AS blanguage, b.active AS bactive, b.title AS btitle, b.content AS bcontent, b.category AS b_category FROM blog_entry b WHERE (b.guid = '505f1a2d13864fa4aef461aa1b5b37a3' AND b.revision = '1' AND b.language = NULL)

Since MySQL does not allow NULL values in primary keys, MySQL uses an empty string (''). Doctrine should also use an empty string as default value if the primary key consists of a string, OR issue a warning that MySQL does not allow NULL values in primary keys. The problem with this "bug" is that problems occur in situations where you do not expect them, for example, when storing objects.

If a test case is required, just tell me and I'll prepare one.

Thanks and best regards,
Timo






[DC-401] Doctrine_Query->load crashes with additional ending whitespace in JOIN Created: 06/Jan/10  Updated: 06/Jan/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Christian Michel Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

following will lead to an error:

->leftJoin('alias.RelatedTable alias2 WITH .....')

The problem is the additional whitespace behind alias2.
On line 1682 in Doctrine_Query class file:

$tmp = explode(' ', $path);

will create an array of 3 elements where the last one is empty but will be used as empty alias mapping after foreach from line 1698.






[DC-396] Add timezone support for time and timestamp datatype in PostgreSQL Created: 05/Jan/10  Updated: 19/Aug/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Vladislav Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None

Attachments: File timestampable.diff    

 Description   

Please add support for the types of time with timezone and timestamp with timezone in the Doctrine when using PostgreSQL.



 Comments   
Comment by Alex Potter [ 19/Aug/12 ]

I came across this problem because I prefer to store timezone information instead of local dates.

I believe this is resolved by the attached patch, which patches the Timestampable template and it's listener to create and maintain 'timestamp with timezone' in Postgresql.





[DC-356] Error in self referencing (nest relations) and tableName. Created: 14/Dec/09  Updated: 17/Jan/13

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sergio Gomez Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 2
Labels: None
Environment:

Linux, php 5.2.10, apache 2.2.12



 Description   

I have this schema:

  1. Interface
    Interfaz:
    tableName: YT_INTERFAZ
    columns:
    cinterfaz: { type: integer, notnull: true, primary: true, autoincrement: true }

    relations:
    Conexiones:
    class: Interfaz
    local: cinterfazsrc
    foreign: cinterfazdst
    refClass: Conexion
    equal: true

#Link
Conexion:
tableName: YT_CONEXION
columns:
cinterfazsrc:

{ type: integer, primary: true }

cinterfazdst:

{ type: integer, primary: true }

When I try to get $interfaz->Conexiones, I get this message:

Notice: Undefined index: yt_interfaz in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 288

Notice: Undefined index: in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 289

Fatal error: Call to a member function getFieldName() on a non-object in /home/sergio/Proyectos/syc/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 290

But If I remove tableName fields in schema declaration, it works perfectly. The name of tableName don't matters, if you use it, it fails.



 Comments   
Comment by Klaas van der Weij [ 15/Feb/11 ]

Same story over here. Same error with the following non-equal nest relation:

<?php

class TXCRDataNodeCRDataNode extends Doctrine_Record
{
    public function setTableDefinition() {
        $this->setTableName('x_CRDataNode_CRDataNode');
        $this->hasColumn('childNodeID', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => false,
             ));
        $this->hasColumn('parentNodeID', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => false,
             ));
    }

    public function setUp() {
        parent::setUp();
        $this->hasOne('TCRDataNode as child', array(
             'local' => 'childNodeID',
             'foreign' => 'dataNodeID'));
        $this->hasOne('TCRDataNode as parent', array(
             'local' => 'parentNodeID',
             'foreign' => 'dataNodeID'));
    }
}

class TCRDataNode extends Doctrine_Record
{
    public function setTableDefinition() {
        $this->setTableName('CRDataNode');
        $this->hasColumn('dataNodeID', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => false,
             ));
        $this->hasColumn('value', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
    }
    public function setUp() {
        $this->hasMany('TCRDataNode as childNodes', array(
            'local' => 'parentNodeID',
            'foreign' => 'childNodeID',
            'refClass' => 'TXCRDataNodeCRDataNode'));
        $this->hasMany('TCRDataNode as parentNodes', array(
            'local' => 'childNodeID',
            'foreign' => 'parentNodeID',
            'refClass' => 'TXCRDataNodeCRDataNode'));
    }
}

$dn = Doctrine_Core::getTable('TCRDataNode')->find(5300);

?>

.. and then when I ..

<?php

$pn = $dn->parentNodes;

?>

.. it goes like:

Notice: Undefined index: crdatanode in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 288

Notice: Undefined index: in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 289

Fatal error: Call to a member function getFieldName() on a non-object in /home/shared/library/doctrine_1.2.2/Doctrine/Hydrator/Graph.php on line 290

Using Doctrine 1.2.2

It seemed like the same thing as presented in the documentation

Comment by Klaas van der Weij [ 17/Feb/11 ]

This aching issue - as I traced the cord back to the wall - appears to originate from the fact that I use UPPERCASES in the names of my databas tables. When I user all lowercases: no problem. Hence it worked on my WAMP server (Windows just lowercases it all). Even when I so much as start the entity-table which an UPPERCASE: bang! Fatal error.

This is not logical and, I presume, is a definite bug.

Please, oh please fix this ..

Comment by Danny Kopping [ 06/Mar/12 ]

As Klaas mentions, this function incorrectly assumes that all databases will be named using lowercase letters.

The problem arises in the following line:
$cache[$key]['dqlAlias'] = $this->_tableAliases[strtolower(implode('__', $e))];

If one removes the "strtolower" function call, it will work for tables named with uppercase letters, but this is obviously quite an inelegant solution.

Could you suggest an alternative solution? I'll be happy to make the change, test it and issue a pull request in GitHub

Comment by Danny Kopping [ 06/Mar/12 ]

I've just tested this scenario in as many different possible combinations as I could think of (all tables uppercase/PascalCase, all tables lowercase, some Pascal, some lowercase) and just by removing the "strtolower" function, the issue seems to be resolved.

Comment by Jay Klehr [ 17/Jan/13 ]

We've encountered this as well, tried a lot of different things in our models/schema to get around it, but nothing worked.

Made a test case here: https://github.com/diablomedia/doctrine1/blob/master/tests/Ticket/DC356TestCase.php

Modified the doctrine core as suggested by Danny, but this change causes other Doctrine test to fail (Particularly tests/TableTestCase.php).





[DC-344] Trouble with auto including generate Base class with specifik name Created: 09/Dec/09  Updated: 21/Mar/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Havelka Ondrej Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 3
Labels: None
Environment:

Linux, Ubuntu 9.04 64b



 Description   

I have found a problem during testing example model on page http://www.doctrine-project.org/documentation/cookbook/1_1/en/code-igniter-and-doctrine . A use YAML model with object name UserGroup and call method Doctrine_Core::createTablesFromModels('models'); process faling with error:

Fatal error: Class 'BaseUserGroup' not found in /sourcepath/models/UserGroup.php on line 13

Generate model file included abstract class BaseUserGroup exist and is OK. If I include BaseUserGroup manuly or rename object "UserGroup" on "UserGroups" everithing work fine. I thing here is a problem with autoloding base class with specifik name.

Here is my code example:

Doctrine_Core::dropDatabases();
Doctrine_Core::createDatabases();
Doctrine_Core::generateModelsFromYaml('sourcepath/yaml/model.yml', 'models');
Doctrine_Core::createTablesFromModels('models');

Trouble shotting YAML model is:

UserGroup:
columns:
user_id:
type: integer(4)
primary: true
group_id:
type: integer(4)
primary: true



 Comments   
Comment by Gustavo [ 26/Dec/09 ]

Same problem here following the same example of the 1.2 tutorial.

Comment by Michal Olszewski [ 08/Feb/10 ]

Hi,

I've stumbled upon the same problem and I think I know where the issue is.

So Doctrine_Core::createTablesFromModels() calls Doctrine_Export::exportSchema() which in turn calls Doctrine_Core::loadModels().

Doctrine_Core::loadModels() uses RecursiveIteratorIterator and iterates over all found files.

Now I think the order of files returned by RecursiveIteratorIterator is not always the same (depends on OS, filenames and cosmic radiation ), but the most important thing here is that class files from 'modules/generated' directory (as in examples) ARE NOT included before subclasses derived from generated classes. This means that Doctrine_Core::autoload() fails to load classes from 'modules/generated' directory, exactly this check fails:

if (0 !== stripos($className, 'Doctrine_') || class_exists($className, false) || interface_exists($className, false))

as base class is not starting with 'Doctrine_' and is not yet loaded.

To fix it properly the algorithm for loading modules must be changed to first include 'modules/generated' classes and then rest of classes. I am not sure but maybe Core::autoload() might be changed to include base classes properly.

QUICK WORKAROUND:
As a quick workaround I've changed parameters in call to createTablesFromModels() to:

Doctrine_Core::createTablesFromModels(array('models/generated','models'));

as createTablesFromModels() can accept array of directories.

Hope this helps you, please let me know if you need any more information. Thanks!

Comment by Svetoslav Shterev [ 09/Feb/10 ]

You are missing the model autoloader(http://www.doctrine-project.org/upgrade/1_2#Models%20Autoloading), which was added in 1.2

That should fix the problem with conservative autoloading.

Comment by Michal Olszewski [ 09/Feb/10 ]

I've tried registering modelsAutoload() and it works superb in this case for both aggressive and conservative loading.

It is a shame that it is not mentioned in 1.2 PDF I've got - it'd make life easier for some people

Thanks for your help.

Comment by blt [ 21/Mar/10 ]

i am a new user to doctrine and i hit this brick wall. this bug report was all that saved me, and it is a bit misleading. my test results are below. in the end i found a combination that worked, but this seems like a glaring bug especially since the pdf takes the user right down a path that fails completely in all cases (default aggressive loading, doesn't work for me at all).

i am using a pear loaded version 1.2 on ubuntu

here are my test results:
---------------------------------------------------------------------------------------------------
case 1: load models right after generating them, without modelsAutoLoad() call: SUCCESS/FAIL varies
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');

in test.php:
<?
require_once('doctrine_bootstrap.php');
Doctrine_Core::generateModelsFromDb('models', array('doctrine'), array('generateTableClasses' => true));
Doctrine_Core::loadModels('models');

---------------------------------------------------------------------------------------------------
case 2: load models after they have already been generated, without modelsAutoLoad() call: FAIL
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');

in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');

---------------------------------------------------------------------------------------------------
case 3: load models after they have already been generated, with the modelsAutoLoad() call and default aggressive setting: FAIL
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');

spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));

in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');

---------------------------------------------------------------------------------------------------
case 4: load models after they have already been generated, with the modelsAutoLoad() call and conservative loading: SUCCESS
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');

$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));

in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');





[DC-328] Multi-table query (left-join) problem in the Doctrine_Hydrator_Graph class Created: 04/Dec/09  Updated: 04/Dec/09

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Hasan Ozgan Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 9.10 Linux / PHP 5.2.x / Apache2 / Mysql 5


Attachments: File hasanozgan_com.sql    

 Description   

I tried below code. It must be return 2 records, but It returned 1 record. I traced Doctrine and found to reason in
Doctrine_Hydrator_Graph class line 165 ( $identifierMap[$rootAlias][$id[$rootAlias]] = $this->getLastKey($result); ) When couple $rootAlias not get record.

I attached my data and code. Is it problem?!

77 $q = Doctrine_Query::create();
78 $q->select("r.post_id as id, p.title as title, p.slug as slug, p.created_on as created_on")->
79 from("Relations r")->
80 leftJoin("r.Taxonomies t")->
81 leftJoin("t.Marks m")->
82 leftJoin("r.Posts p")->
83 where("m.slug = ?", $slug)->
84 andWhere("m.status = ?", self::PUBLISH)->
85 andWhere("p.status = ?", self::PUBLISH)->
86 andWhere("t.status = ?", self::PUBLISH)->
87 andWhere("t.type = ?", self::CATEGORY)->
88 orderBy("p.created_on desc");






[DC-292] no migrations diff on template change Created: 25/Nov/09  Updated: 01/Mar/10

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0-RC1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Christian Jaentsch Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

the generate-migrations-diff does not create migrations if the template changes fields on the model.

For example:

File:
tableName: files
inheritance:
extends: Eeecore_Record_File
actAs:
Fileable:

The Fileable Template does the following... (the "fileFields" option stores a couple of fields to add to the model)

public function setTableDefinition()
{

foreach ($this->_options['fileFields'] as $key => $field)

{ $this->hasColumn($field['name'], $field['type'], $field['length'], $field['options']); }

}

everything works fine on generate-migrations-models (the initial migrations)... but if we change something on the "fileFields" the generate-migrations-diff call doesn't do anything. We have to rebuild all migrations or write a new migration by hand.



 Comments   
Comment by Jonathan H. Wage [ 07/Dec/09 ]

I added coverage for this issue and it is working as expected. I compare two schemas:

Article:
  columns:
    title: string(255)
    body: clob

and I compare it to this one:

Article:
  actAs: [Timestampable]
  columns:
    title: string(255)
    body: clob

And now I do this:

        $migration = new Doctrine_Migration(dirname(__FILE__) . '/DC292/migrations');
        $diff = new Doctrine_Migration_Diff(dirname(__FILE__) . '/DC292/from.yml', dirname(__FILE__) . '/DC292/to.yml', $migration);
        $changes = $diff->generateChanges();
        print_r($changes);

It has this in the array:

    [created_columns] => Array
        (
            [article] => Array
                (
                    [created_at] => Array
                        (
                            [notnull] => 1
                            [type] => timestamp
                            [length] => 25
                        )

                    [updated_at] => Array
                        (
                            [notnull] => 1
                            [type] => timestamp
                            [length] => 25
                        )

                )

        )

Comment by Christian Jaentsch [ 08/Dec/09 ]

The problem does not occur if you compare 2 schemas while one has a certain template and the other not.

In my case the problem occurs when the 2 schemas both already have the same template definition but in one case the template itself has changed (e.g. injects one more field into the database table of a certain model via setTableDefinition).

Comment by Jonathan H. Wage [ 08/Dec/09 ]

When I test that it works as well. Can you show some kind of reproducible test case?

Comment by Jonathan H. Wage [ 01/Mar/10 ]

Maybe you could add a test case for this?





[DC-293] Implement a self-reference class mechanism without the usage of associative classes Created: 25/Nov/09  Updated: 25/Nov/09

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Rui Miguel Gonçalves Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 9.10, Eclipse



 Description   

Equals to summary






[DC-278] Invalid qubquery generated if using oracle adapter instead of pdo_oci Created: 23/Nov/09  Updated: 09/Jun/10

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2.0

Type: Bug Priority: Major
Reporter: Thomas Wahle Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux, Oracle 10g



 Description   

Doctrine generates the following invalid subquery if oracle adapter is used (same query is generated corret if pdo_oci is used):

SELECT DISTINCT "s2"."code"
FROM "spend_category" "s2"
INNER JOIN "company_spend_category" "c4" ON ("s2"."code" = "c4"."spendcategory_code")
INNER JOIN "company" "c3" ON "c3"."code" = "c4"."company_code"
WHERE "s2"."code" = '19000000'
AND "c3"."is_deleted" IS NOT NULL
AND "s2"."is_deleted" IS NOT NULL
ORDER BY "c3"."name" desc

The problem is that the order by column is not part of the selected columns.

Sample dql statement to reproduce this error:

$this->pageAllPager = new Doctrine_Pager(
$q = Doctrine_Query::create()
->select('c.code, c.name, c.is_activated, c.is_deleted, sc.code')
->from('SpendCategory sc')
->innerJoin('sc.Companies c')
->where("sc.code = '$spendcategory'")
->addWhere('c.is_deleted IS NOT NULL')
->addWhere('sc.is_deleted IS NOT NULL')
->orderBy($orderBy)
->setHydrationMode(Doctrine::HYDRATE_ARRAY),
$page,
$resultsPerPage);
}



 Comments   
Comment by Jonathan H. Wage [ 23/Nov/09 ]

I believe this is fixed now in the latest Doctrine 1.2. Can you test and confirm?

Comment by Thomas Wahle [ 24/Nov/09 ]

It is not fixed with 1.2 RC1

Same sql wich work fine with pdo_oci generates an error using the oracle adapter

<p>
<b>Message:</b> ORA-01791: Kein mit SELECT ausgewählter Ausdruck : SELECT s.code AS s_code, c.code AS ccode, c.name AS cname, c.is_activated AS cis_activated, c.is_deleted AS c_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = '37000000' AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM <= 10) AND (s.code = '37000000' AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc.

Failing Query: "SELECT s.code AS s_code, c.code AS ccode, c.name AS cname, c.is_activated AS cis_activated, c.is_deleted AS c_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = '37000000' AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM <= 10) AND (s.code = '37000000' AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc"</p>

Comment by Jonathan H. Wage [ 24/Nov/09 ]

I can't reproduce the issue in a test case. Can you help me with that? When I test what you're describing I get the results that are expected.

Comment by Thomas Wahle [ 25/Nov/09 ]

Hi Jon,

if i undestand the last comment correctly this issue will be fixed in 1.2 RC2.

I have reviewed lots of existing test cases but did not find an example where pdo_oci or oracle adapter is used.

Can you please forward the test case you have created for DC-278 to me? I will use this as a template for any further issues and hopefuly reduce your efforts.

Kind regards
Tom

> Jonathan H. Wage updated DC-278:
> --------------------------------
>
> Fix Version/s: 1.2.0-RC2
> (was: 1.2.0-RC1)

Comment by Thomas Wahle [ 10/Dec/09 ]

I do believe that I have found the reason and it is still an issue with Doctrine 1.2.1

Doctrine generate the following subquery which is processed in Doctrine_Query:: getLimitSubquery().

SELECT b.id FROM
(
SELECT a.*, ROWNUM AS doctrine_rownum FROM
(
SELECT DISTINCT i.id, i.lft
FROM item i
INNER JOIN oum o ON i.oum_id = o.id AND (o.is_deleted IS NOT NULL)
INNER JOIN item_type i2 ON i.type_id = i2.id AND (i2.is_deleted IS NOT NULL)
INNER JOIN item_translation i3 ON i.id = i3.id
LEFT JOIN attachment a ON i.id = a.item_id AND (a.is_deleted = 0)
WHERE i.bundling_id = ?
ORDER BY i.lft
) a
) b
WHERE doctrine_rownum BETWEEN 3 AND 4

This function replaces the table alias names. It looks like that the first occurance of "a" is detected and the inner alias for table attachment "a" is replaced by "a2" - that's fine. But also the outer table alias "a" is replaced by "a2" The result will be

SELECT b.id FROM
(
SELECT a.*, ROWNUM AS doctrine_rownum FROM
(
[...]
LEFT JOIN attachment a2 ON i.id = a2.item_id AND (a2.is_deleted = 0)
WHERE i.bundling_id = ?
ORDER BY i.lft
) a2  !!!!!!
) b

„a" is selected but the alias has been changed to „a2" and this will cause an sql error.

It looks like that this bug will only raise if a table is used in the subquery which starts with an "a"

Comment by Thomas Wahle [ 11/Dec/09 ]

As a workaround i have change "a" to "x" in the Doctrine_Connection_Oracle::_createLimitSubquery()

As far as no table in our projekt starts with character "x" this works fine for me.

By the way: Shouldn't it be $this->quoteIdentifier('a') . '.' instead of just a. ??

original code:
$query = 'SELECT b.'.$column.' FROM ( '.
'SELECT a.*, ROWNUM AS doctrine_rownum FROM ( '
. $query . ' ) ' . $this->quoteIdentifier('a') . ' '.
' ) ' . $this->quoteIdentifier('b') . ' '.
'WHERE doctrine_rownum BETWEEN ' . $min . ' AND ' . $max;

modified code:
$query = 'SELECT b.'.$column.' FROM ( '.
'SELECT x.*, ROWNUM AS doctrine_rownum FROM ( '
. $query . ' ) ' . $this->quoteIdentifier('x') . ' '.
' ) ' . $this->quoteIdentifier('b') . ' '.
'WHERE doctrine_rownum BETWEEN ' . $min . ' AND ' . $max;

Comment by Jonathan H. Wage [ 08/Jun/10 ]

Can you provide the change that fixes the problem for you as a diff so we can test it?

Comment by Thomas Wahle [ 09/Jun/10 ]

Hi Jon,

long time with no hear from you. Hope you are well!

I am sorry, we did not fix this bug really. As writte above we have just implemented a work around by choosing a different character ("x" instead of "a") for the name of the generated sub query alias. This works fine with our data model (no table starts with "x") but may cause the same error with other data models.

At all: There was too much trouble in this project last year. Due to this we made the decision to go ahead with pdo_oci to finish the project in time.

Kind regards
Thomas

Comment by Jonathan H. Wage [ 09/Jun/10 ]

I'll leave this open if someone runs across the same problem, a test case showing the issue would help with pin pointing the problem area in the code.





[DC-185] The pessimistic offline locking manager locks the entire table Created: 04/Nov/09  Updated: 13/Dec/12

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.1.4, 1.1.5, 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Fabian Brussa Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 7
Labels: None
Environment:

Windows XP, WampServer Version 2.0


Attachments: File DC185TestCase.php     Text File row_based_locking.patch    

 Description   

Scenario:
$entity = Doctrine::getTable('Steps')->find($pID);
$lockingManager = new Doctrine_Locking_Manager_Pessimistic( Doctrine_Manager::connection() );
$lockingManager->releaseAgedLocks(300);
$gotLock = $lockingManager->getLock($entity, 'user1' );

Running this code locks the entire table "Steps", and not just the record.

in the table "doctrine_lock_tracking", in the fields: "object_type" and "object_key" are saved in this case: "Steps" and "IDStep".
I think that here must be saved "Steps" and "120" (the value of IDStep).



 Comments   
Comment by Fabian Brussa [ 18/Nov/09 ]

Is anybody looking into this issue ?

Comment by Jonathan H. Wage [ 18/Nov/09 ]

Can you provide a test case that shows the issue? It is hard to look into the issue without a test to run When I look at the code and our tests everything is passing and fine so I am not sure what your issue could be. Re-open if you have more information to provide.

Comment by Fabian Brussa [ 19/Nov/09 ]

ok, I attach the test case

Comment by Fabian Brussa [ 03/Dec/09 ]

Have you already been able to look at the testcase ??

Comment by Fabian Brussa [ 14/Jan/10 ]

Any news ??

Comment by Piotr Leszczyński [ 25/Jun/10 ]

This issue is still valid for Doctrine 1.2. Doctrine_Locking_Manager_Pessimistic is UNUSABLE without this bug fixed!

Comment by Markus Wößner [ 02/Jul/10 ]

Having a look at "Doctrine_Locking_Manager_Pessimistic::getLock()" it becomes clear what causes this misbehaviour:

    public function getLock(Doctrine_Record $record, $userIdent)
    {
        $objectType = $record->getTable()->getComponentName();
        $key        = $record->getTable()->getIdentifier();

        $gotLock = false;
        $time = time();

        if (is_array($key)) {
            // Composite key
            $key = implode('|', $key);
        }

        try {
            $dbh = $this->conn->getDbh();
            $this->conn->beginTransaction();

            $stmt = $dbh->prepare('INSERT INTO ' . $this->_lockTable
                                  . ' (object_type, object_key, user_ident, timestamp_obtained)'
                                  . ' VALUES (:object_type, :object_key, :user_ident, :ts_obtained)');

            $stmt->bindParam(':object_type', $objectType);
            $stmt->bindParam(':object_key', $key);
            $stmt->bindParam(':user_ident', $userIdent);
            $stmt->bindParam(':ts_obtained', $time);

There is NO hint about the Record's identifier VALUE but only about the identifier's NAME (mostly "id") which appears to be redundant information. Instead of ...

        $key = $record->getTable()->getIdentifier();

..there should be something like ..

        $key = $record->get($record->getTable()->getIdentifier());

In case of composite keys a string concatenation, prefixed by identifier's name might work but I would recommend using "md5()" on resulting value to limit its length since field "object_key" is limited to 250 chars.

Comment by Florian Zumkeller-Quast [ 02/Jul/10 ]

Based on the previous comment by Markus Wößner i created a patch for row based locking.

It concatenates the PK fields and their values to a string and calculates the sha-1 hash as a unique string representing that record. This string is then used as key so that we'll only lock the single Record and not the whole table.

I hope you'll give this patch a try - It solved this problem for me.

Comment by Markus Wößner [ 02/Jul/10 ]

I applied patch from Mr. Florian Zumkeller-Quast and provided testcase didn't fail anymore. I think this should do it. By the way I find it strange that this issue isn't already fixed. I guess locking is not very much used by Doctrine users.

Comment by Jérôme Weber [ 21/Nov/11 ]

I applied patch too and it works now. I guess too that nobody use Lockings but when you use it ... without the patch it fails.

Comment by Grégoire Paris [ 13/Dec/12 ]

Duplicate of http://www.doctrine-project.org/jira/browse/DC-984





[DC-81] Using WITH in combinations with LIMIT returns unexpected results Created: 06/Oct/09  Updated: 15/Jun/10

Status: Reopened
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0-ALPHA1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gerry Vandermaesen Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Mac OS X 10.6.1



 Description   

When I try to limit left joined records with an additional WITH clause, it seems to be bugged when also specifying a LIMIT.

My DQL:

FROM Transporter t LEFT JOIN t.Profile p LEFT JOIN t.Requests r WITH (r.distributor_id = ?) WHERE t.is_active = ? ORDER BY p.company_country, p.company_name LIMIT 20

This returns me 0 results, while removing the LIMIT (or the WITH) will return me 2 results.



 Comments   
Comment by Jonathan H. Wage [ 02/Nov/09 ]

Sorry this is just not enough information to produce the problem. I ran some basic tests looking for what you pointed out but I didn't see any issues. Plus our tests cover this functionality so I imagine that if it were broke we'd get some failures. However, I could be wrong so if you could re-open and provide a failing test case for us that would help with getting it fixed.

Comment by Gerry Vandermaesen [ 16/Apr/10 ]

I actually ran into this problem once again in another problem.

Schema:

Story:
columns:
id:
type: integer(4)
unsigned: true
primary: true
autoincrement: true

Picture:
columns:
id:
type: integer(4)
unsigned: true
primary: true
autoincrement: true
story_id:
type: integer(4)
unsigned: true
notnull: true
is_selected:
type: boolean
notnull: true
default: false
relations:
Story:
foreignAlias: Pictures
local: story_id
foreign: id
type: one
foreignType: many
onDelete: CASCADE

Query:

Doctrine_Query::create()
->from('Story s')
->leftJoin('s.Pictures p WITH p.is_selected = ?', true)
->where('s.id = ?', 5)
->limit(10);

Outputted SQL:

SELECT "s"."id" AS "s_id", "s"."first_name" AS "sfirst_name", "s"."last_name" AS "slast_name", "s"."country" AS "scountry", "s"."email" AS "semail", "s"."content" AS "scontent", "s"."title" AS "stitle", "s"."summary" AS "ssummary", "s"."is_published" AS "sis_published", "s"."is_rejected" AS "sis_rejected", "s"."is_promoted" AS "sis_promoted", "s"."published_at" AS "spublished_at", "s"."created_at" AS "screated_at", "s"."updated_at" AS "supdated_at", "p"."id" AS "pid", "p"."story_id" AS "pstory_id", "p"."filename_original" AS "pfilename_original", "p"."filename_large" AS "pfilename_large", "p"."filename_thumb" AS "pfilename_thumb", "p"."mime_type" AS "pmime_type", "p"."is_selected" AS "pis_selected", "p"."created_at" AS "pcreated_at", "p"."updated_at" AS "p_updated_at" FROM "story" "s" LEFT JOIN "picture" "p" ON "s"."id" = "p"."story_id" AND ("p"."is_selected" = '1') WHERE "s"."id" IN (SELECT DISTINCT "s2"."id" FROM "story" "s2" LEFT JOIN "picture" "p2" ON "s2"."id" = "p2"."story_id" AND ("p2"."is_selected" = '5') WHERE "s2"."id" = '1' ORDER BY "s2"."published_at" DESC LIMIT 10) AND ("s"."id" = '5') ORDER BY "s"."published_at" DESC

Notice the WHERE "s2"."id" = '1' !

Comment by Jonathan H. Wage [ 08/Jun/10 ]

Can you provide a test case we can run?

Comment by Gerry Vandermaesen [ 15/Jun/10 ]

I could not figure out what test to write but I did narrow the problem down.

It seems that the order of the generated SQL clauses does not match the order of the passed parameters, so in the final SQL query the values are mixed up. You can actually see that happening in the SQL query above. I also noticed there a special cases hardcoded in the code for MySQL and PgSQL as far as these "limit subqueries" go, so that might be another reason why you havent bumped into problem before. I was using an SQLite driver.

I suppose something goes wrong in the SQL generation, but I don't know the core good enough to find out where exactly it does go wrong, so I'm afraid I can't attach a test case, but it should be easy to reproduce now anyway.





[DC-1017] Floats persisted in the database are retrieve as strings. Created: 12/Jul/11  Updated: 12/Jul/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Grégoire Paris Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 64 bits, php 5.3



 Description   

Someone complained about symfony padding 0's after floats http://stackoverflow.com/questions/6650786/remove-extra-decimal-place-in-float-datatype-on-symfony/6663829 , I think it's a doctrine problem, since the doctrine:dql task seems to have the same problem:

>> doctrine executing dql query
DQL: FROM UcVideoAspect
found 1 results
-
id: '1'
video_id: null
pixel_ratio: '12.50'
width: null
height: null

Here, pixel ratio is defined as a float in the schema.yml file
Getting the property from a transient object returns a float, while getting it from the db returns a string.






[DC-990] Values not escaped Created: 26/Mar/11  Updated: 26/Mar/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Nick Bartlett Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

windows and linux OS, mysql database



 Description   

When I save inputs from a form, special characters such as single quotes are inserted into the mysql database without being escaped. It's my understanding that doctrine uses PDO and PDO should handle this escaping automatically, but it is not. Is there a configuration setting that I can set with doctrine to enable this?

Thanks
Nick






[DC-976] Invalid long constraint name Created: 19/Feb/11  Updated: 19/Feb/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Sébastien Rannou Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS: Linux
Soft platform: Symfony 1.4.8, mysql5


Attachments: Text File constraint_name.patch    

 Description   

When the constraint's name is too long, a shorter one is generated using information such as the name of the database. If the database's name begins with a numeric value, the constraint name also begins with a numeric value which results in an invalid constraint name.






[DC-959] DSN style problems in documentation 1.2 Created: 25/Jan/11  Updated: 25/Jan/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Documentation Priority: Minor
Reporter: Luis Felipe Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

MAMP



 Description   

This page:

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/introduction-to-connections/en

states the DSN can either be provided as an associative array or as a string, but it's not true, specially if you're doing lazy connection, because this type of connection only accepts doctrine dsn style and it doesn't seem to know how to handle unix socket type connections (is it correct?).

I would suggest the manual clarify that lazy connection will only accept string type dsn and also will not accept socket connections.

Related links:
http://groups.google.com/group/doctrine-user/browse_thread/thread/1eecb07a2f6df447/3e74857c3a076939?lnk=gst&q=dsn#3e74857c3a076939
http://www.doctrine-project.org/jira/browse/DC-647






[DC-947] getRandom() method for Doctrine_Table Created: 08/Dec/10  Updated: 08/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: ddead profile Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Consider adding this method into Doctrine_Table

public static function getRandom()
{
return
self::getInstance()->createQuery()
->select('*, RANDOM() as rand')
->limit(1)
->orderBy('rand')
->fetchOne();
}

It is portable and very useful.






[DC-945] Doctrine_Query::create()->where('table.field =') unexpectedly returns a result Created: 06/Dec/10  Updated: 07/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Huijbers Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.3.0



 Description   

While firing the following query with Doctrine, I did not expect Doctrine to return me a record, however, even though there is a syntax error (in my opinion) it gave me the first record of the table.

$q = \Doctrine_Query::create()
->from('User u')
->where('u.Id =', $userId);

$r = $q->fetchOne();

Note that the question mark in the where method is ommitted. This will return a User model with an Id of 1.

I would expect this to generate an invalid SQL statement (or even fail to pass the DQL validation).

Giving the first record doesn't seem to be appropriate in my opinion.






[DC-970] Diff Tool doesn't generate the down() method if a field attribute is changed in YAML Created: 11/Nov/10  Updated: 07/Apr/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: taha bayrak Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Doctrine 1.2



 Description   

Diff Tool doesn't generate the down() method if a field attribute is changed in YAML. Below is an example

scheme.yaml
    email:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
scheme2.yaml
    email:
      type: string(160)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false

And below is the generated migration class (down() method is missing):

1239898949_Version39.php
class Version39 extends Doctrine_Migration_Base
{
    public function up()
    {
        $this->changeColumn('support_tickets', 'email', 'string', '160', array(
             'fixed' => '0',
             'unsigned' => '',
             'primary' => '',
             'notnull' => '',
             'autoincrement' => '',
             ));
    }

    public function down()
    {

    }
}


 Comments   
Comment by Ton Sharp [ 07/Apr/11 ]

How I can see "changeColumn" doesn't work in the "down" section





[DC-901] Several test cases using CRLF endings Created: 24/Oct/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Damian Bushong Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 7 x86_64, PHP 5.3



 Description   

Hi there. I'm finding several test cases that are using CRLF line endings, instead of the standard UNIX LF line endings as it seems the rest of the codebase uses.

The test case files are as follows:

tests/Ticket/2158TestCase.php
tests/Ticket/2251TestCase.php
tests/Ticket/2334TestCase.php
This is causing my git pull on the doctrine 1 github repository to fail due to so called "unmerged" files, and has rendered my git submodule for doctrine just about useless.

I'd appreciate it if someone would run a fromdos on these files and commit them.






[DC-900] HYDRATE_SINGLE_SCALAR option always returns false Created: 23/Oct/10  Updated: 23/Oct/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Junaid Ebrahim Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu Linux Karmic, Apache 2, Symfony 1.4.3



 Description   

I notice that the fetchone with HYDRATE_SINGLE_SCALAR option always returns false as the return to the $collection object is a string type, this is returned by the hydrateResultSet with driver mode set to 6 (I assume this is for scalar values)

My code is a two table query with which returns a string of "10" (g.id in query below) and returns false because it is not a doctrine collection, I did check the doctrine examples and it seems to be the way its used. Not sure if its the doctrine version issue with symfony, my code or an actual bug

$q = Doctrine_Core::getTable('ClipGroup')
->createQuery('g')
->select('g.id')
->leftJoin('g.sfGuardUser u')
->Where('g.completed_at IS NULL')
->andWhere('g.expires_at > ?', date('Y-m-d H:i:s', time()))
->andWhere('u.id = ?', $userId);
return $q->fetchOne(array(), Doctrine_Core::HYDRATE_SINGLE_SCALAR);

I am using doctrine included in symfony 1.4.3, here is the comment on the Query.php file * @version $Revision: 6792 $,
public function fetchOne($params = array(), $hydrationMode = null)
{
$collection = $this->execute($params, $hydrationMode);

if (count($collection) === 0)

{ return false; }

if ($collection instanceof Doctrine_Collection)

{ return $collection->getFirst(); }

else if (is_array($collection))

{ return array_shift($collection); }

return false;
}

Hydrator.php - returns a string * @version $Revision: 3192 $

public function hydrateResultSet($stmt, $tableAliases)

{ $driver = $this->getHydratorDriver($this->_hydrationMode, $tableAliases); $result = $driver->hydrateResultSet($stmt); return $result; }




[DC-905] Fields with foreign key shouldn't require definition Created: 29/Oct/10  Updated: 31/Oct/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Alaattin Kahramanlar Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File schema.yml    

 Description   

Sample schema attached.

Now, keeping attached schema in mind.

We have core tables that lots of other tables refer via foreign keys to them, like user, company, etc.

We need to explicitly define foreign keys (like user_id) "definitely same as" User.id on each table. By design, this seems unnecessary, and has load on refactoring processes, ie. type change on User.id.

Doctrine is already parsing foreign relations from schema, It can use parent table field definition (User.id) in refering table fields (user_id) and on the schema user_id can be defined as:

user_id: ~






[DC-883] Help for Test CLI does not list available test groups Created: 10/Oct/10  Updated: 17/Apr/14

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Andrew Coulton Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The CLI Test Runner is supposed to print a list of available test groups when used with the --help parameter, but this fails as the Doctrine_Test::run() method erroneously expects php sort() to return an array rather than a boolean.

Fixed by http://github.com/acoulton/doctrine1/tree/DC-883






[DC-805] Test fails randomly (race condition?) Created: 31/Jul/10  Updated: 31/Jul/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Federico Gimenez Nieto Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Debian Lenny 5.0



 Description   

Hi,

During one of my test builds, one of the test cases failed, probably because of a race condition:

Doctrine_Ticket_1441_TestCase : method testTest failed on line 60
Value1: array (
0 => 'test',
1 => '2010-07-10 02:21:34',
2 => 'jwage',
)
!=
Value2: array (
0 => 'test',
1 => '2010-07-10 02:21:35',
2 => 'jwage',
)

Thanks,
Federico






[DC-772] Different test results in different debian boxes Created: 30/Jun/10  Updated: 01/Aug/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Federico Gimenez Nieto Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Debian Lenny 5.0



 Description   

Hi,

I have two different debian boxes, in one of them all test pass but in the other (a very basic system with just the essential packages installed) i get:

Doctrine_Search_TestCase........................................................failed

Unexpected Doctrine_Record_UnknownPropertyException thrown in [Doctrine_Search_TestCase] with message [Unknown record property / related component "SearchTestIndex" on "SearchTest"] in /home/fgimenez/doctrine/Doctrine-1.2.2/lib/Doctrine/Record/Filter/Standard.php on line 55

#0 /home/fgimenez/doctrine/Doctrine-1.2.2/lib/Doctrine/Record.php(1382): Doctrine_Record_Filter_Standard->filterGet(Object(SearchTest), 'SearchTestIndex')
#1 /home/fgimenez/doctrine/Doctrine-1.2.2/lib/Doctrine/Record.php(1337): Doctrine_Record->_get('SearchTestIndex', true)
#2 /home/fgimenez/doctrine/Doctrine-1.2.2/lib/Doctrine/Access.php(72): Doctrine_Record->get('SearchTestIndex')
#3 /home/fgimenez/doctrine/Doctrine-1.2.2/tests/SearchTestCase.php(48): Doctrine_Access->__get('SearchTestIndex')
#4 /home/fgimenez/doctrine/Doctrine-1.2.2/tests/DoctrineTest/UnitTestCase.php(158): Doctrine_Search_TestCase->testBuildingOfSearchRecordDefinition()
#5 /home/fgimenez/doctrine/Doctrine-1.2.2/tests/DoctrineTest/GroupTest.php(75): UnitTestCase->run()
#6 /home/fgimenez/doctrine/Doctrine-1.2.2/tests/DoctrineTest.php(183): GroupTest->run(Object(DoctrineTest_Reporter_Cli), '')
#7 /home/fgimenez/doctrine/Doctrine-1.2.2/tests/run.php(320): DoctrineTest->run()
#8

{main}

I've been trying to determine which is the package that is installed in one box but not in the other and that make the Doctrine_Search_TestCase test pass, no luck so far (same php and sqlite configuration in both environments).

Any hint on this is highly appreciated, cheers

Federico



 Comments   
Comment by Federico Gimenez Nieto [ 01/Aug/10 ]

Hi,

In other words, what are the minimum requirements to run doctrine successfully, including the tests? After uploading the debian package of doctrine to the archive there have been some errors regarding the tests on a clean environment with just the packages php5-cli and php5-sqlite (and its dependencies) installed, see [1]. This used to work on other boxes.

[1] http://people.debian.org/~lucas/logs/2010/07/31/doctrine_1.2.2-1_lsid64.buildlog

Thanks,
Federico





[DC-734] With loading "conservative" or "PEAR", Doctrine_Core::loadModels returns different results for identical calls Created: 14/Jun/10  Updated: 15/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Guilliam X Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Mac OS X 10.5, MAMP 1.9, PHP 5.2.13
Doctrine SVN 1.2 r.7676


Attachments: Text File DC-734.patch    

 Description   

Hello,

Edit: sorry I changed issue subject, please have a look at the first comment



 Comments   
Comment by Guilliam X [ 15/Jun/10 ]

Actually I have some interrogations about the way how loadModels() works...

  • If using conservative or PEAR loading, in the directory listing loop:
    • if a class doesn't exist, it is loaded and added to the array to be returned, without verification (because you can't analyse a class that doesn't exist...);
    • but if it already exists, it is not loaded, and it is only added to the returned array if it is a "valid model class".

So, with our "Foo + BaseFoo" example, the first call to loadModels('models') returns an array with both 'Foo' and 'BaseFoo'. Now if you instantiate class Foo, thanks to modelsAutoload() both classes Foo and BaseFoo will then exist. Then, a 2nd call to loadModels('models') will return an array with only 'Foo' because BaseFoo did not pass at l. 691. So loadModels() is not deterministic...

  • If using aggressive loading, each found file is included immediatly (so, the class he defined now exists),
    1. then I see some "hack" for the possible "birth" of core classes (Doctrine_Access, Doctrine_Record_Abstract and Doctrine_Record in my debug session), but that also allows multiple classes definitions in a single model file, or a file defining a class with an arbitrary classname regardless of filename! This drastically differs form other loading modes!
    2. Then the(each) newly-existing class is not loaded nor added to the result unless it is a valid model; this is a big difference too!

IMHO:

  • although aggressive loading isn't meant to be used for production, it shouldn't differ that much (we should be able to switch loading mode without it causes issues)
  • if loading mode is other than "aggressive", loadModels() should always (not only on first call) return all the models found (recursively) in given directory(ies). If you want an array with only "valid models", either use getLoadedModels() (after loadModels()), or filter the return of loadModels() with filterInvalidModels() (which is already used in Doctrine_Export, Doctrine_Export_Schema, ...)

Edit: oh my... I just found this in documentation:

Aggressive model loading is the default model loading method and is very simple, it will look for all files with a .php extension and will include it. Doctrine can not satisfy any inheritance and if your models extend another model, it cannot include them in the correct order so it is up to you to make sure all dependencies are satisfied in each class.

With aggressive model loading you can have multiple classes per file and the file name is not required to be related to the name of the class inside of the file.

However I still think that loadModels() should return the same array for 2 same (subsequent) calls...

Regards

Comment by Guilliam X [ 15/Jun/10 ]

Attached a suggestion of patch that gives loadModels [different but] deterministic behaviors for both aggressive and non-aggressive loadings:

  • agressive: will always return only names of "valid" models
  • other: will always return all names of loaded models (see previous comment for getting only "valid" ones)




[DC-729] Doctrine_Parser_Xml numeric key in array Created: 12/Jun/10  Updated: 12/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Vitaliy Mayorov Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I convert array with numeric keys to xml and recived error message

Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild]: Element name is required in /home/vital/projects/hino/lib/vendor/symfony-1.4.3/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Parser/Xml.php on line 74

array

array
'id' => string '25' (length=2)
'count' => int 3
'cost' => float 68135.27
'user_id' => string '1' (length=1)
'profile_id' => string '1' (length=1)
'created_at' => string '2010-06-12 14:59:52' (length=19)
'OrderProductList' =>
array
0 =>
array
'id' => string '56' (length=2)
'count' => string '1' (length=1)
'cost' => string '9511.82' (length=7)
'user_id' => string '1' (length=1)
'code_1c' => string '2399' (length=4)
'catalog_number' => string '0446537150' (length=10)
'shot_name' => string 'PAD KIT, DISC BRAKE' (length=19)
'name' => string '' (length=0)
'vin' => string '' (length=0)
'engine_model' => string '' (length=0)
'status_id' => string '1' (length=1)
'transport_id' => string '1' (length=1)
'order_id' => string '25' (length=2)
'Order' => boolean false
1 =>
array
'id' => string '57' (length=2)
'count' => int 1
'cost' => float 55787.49
'user_id' => string '1' (length=1)
'code_1c' => string '2629' (length=4)
'catalog_number' => string '4405037040' (length=10)
'shot_name' => string 'ACTUATOR ASSY, BRAKE' (length=20)
'name' => string '' (length=0)
'vin' => string '' (length=0)
'engine_model' => string '' (length=0)
'status_id' => int 1
'transport_id' => int 1
'order_id' => string '25' (length=2)
'Order' => boolean false
2 =>
array
'id' => string '58' (length=2)
'count' => string '4' (length=1)
'cost' => float 2835.96
'user_id' => string '1' (length=1)
'code_1c' => string '2224' (length=4)
'catalog_number' => string 'S156071562' (length=10)
'shot_name' => string 'ELEMENT SET' (length=11)
'name' => string '' (length=0)
'vin' => string '' (length=0)
'engine_model' => string '' (length=0)
'status_id' => int 1
'transport_id' => int 1
'order_id' => string '25' (length=2)
'Order' => boolean false

in doctrine/Doctrine/Parser/Xml.php on line 74

$key = preg_replace('/[^a-z]/i', '', $key);

if (is_array($value) && ! empty($value)) {
$node = $xml->addChild($key);

$key = preg_replace('/[^a-z]/i', '', $key); from 69 line conver numeric key into empty string






[DC-969] When I add a text field to a mysql table the migration code generated fails Created: 07/May/10  Updated: 23/Feb/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Mauro Chojrin Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux, Symfony 1.4, Doctrine 1.2



 Description   

I am using a database designed using schema.yml with a MySql Server.

When I add a field of type text the generated code for the migrations (using diff) is as follows:

$this->addColumn('<tableName>', '<fieldName>, 'text', '', array(
'notnull' => '',
));

Which produces a MySQL error like this:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1. Failing Query: "ALTER TABLE <tableName> ADD <fieldName> text()"

The solution I found was to manipulate manually the generated class to use an addColumn like this:

$this->addColumn('<tableName>', '<fieldName>, 'text', null, array(
'notnull' => '',
));

Which would generate an SQL statement like this:

ALTER TABLE <tableName> ADD <fieldName> text

Which works fine with MySQL, don't know about other RDBMS



 Comments   
Comment by Siegfried DuDragon [ 23/Feb/11 ]

My understanding is that you need to put a size to the text so it will choose between tinytext, text, mediumtext, bigtext, so instead of
$this->addColumn('<tableName>', '<fieldName>, 'text', '', array(
'notnull' => '',
));
use
$this->addColumn('<tableName>', '<fieldName>, 'text', '<somenumber>', array(
'notnull' => '',
));





[DC-422] Using the ON_DEMAND hydrator a warning a thrown on the last iterator of a foreach Created: 13/Jan/10  Updated: 05/Dec/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Arnaud Limbourg Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

os x 10.6, php 5.3.1


Attachments: Text File Doctrine_Connection_Statement.patch    

 Description   

Used in a symfony project code similar to the following throws a warning on the last iteration of the foreach

$currentQuery = Doctrine_Query::create()
->from('article a');

$result = $currentQuery->execute(array(), Doctrine_Core::HYDRATE_ON_DEMAND);

foreach ($result as $article)

{ echo $article->getId(); }

The warnings are located in the connection profiler.

symfony-1.4/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php on line 196

Warning: join(): Invalid arguments passed in symfony-1.4/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php on line 141

I'm unsure how best to fix it. As far as I can tell there is an issue regarding the call to the iterator rewind at the end of the foreach.

Doctrine_Connection_Statement->execute(???) symfony-1.4/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Collection/OnDemand.php:71



 Comments   
Comment by Jonathan H. Wage [ 01/Mar/10 ]

Sorry, we're gonna need some more information to be able to do anything for this ticket.

Comment by Jonathan H. Wage [ 08/Jun/10 ]

Is this issue a symfony one and not a Doctrine problem? It is hard to tell.

Comment by Marek Snopkowski [ 05/Dec/10 ]

Hi,

It's partially both - symfony doesn't protect itself from NULL params (default value), however when use Doctrine_Core::PORTABILITY_EMPTY_TO_NULL then Doctrine will also generate the same warning.

Btw - symfony does throw this issue only when logging is enabled.

This is a trace tail when when using OnDemand hydrator with foreach.

21 1.1271 26883400 LessonTable->copyTeacherData( ) ../actions.class.php:54
22 1.1604 27817624 Doctrine_Collection_OnDemand->rewind( ) ../OnDemand.php:0
23 1.1604 27784376 Doctrine_Connection_Statement->execute( ) ../OnDemand.php:71
24 1.1605 27785616 Doctrine_EventListener_Chain->preStmtExecute( ) ../Statement.php:231
25 1.1605 27785616 sfDoctrineConnectionProfiler->preStmtExecute( ) ../Chain.php:494
26 1.1606 27788152 sfDoctrineConnectionProfiler::fixParams( ) ../sfDoctrineConnectionProfiler.class.php:146

Suggested patch attached.
We're always expecting $params parameter to be an array, hence array() as default value.





[DC-1059] Generate Entity From Database Created: 27/Sep/12  Updated: 27/Sep/12

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Draeli Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Problem already report here : https://github.com/symfony/symfony/issues/5617#issuecomment-8934524
But the idea is, on generation of entity from database MySQL, Int and Tinyint type are tranform as booelan.






[DC-1042] submitted form accidentally - PLEASE DELETE Created: 30/Nov/11  Updated: 30/Nov/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Trivial
Reporter: Maurice Stephens Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This was accidentally submitted before being complete ... This one can be deleted ... sorry



 Comments   
Comment by Maurice Stephens [ 30/Nov/11 ]

This was accidentally submitted before being complete ... This one can be deleted ... sorry





[DC-1019] **REMOVED SPAM** Created: 14/Jul/11  Updated: 23/Aug/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Documentation Priority: Trivial
Reporter: betty akamissnigger Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

*REMOVED SPAM*



 Description   

*REMOVED SPAM*



 Comments   
Comment by Christian Roy [ 23/Aug/11 ]

This issue was filled with spam text so I removed it.





[DC-915] The PHP code is invalid in the "Create Table" example; there are missing commas in the array definition. Created: 02/Nov/10  Updated: 07/Sep/11

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Matt Alexander Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None

Attachments: PNG File 2010-11-02_123641.png    

 Description   

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/migrations/en#writing-migration-classes:available-operations:create-table

The PHP code is invalid in the "Create Table" example; there are missing commas in the array definition.



 Comments   
Comment by John Kary [ 07/Sep/11 ]

Submitted pull request with fixes:
https://github.com/doctrine/doctrine1-documentation/pull/1





[DC-804] Files' date set to epoch Created: 31/Jul/10  Updated: 31/Jul/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Federico Gimenez Nieto Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

The date for all the files in the 1.2.2 tarball is set to 1970-01-01.

Thanks,
Federico






[DC-731] [Source code format] Transform indent tabs into 4 spaces, and trim trailing spaces Created: 12/Jun/10  Updated: 16/Jun/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Task Priority: Trivial
Reporter: Guilliam X Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Doctrine SVN 1.2 revision 7676


Attachments: Text File DC-731.patch    

 Description   

I have read that Doctrine source code is wanted not to use tabs for indentation / alignement;
and trailing spaces / tabs are useless and polluting.
I made some funny patch

G.X



 Comments   
Comment by Guilliam X [ 15/Jun/10 ]

Edited the patch with "branches/1.2" as root

(I won't provide a test case but they all run without failure after patching)

Comment by Guilliam X [ 16/Jun/10 ]

Converted patch to Unix-like EOL style





Generated at Thu Aug 21 08:20:17 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.