derhansen / sf_event_mgt_extend_demo

A TYPO3 CMS demo extension which shows, how to extend existing tables in sf_event_mgt
Other
3 stars 1 forks source link

Please extend with Domain/Repository example #8

Closed woepwoep closed 4 years ago

woepwoep commented 4 years ago

Please extend the example with an example of Repository function.

Example:

<code>
        /**
         * Returns number of registrations for the given event where paid=1
         *
         * @param \RedSeadog\SfeventmgtExtend\Domain\Model\Event $event Event
         *
         * @return int
         */
        public function nrOfPaidRegistrations($event)
        {
                // setup $query
                $query = $this->createQuery();

                // search for registrations for this $event where paid=1
                $constraints = [];
                $constraints[] = $query->equals('event',$event);
                $constraints[] = $query->equals('paid',1);
                $query->matching(
                        $query->LogicalAnd($constraints)
                );

                // return result
                return $query->execute()->count();
        }
</code>
derhansen commented 4 years ago

Is this required for documentation purposes or do you need a working example?

woepwoep commented 4 years ago

I need a working example. Thx Ron.

derhansen commented 4 years ago

Either just extend the registrationRepository and use this in your code or use Xclass.

But from looking at your code I would suggest to extend the Event class and add an additional getter, which iterates over all registrations, counts all paid registration and returns the value.

woepwoep commented 4 years ago

i get the following message

1233180480 TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedMethodException

The method "getNextFactuurnr" is not supported by the repository.

this was not the case in T3v7. so possibly there is something wrong in my code?

could you have a look pls? the code is here: https://github.com/woepwoep/sfeventmgt_extend/blob/master/Classes/Domain/Repository/RegistrationRepository.php and the mapping is here: https://github.com/woepwoep/sfeventmgt_extend/blob/master/Configuration/TypoScript/setup.txt

thx Ron

derhansen commented 4 years ago

Please have a look at the original repository - https://github.com/derhansen/sf_event_mgt_extend_demo

It shows how to extend the extension (possibly not a Repository, but that mainly works similar as shown)

Please keep in mind, that TYPO3 major updates always include breaking changes. From v7 to v9 several things changed in v9, so you can't expect that code from v7 will do the same on v9. I strongly recommend you to extend the sf_event_mgt extension using XClass as shown in the original demo extension (ext_localconf.php). Also have a look at ext_typoscript_setup.txt, where the table mapping should be configured.

Please also note, that this topic currently goes far away from what can provide as support for sf_event_mgt, since the topic currently is about extending Extbase extensions in general.

woepwoep commented 4 years ago

Hi Torben, sorry to bother you (again). I came to understand that the problem might be that i use php7.2 instead of php5.x I will close this issue. Thanks Ron