[TYPO3-mvc] How to cope with anonymous FE user entries
Thomas Hucke
thucke at web.de
Mon Mar 12 20:37:51 CET 2012
Hi Bastian,
thank you very much for your suggestions.
I decided to simply map all anonymous votings to a special FE user which
takes this role.
That seemed the easiest and most capable way for me to handle this issue.
BTW: Runs fine!
Regards
Thomas
"Bastian Waidelich" schrieb im Newsbeitrag
news:mailman.1.1331550224.31395.typo3-project-typo3v4mvc at lists.typo3.org...
Thomas Hucke wrote:
Hi Thomas,
> I write an extension (th_rating) to do ratings of any object.
> [...]
> No I reached a request to allow anonymous ratings (
> http://forge.typo3.org/issues/34436 ).
> How can I model that?
> Obviously extbase needs a valid FE user to handle a create-action.
No, only if you expect a Tx_Extbase_Domain_Model_FrontendUser the
specified uid needs to belong to a valid FE user record.
What about s.th. like:
class Tx_YourExt_Domain_Model_Voter extends
Tx_Extbase_DomainObject_AbstractEntity {
/**
* The voter of this object
*
* @var Tx_Extbase_Domain_Model_FrontendUser
* @lazy
*/
protected $frontendUser;
public function isAnonymous() {
return $this->frontendUser === NULL;
}
public function getFrontendUser() {
// ...
}
public function setFrontendUser(Tx_Extbase_Domain_Model_FrontendUser
$frontendUser) {
// ...
}
}
And then
// ...
/**
* The voter of this object
*
* @var Tx_YourExt_Domain_Model_Voter
* @lazy
*/
protected $voter;
/**
* Sets the voter of this vote
*
* @param Tx_YourExt_Domain_Model_Voter $voter
* @return void
*/
public function setVoter(Tx_YourExt_Domain_Model_Voter $voter) {
$this->voter = $voter;
}
/**
* Returns the voter of this vote
*
* @return Tx_YourExt_Domain_Model_Voter
*/
public function getVoter() {
return $this->voter;
}
// ...
in your vote Domain Model?
Bastian
More information about the TYPO3-project-typo3v4mvc
mailing list