[TYPO3-german] Extbase - Cannot redeclare class...
JCL - Johannes C. Laxander
jc at laxander.com
Sat May 10 14:16:13 CEST 2014
Hallo Thomas,
und schon bin ich wieder da... ;-)
Fatal error: Cannot access empty property in /.../sc_cruise_plan/Classes/Controller/CruiseController.php on line 68
Das ist aus deinem Vorschlag die Zeile:
$this->view->assign('cruises',
$this->$cruiseRepository->findBySelectedCriteria($this->settings));
Hier nochmal der Code meiner Repository-Klasse (den Namen musste ich nach der von dir vorschlagenen Änderung von "Tx_ScCruisePlan_Repository_CruiseRepository" in "Tx_ScCruisePlan_Domain_Repository_CruiseRepository" andern):
/**
* @package sc_cruise_plan
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Tx_ScCruisePlan_Domain_Repository_CruiseRepository extends
Tx_Extbase_Persistence_Repository {
public function findBySelectedCriteria($settings) {
$query = $this->createQuery();
$constraints = array();
$constraints[] = $query->greaterThan('cruiseStartDate', time());
...hier werden noch weitere Bedingungen in $constraints ergänzt...
$query->matching($query->logicalAnd($constraints));
return $query->execute();
}
}
Hast noch so eine geniale Idee wie zuvor??? Schon mal ein dickes Danke für deine Bemühungen :-)
Gruß, Johannes.
> Hallo Thomas,
>
> danke das scheint geholfen zu haben, zumindest habe ich jetzt
> einen andern / neuen Fehler ;-) Ich melde mich ggf. wieder hier...
>
> Gruß, Johannes.
>
> > -----Ursprüngliche Nachricht-----
> > Von: typo3-german-bounces at lists.typo3.org
> > [mailto:typo3-german-bounces at lists.typo3.org] Im Auftrag von Thomas
> > Nussbaumer
> > Gesendet: Samstag, 10. Mai 2014 11:59
> > An: typo3-german at lists.typo3.org
> > Betreff: Re: [TYPO3-german] Extbase - Cannot redeclare class...
> >
> > Hallo Johannes
> >
> > Verwende im Controller Dependency Injection:
> > /**
> > * @var Tx_ScCruisePlan_Domain_Repository_CruiseRepository
> > * @inject
> > */
> > protected $cruiseRepository;
> >
> > public function listAction() {
> > $this->view->assign('cruises',
> > $this->$cruiseRepository->findBySelectedCriteria($this->settings));
> > }
> >
> > Liebe Grüsse. Thomas
> >
> > Am 09.05.2014 15:55, schrieb JCL - Johannes C. Laxander:
> > > Hallo,
> > >
> > > ich schreibe gerade an einer Extension unter TYPO3 /
> > Extbase 4.7, habe aber noch wenig Erfahrung in der
> > Extension-Programmierung und weiß deshalb nicht was die Ursache für
> > diese Fehlermeldung ist:
> > >
> > > Fatal error: Cannot redeclare class
> > > Tx_ScCruisePlan_Repository_CruiseRepository in
> > >
> > /.../ext/sc_cruise_plan/Classes/Domain/Repository/CruiseReposi
> > tory.php
> > > on line 92
> > >
> > > Ich verstehe, dass eine erneute Deklaration / Instanzierung
> > (?) der Klasse nicht möglich ist. Aber aus dem Code heraus
> erkennich
> > nicht wo das passiert, bzw. wie ich es richtig machen muss.
> > >
> > > Im Controller habe ich folgenden Code:
> > >
> > > public function listAction() {
> > > $cruiseRepository =
> > t3lib_div::makeInstance('Tx_ScCruisePlan_Domain_Repository_Cru
> > iseRepository');
> > > $this->view->assign('cruises',
> > > $this->findBySelectedCriteria($this->settings));
> > > }
> > >
> > >
> > > Der Code meiner Repository-Klasse sieht so aus:
> > >
> > > class Tx_ScCruisePlan_Repository_CruiseRepository extends
> > > Tx_Extbase_Persistence_Repository {
> > >
> > > public function findBySelectedCriteria($settings) {
> > >
> > > $query = $this->createQuery();
> > > $constraints = array();
> > >
> > > $constraints[] =
> > $query->greaterThan('cruiseStartDate', time());
> > > ...
> > > $query->matching($query->logicalAnd($constraints));
> > > return $query->execute();
> > > }
> > > }
> > >
> > > Was mache ich falsch?
> > >
> > > Gruß, Johannes.
> > >
> >
> > _______________________________________________
> > TYPO3-german mailing list
> > TYPO3-german at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
> >
>
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>
More information about the TYPO3-german
mailing list