developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
#487 closed enhancement (fixed)
Impossibility to indicate our own conditions in jControllerDaoCrud
Reported by: | laurentj | Owned by: | bastnic |
---|---|---|---|
Priority: | normal | Milestone: | Jelix 1.0.3 |
Component: | jelix:controllers | Version: | 1.0.2 |
Severity: | normal | Keywords: | jcontrollerdaocrud crud |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
We cannot specify conditions to list records without overloading entirely index() method. jDaoConditions object should be passed as a parameter to _index(), or an other protected method should be provided.
Attachments (2)
Change History (9)
Changed 13 years ago by bastnic
comment:1 Changed 13 years ago by bastnic
comment:2 Changed 13 years ago by bastnic
- review set to review?
comment:3 Changed 13 years ago by laurentj
- review changed from review? to review-
Je pense qu'il vaut mieux migrer le foreach $this->propertiesForRecordsOrder dans la nouvelle méthode (que l'on nommerait du coup plutôt _indexSetConditions). Ainsi, si on veut garder ces orders, on peut faire appels à la méthode d'origine, sinon on peut aussi changer toutes les conditions et les orders.
De plus, il ne faut pas oublier de changer le countAll en countBy.
Par contre je ne suis pas sûr qu'il faille passer l'objet $dao. Tu as un cas d'utilisation où cela serait utile ?
comment:4 Changed 13 years ago by bastnic
- Owner set to bastnic
- review changed from review- to review?
- Status changed from new to assigned
Pour le dao je l'ai mis au cas où sans vraiment y réfléchir me disant que c'était en rapport avec les conditions mais c'est vrai que pour l'instant pas encore eu besoin.
J'ai normalement tout corrigé. Si on veut juste ajouter des conditions en gardant l'ordre par propertiesForRecordsOrder :
protected function _indexSetConditions($cond) { parent::_indexSetConditions($cond); $cond->addCondition('id','!=',4); }
Pour tout écraser :
protected function _indexSetConditions($cond) { }
Changed 13 years ago by bastnic
comment:6 Changed 13 years ago by laurentj
- Milestone changed from Jelix 1.1 to Jelix 1.0.1
- Resolution set to fixed
- Status changed from assigned to closed
Fixed in the trunk and 1.0.x branch. svn 799.
Thanks for this patch.
comment:7 Changed 13 years ago by bastnic
- Milestone changed from Jelix 1.0.1 to Jelix 1.0.3
Merci pour la validation et le checkin.
ça n'a aucun sens de mettre en milestone 1.0.1 non ?
Voici un patch. Exemple d'utilisation :