[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-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-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-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-388] Conservative loading not working Created: 26/Dec/09  Updated: 27/Jan/10

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

Type: Bug Priority: Major
Reporter: Karma Dordrak (Drak) Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None
Environment:

Apache 2, MySQL 5.1, PHP 5.2.9, Debian 5



 Description   

Apparently, when setting Doctrine::MODEL_LOADING_CONSERVATIVE things like Doctrine_Core::createTablesFromModels() don't work. Have to enable aggressive model loading. This has been confirmed on the doctrine-user mailing list.

I took a brief look at the code: I may be missing something but it appears there may be a logic difference in the conservative vs. aggressive model loading method. Aggressive loading uses require_once on all files in the model directory and tries to determine the name of the class inside the file (by doing a difference on the loaded classes). This logic makes sense since the class and file name do not have to match.

However, conservative loading just tries to calculate the class name and store it in an array for later loading by the autoloader. This means there is a huge logic difference in behaviour between these two loading methods since the model class files actually must differ depending on case (specifically, the model class file name must follow a specific format to match the actual class name) otherwise the autoload array will never know the correct name of the class.

I would also like to comment that overall, require_once is a poor choice for performance reasons, it's vastly slower than include_once, but overall the logic should better be adjusted to use plain include (if possible), for performance reasons.






[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');





Generated at Thu Apr 24 23:57:30 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.