doctrine / doctrine1 Goto Github PK
View Code? Open in Web Editor NEW[Abandoned - please upgrade to Doctrine 2] Doctrine 1 Object Relational Mapper
Home Page: http://www.doctrine-project.org
License: GNU Lesser General Public License v2.1
[Abandoned - please upgrade to Doctrine 2] Doctrine 1 Object Relational Mapper
Home Page: http://www.doctrine-project.org
License: GNU Lesser General Public License v2.1
The code here calls the function modifyLimitQuery with 5 parameters, so the 6th one Doctrine_Query $queryOrigin = null
is always null.
There is no check for whether it is null before it is used on line 162 and so the code always crashes.
I can't seem to find the API documentation anywhere. Could you please host it somewhere or point me there, if it's online.
If someone else also hit the problem with MySQL 5.7+
Expression #1 of ORDER BY clause is not in SELECT list,
There is a easy fix by adding 'mysql' driver name (last OR below, originally is missing) to the Query.php file at line 1417 (as now MySQL also require order by fields to be preserved in select clause):
// pgsql & oracle need the order by fields to be preserved in select clause if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc' || $driverName = 'mysql') {
It's a shame that Doctrine 1 JIRA issues have not beed migrated to github. Some people are still using Doctrine 1 and have no chance to migrate to 2.
e.g. I wanted to get some info about the bug I reported several years ago, as I encoutered it again: http://webcache.googleusercontent.com/search?q=cache:KpYEn6DJfp8J:www.doctrine-project.org/jira/browse/DC-313%3Fpage%3Dcom.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel+&cd=1&hl=pl&ct=clnk&gl=pl
It's only a matter of short time when that will be gone for good, also from google.
Why only integer columns can have autoincrement?
I have column, which type is 'smallint' & I want to set it to be autoincrement. How can I do that?
Using ->limit() in conjunction with many-to-many relationships with mysql leads to strange SQL generated. The condition id IS NULL is added in such case which is not correct at all.
Here's example schema
User:
columns:
username: { type: string(255) }
relations:
Operators:
foreignAlias: Users
class: Operator
refClass: OperatorUser
Operator:
columns:
username: { type: string(255) }
type: { type: integer }
OperatorUser:
columns:
user_id: { type: integer }
operator_id: { type: integer }
relations:
Operator:
foreignAlias: OperatorUser
User:
foreignAlias: OperatorUser
And here's query which generates wrong SQL
<?php
Doctrine_Core::getTable('User')
->createQuery('User')
->leftJoin('User.Operators Operator')
->addWhere('Operator.type = ?', 1)
->limit(10)
->offset(0)
->execute()
;
(alternatively you can play in sandbox here https://github.com/eafonichev/doctrine-issue )
Expected SQL generated:
SELECT u.id AS u__id, u.username AS u__username, o.id AS o__id, o.username AS o__username, o.type AS o__type
FROM user u
LEFT JOIN operator_user o2 ON (u.id = o2.user_id)
LEFT JOIN operator o ON o.id = o2.operator_id
WHERE (o.type = '1')
LIMIT 10
Actual SQL generated:
SELECT u.id AS u__id, u.username AS u__username, o.id AS o__id, o.username AS o__username, o.type AS o__type
FROM user u
LEFT JOIN operator_user o2 ON (u.id = o2.user_id)
LEFT JOIN operator o ON o.id = o2.operator_id
WHERE
u.id IS NULL # is not expected
AND (o.type = '1')
# there's no LIMIT clause
Seems like here's code which causes the bug https://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Query.php#L1307
I need to composer install 1.2.2 so it'd be great to have this version tagged
Code from http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Import/Pgsql.php
'listTableColumns' => "SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, is_nullable as isnotnull, column_default as default, ( SELECT 't' FROM pg_index, pg_attribute a, pg_class c, pg_type t WHERE c.relname = table_name AND a.attname = column_name AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.oid = pg_index.indrelid AND a.attnum = ANY (pg_index.indkey) AND pg_index.indisprimary = 't' ) as pri, character_maximum_length as length FROM information_schema.COLUMNS WHERE table_name = %s ORDER BY ordinal_position",
Code from package: http://www.doctrine-project.org/downloads/Doctrine-1.2.3.tgz
'listTableColumns' => "SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype AS typtype, is_nullable as isnotnull, column_default as default, ( SELECT 't' FROM pg_index, pg_attribute a, pg_class c, pg_type t WHERE c.relname = table_name AND a.attname = column_name AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.oid = pg_index.indrelid AND a.attnum = ANY (pg_index.indkey) AND pg_index.indisprimary = 't' AND format_type(a.atttypid, a.atttypmod) NOT LIKE 'information_schema%%' ) as pri, character_maximum_length as length FROM information_schema.COLUMNS WHERE table_name = %s ORDER BY ordinal_position",
Code from the package when generating model returns an error:
SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ...^. Failing Query: " SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype AS typtype, is_nullable as isnotnull, column_default as default, ( SELECT 't' FROM pg_index, pg_attribute a, pg_class c, pg_type t WHERE c.relname = table_name AND a.attname = column_name AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.oid = pg_index.indrelid AND a.attnum = ANY (pg_index.indkey) AND pg_index.indisprimary = 't' AND format_type(a.atttypid, a.atttypmod) NOT LIKE 'information_schema%' ) as pri, character_maximum_length as length FROM information_schema.COLUMNS WHERE table_name = 'flashinfo' ORDER BY ordinal_position"
According to the docs, createQuery()
method creates a new Doctrine_Query
object that operates on connection object the method was executed against. This is not true, if this connection is not a current connection.
Consider the following example:
$conn1 = Doctrine_Manager::connection($pdo);
$conn2 = Doctrine_Manager::connection($pdo);
// here Doctrine_Manager::getCurrentConnection() === $conn2
$query = $conn1->createQuery();
// $query->getConnection() returns $conn2 instead of $conn1
To fix this add $this
as the first parameter to Doctrine_Query::create()
in createQuery()
method in Doctrine/Connection.php
file.
Documentation flaw: Doctrine_Connection_UnitOfWork#saveGraph
line#47 @return void (change to @return boolean)
Feature Request: Doctrine_Record#save
line#1718 $conn->unitOfWork->saveGraph($this); (change to return $conn->unitOfWork->saveGraph($this); )
Now the return from UnitOfWork#saveGraph can actually do something and let me know if me record was actually saved.
Hi there,
I need original source files of Doctrine 1.1.6, is there any possibility to get those?
I've searched through web, but unfortunatelly I found nothing. The problem is that, in our project repository we have modified version of Doctrine 1.1.6, and we need to upgrade. First we should check if there are any crucial changes. Saddly, changes where made before the source files where added to repository, so we don't have a clue, how it loooked like before. Thank you for help.
For some of our legacy projects we had a composer dependency to doctrine/doctrine1, since a few days all tags seem to be missing from packagist, except dev-master.
https://packagist.org/packages/doctrine/doctrine1
This repository does still seem to have tags, but I could not find any information about why the tags are suddenly missing on packagist. Is it possible to recreate some stable tags or provide some more information about the tags being deleted ?
Seems to be the right place where to load also Base classes.
The CLI entry file seems to be in tools/sandbox/doctrine. Why in 'sandbox/'?
And how can I change the base path?
I actually want to use the project folder (above 'vendor/') as the base path.
Hi there. I'm finding several test cases that are using CRLF line endings, instead of unix LF line endings as it seems the rest of the codebase uses.
The test case files are as follows:
This is causing my pull&merge in git to require manual intervention (as I force it to use LF), so I would appreciate it if this could be cleaned up if it isn't that much of a bother. :)
Hi team,
Here is some correction for PHP 7.0.0:
Doctrine/Collection.php - line 463
- $record->$relation['alias'] = $this->reference;
+ $record->{$relation['alias']} = $this->reference;
Doctrine/Query/Abstract.php - line 1122
- $record->$callback['callback']($event);
- $table->getRecordListener()->$callback['callback']($event);
+ $record->{$callback['callback']($event)};
+ $table->getRecordListener()->{$callback['callback']($event)};
Index: Formatter.php =================================================================== --- Formatter.php (revision 2) +++ Formatter.php (working copy) @@ -171,6 +171,7 @@ case 'bool': case 'decimal': case 'int': + case 'bigint': return $input; case 'array': case 'object':
And will be nice create default case for it.
Hi,
I have one issue on build-schema on Oracle database.
I have one database and already configured on database.yml.
Current situation, when doctrine execute this query -
SELECT tc.column_name, data_type,
CASE WHEN data_type = 'NUMBER' THEN data_precision ELSE data_length END AS data_length,
nullable, data_default, data_scale, data_precision, pk.primary
FROM all_tab_columns tc
LEFT JOIN (
select 'primary' primary, cc.table_name, cc.column_name from all_constraints cons
join all_cons_columns cc on cons.constraint_name = cc.constraint_name
where cons.constraint_type = 'P'
) pk ON pk.column_name = tc.column_name and pk.table_name = tc.table_name
WHERE tc.table_name = :tableName ORDER BY column_id
there's another schema had the same table name with my current database connection in database.yml. Doctrine generate all fields that it found from above query. After generate my doctrine model & form and execute a query to list all the data in the table, it's throw an exception ORA-00904, unexisting column in database.
It's there any solution that I can set the table owner so above query will have additional condition like this:
tc.owner = :schemaowner.
TQ.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.