gpt4 book ai didi

php - Doctrine Fatal Error - 未知关系别名

转载 作者:行者123 更新时间:2023-12-02 07:52:53 31 4
gpt4 key购买 nike

我收到以下错误消息:

Doctrine_Table_Exception: Unknown relation alias shoesTable in /home/public_html/projects/giftshoes/system/database/doctrine/Doctrine/Relation/Parser.php on line 237

我在 Codeigniter 中使用 doctrine 1.2.2

我的代码如下:(BaseShoes.php 和 Shoes.php 是自动生成的)

------------BaseShoes------------

<?php
// Connection Component Binding
Doctrine_Manager::getInstance()->bindComponent('Shoes', 'sadiqsof_giftshoes');

/**
* BaseShoes
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @property integer $sku
* @property string $name
* @property string $keywords
* @property string $description
* @property string $manufacturer
* @property float $sale_price
* @property float $price
* @property string $url
* @property string $image
* @property string $category
* @property Doctrine_Collection $Viewes
*
* @package ##PACKAGE##
* @subpackage ##SUBPACKAGE##
* @author ##NAME## <##EMAIL##>
* @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $
*/
abstract class BaseShoes extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('shoes');
$this->hasColumn('sku', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => false,
'length' => '4',
));
$this->hasColumn('name', 'string', 255, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '255',
));
$this->hasColumn('keywords', 'string', 255, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '255',
));
$this->hasColumn('description', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('manufacturer', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('sale_price', 'float', null, array(
'type' => 'float',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('price', 'float', null, array(
'type' => 'float',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('url', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('image', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('category', 'string', 50, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '50',
));
}

public function setUp()
{
parent::setUp();
$this->hasMany('Viewes', array(
'local' => 'sku',
'foreign' => 'sku'));
}
}

----------------鞋 table --------

<?php
class ShoesTable extends Doctrine_Table
{
function getAllShoes($from = 0, $total = 15)
{
$q = Doctrine_Query::create()
->from('Shoes')
->limit($total)
->offset($from);

return $q->execute(array(), Doctrine::HYDRATE_ARRAY);
}

}

----------------鞋款----------------

<?php

/**
* Shoes
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @package ##PACKAGE##
* @subpackage ##SUBPACKAGE##
* @author ##NAME## <##EMAIL##>
* @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $
*/
class Shoes extends BaseShoes
{
function __construct() {
parent::__construct();
$this->shoesTable = Doctrine::getTable('Shoes');
}

function getAllShoes()
{
return $this->shoesTable->getAllShoes();
}

}

最佳答案

对于其他寻找答案的人,我遇到了这个错误消息,因为我有

Doctrine_Query::create()->from('Subscription s')->innerJoin('BillingPlan b')

代替

Doctrine_Query::create()->from('Subscription s')->innerJoin('s.BillingPlan b')

关系需要相对于 from() 中列出的模型

关于php - Doctrine Fatal Error - 未知关系别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2648961/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com