[TYPO3-german] Extbase - Cannot redeclare class...

Thomas Nussbaumer typo3 at thomasnu.ch
Sat May 10 11:59:01 CEST 2014


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/CruiseRepository.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_CruiseRepository');
> 	$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.
>



More information about the TYPO3-german mailing list