developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 11 years ago

Closed 11 years ago

#974 closed bug (invalid)

[dao] SelectFirst et OrderItem

Reported by: zragg Owned by:
Priority: normal Milestone:
Component: jelix:dao Version: 1.0.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Lors de la création d'un méthode XML pour une requête de type selectfirst la condition orderitem n'est pas pris en compte (et cela sans généré d'erreur comme pour limit)

        <method name="getIt" type="selectfirst">
            <parameter name="cible" default="1" />
            <values>
              <property name="auteur" />
              <property name="texte" />
            </values>
            <conditions logic="and">
                <eq property="isModerated" value="1" />
                <eq property="isCensure" value="0" />
                <lteq property="id" expr="$cible" />
            </conditions>
            <orderitem property="id" way="desc" />

génère le code

 function getIt ( $cible='1'){
    $__query =  $this->_selectClause.$this->_fromClause.$this->_whereClause;
$__query .=' WHERE  `citations`.`isModerated` = 1 AND `citations`.`isCensure` = 0 AND `citations`.`id` '.'<='.intval($cible).'';
    $__rs = $this->_conn->limitQuery($__query,0,1);
    $__rs->setFetchMode(8,'cDaoRecord_citation_Jx_citation_Jx_mysql');
    return $__rs->fetch();
}

au lieu de

 function getIt ( $cible='1'){
    $__query =  $this->_selectClause.$this->_fromClause.$this->_whereClause;
$__query .=' WHERE  `citations`.`isModerated` = 1 AND `citations`.`isCensure` = 0 AND `citations`.`id` '.'<='.intval($cible).' ORDER BY `citations`.`id` desc';
    $__rs = $this->_conn->limitQuery($__query,0,1);
    $__rs->setFetchMode(8,'cDaoRecord_citation_Jx_citation_Jx_mysql');
    return $__rs->fetch();
}

Change History (4)

comment:1 Changed 11 years ago by laurentj

  • Milestone set to Jelix 1.0.11
  • Version changed from 1.1.3 to 1.0.10

Certainement sur 1.0 aussi...

comment:2 follow-up: Changed 11 years ago by bballizlife

With the right xml code you would get it works. See the documentation :

<order>
    <orderitem property="id" way="desc" />
</order>

comment:3 in reply to: ↑ 2 Changed 11 years ago by zragg

Oupsss, c'est bien une bourde de ma part. Il manquait la balise order

Reste que malgré un XML invalide, un DAO est généré.

sinon, c'est bien Jelix 1.1.3

; --- build date:  2009-06-17 11:09
; --- lib version: 1.1.3
PHP_VERSION_TARGET=5.2
EDITION_NAME=dev
ENABLE_PHP_FILTER=1
ENABLE_PHP_JSON=1
ENABLE_PHP_XMLRPC=0
ENABLE_PHP_JELIX=0
WITH_BYTECODE_CACHE=auto
ENABLE_DEVELOPER=1
ENABLE_OPTIMIZED_SOURCE=0
STRIP_COMMENT=0
ENABLE_OLD_CLASS_NAMING=0
ENABLE_OLD_ACTION_SELECTOR=0
SVN_REVISION=1433

comment:4 Changed 11 years ago by laurentj

  • Milestone Jelix 1.0.11 deleted
  • Resolution set to invalid
  • Status changed from new to closed

ok.. le ticket est donc invalide.

J'ai crée un autre ticket pour les histoires de parser plus stricts. #975

Note: See TracTickets for help on using tickets.