[TYPO3-mvc] [Extbase] Object doesn't get initialized.
Stephan Schreiter
sphn82 at googlemail.com
Fri Oct 15 05:01:30 CEST 2010
Hello and many thanks for having a look into my issue.
On Thu, 14 Oct 2010 23:33:14 +0300, Christine Gerpheide wrote:
> Hello,
>
> 2010/10/14 Alexander Dick <alex at dick.at>
>
>
>> Hi,
>>
>> Try to remove the assignment in your constructor: $this->items = new
>> Tx_Extbase_Persistence_ObjectStorage;
>>
>>
>> >> $this->items = new Tx_Extbase_Persistence_ObjectStorage;
>> >>
>> >>
>>
> It also seems to me that this line should have had parentheses on the
> end of it:
> $this->items = new Tx_Extbase_Persistence_ObjectStorage();
>
> Christine
I have tried the proposed changes but unfortunately taking away the
constructor (@Alex) didn't make a difference nor did adding the
parentheses (@Christine). I also do have a setter method (@Franz Koch)
and rewriting the constructor to
public function __construct() {
$this->setItems(new Tx_Extbase_Persistence_ObjectStorage);
}
as I have seen in some other examples doesn't do the trick either.
The thing I wonder about is why the same code does work very well with
similar objects (in 1:n relation for example) related to my
'main_domain_model'.
For me it seems to be somehow caused by the user repository
class Tx_MyExt_Domain_Repository_UserRepository extends
Tx_Extbase_Persistence_Repository {
}
Could there be a problem here because my user model extends
'Tx_Extbase_Domain_Model_FrontendUser' shipped with extbase and mapping
to the fe_users table?
I have already extended the fe_users table with the field
CREATE TABLE fe_users (
tx_myext_items int(11) DEFAULT '0' NOT NULL
);
and the tx_myext_domain_model_item table contains the field
user int(11) DEFAULT '0' NOT NULL,
Again many thanks for every helpful hint and advice.
Best regards,
Stephan
More information about the TYPO3-project-typo3v4mvc
mailing list