[TYPO3-english] add, edit Tx_RoqNewsevent_Domain_Model_Event from frontend

Vikram Mandal vikram at fivee.in
Sat Feb 28 05:45:14 CET 2015


FYI,

My problem got resolved in the latest Typo3 release 7.1.
Thank you Typo3 7.1 team!

regards
Vikram

On 02/24/2015 05:51 PM, Vikram Mandal wrote:
> Hi,
>
> Found a way to get some of it working.
>
> If I use findByUid() I get all the fields including those added by
> Roq_Newsevent
>
> $this->eventRepository->findByUid($eventItemId);
>
> I was getting null objects in the controller function. I can use
> findByUid() to init them. But this adds more issues as now I need to
> manually get all arguments and update/create new objects.
>
> I saw Roq_Newsevent using findByUid() in its code ..so I guess this is
> the only way??
>
> It would be great know if any one have more inputs on why this way or
> how could it better done.
>
> IMHO: Also it seem like (i may be wrong) Roq_Newsevent is not following
> the right way to extending news
> https://github.com/TYPO3-extensions/news/blob/master/Documentation/Tutorial/ExtendingNews/Index.rst
>
> e.g The naming of model is not correct.
>
> Thanks to Roq_Newsevent for the nice free extension.
>
> Thanks
> - Vikram
>
>
> On 02/24/2015 01:05 PM, Vikram Mandal wrote:
>> Hi,
>>
>> It seems to be some other reason. I have removed every thing and just
>> kept list and edit actions.
>>
>> In edit fluid I only added:
>> <f:debug title="eventItem">{eventItem}</f:debug>
>> And still I get "An error occurred while trying to call
>> ...\Controller\EventsController->editAction()"
>>
>> It seems like typo3 is not able to get instances of
>> Tx_RoqNewsevent_Domain_Model_Event sent in the parameter.
>>
>> In Typo3 6.2.9 .. I do not get any Typo3 debug error
>> But in TYpo3 7.0.2 I get error that table for
>> Tx_RoqNewsevent_Domain_Model_Event does not exist... and this is true
>> since Roq_Newsevent extension extends News.
>>
>> Now I use Tx_News_Domain_Model_News then all works fine but I can not
>> access the fields added by Roq_Newsevent.
>>
>> So I guess I am missing some thing while accessing extended fields added
>> by another extension (i.e.Roq_Newsevent)
>>
>> regards
>> Vikram
>>
>>
>>
>>
>>
>>
>> On 02/24/2015 02:20 AM, Richard Davies wrote:
>>> Hi Vikram,
>>>
>>> Add action:
>>> Your action has a parameter of "$eventItem". In your List template
>>> there is
>>> no 'eventItem' mentioned in your f:link.action. Typo3 is looking for
>>> that
>>> param but can't find it.
>>> It isn't completely clear what you want your 'add' to do, but hopefully
>>> this should help:
>>> Add a form instead of the link. Then in your action you can save it to
>>> the
>>> database:
>>> So where you have
>>>
>>>> <f:link.action action="add" controller="Events" >Add
>>>> Event</f:link.action>
>>>>
>>> You could have a form similar to:
>>>
>>>> <f:form name="eventItem" action="add" object="{event}"
>>>> controller="Events"
>>>> enctype="multipart/form-data">
>>>>                  <f:form.textfield id="title" property="title"
>>>> size="46" />
>>>>                  <f:form.submit value="Add Event" />
>>>>              </f:form>
>>>>
>>>
>>> In your action you will then need:
>>>
>>>> public function addAction(Tx_RoqNewsevent_Doma
>>>> in_Model_Event $eventItem) {
>>>>                  $this->eventRepository->add($eventItem); //add it to
>>>> the
>>>> database
>>>>
>>>                  //code here should send to list view or edit view
>>>>
>>>          }
>>>>
>>>
>>> At the end of the event you can send the user to the list view or
>>> another
>>> view using a forward or redirect.
>>>
>>>
>>> In your edit form you have
>>>
>>>> objectName"{eventItem}"
>>>>
>>> missing the = between them
>>>
>>>> objectName = "{eventItem}"
>>>>
>>>
>>>
>>> I'm not 100% sure if that is the reason why your edit isn't working -
>>> there
>>> should be more debug information.
>>> If you want your edit to load the information the field it maps to,
>>> add the
>>> value:
>>>
>>>> <f:form.textfield id="title" property="title" size="46" />
>>>>
>>> to
>>>
>>>> <f:form.textfield id="title" value="{title}" property="title"
>>>> size="46" />
>>>>
>>>
>>> Hopefully that helps.
>>> Richard
>>>
>>> On 23 February 2015 at 18:46, Vikram <vikram at fivee.in> wrote:
>>>
>>>> Hi Richard,
>>>>
>>>> Thanks for responding .. here is the fluid template code:
>>>> http://www.codeshare.io/N3uU6
>>>>
>>>> regards
>>>> Vikram
>>>>
>>>>
>>>> On 02/23/2015 02:32 AM, Richard Davies wrote:
>>>>
>>>>> Hey Vikram,
>>>>>
>>>>> Can you show us the section of the fluid template in which you
>>>>> create the
>>>>> link / form to the edit action?
>>>>>
>>>>> Richard
>>>>>
>>>>> On 22 February 2015 at 01:02, Vikram <vikram at fivee.in> wrote:
>>>>>
>>>>>   Hi,
>>>>>>
>>>>>> I am trying to edit and add Tx_RoqNewsevent_Domain_Model_Event
>>>>>> records
>>>>>> from frontend.
>>>>>>
>>>>>> Tx_RoqNewsevent_Domain_Model_Event extends tx_news and it adds fews
>>>>>> fields.
>>>>>>
>>>>>> While listing works fine but
>>>>>>
>>>>>> But in my add action I get error:
>>>>>>    Required argument "eventItem" is not set
>>>>>>
>>>>>>
>>>>>> In edit action I get:
>>>>>> An error occurred while trying to call ..Controller\EventsController-
>>>>>>
>>>>>>> editAction().
>>>>>>>
>>>>>>
>>>>>> Any suggestion where i must look?
>>>>>>
>>>>>> The code works fine if i use news objects. but then i am not able
>>>>>> to set
>>>>>> values to fields added by Roq_Newsevent
>>>>>>
>>>>>> ---my controller code---
>>>>>> <?php
>>>>>> namespace T3IN\T3inEvents\Controller;
>>>>>>
>>>>>> /**
>>>>>>    * EventsController
>>>>>>    */
>>>>>> class EventsController extends \TYPO3\CMS\Extbase\Mvc\
>>>>>> Controller\ActionController
>>>>>> {
>>>>>>
>>>>>>           /**
>>>>>>            * eventRepository
>>>>>>            *
>>>>>>            * @var Tx_RoqNewsevent_Domain_Repository_EventRepository
>>>>>>            * @inject
>>>>>>            */
>>>>>>           protected $eventRepository;
>>>>>>
>>>>>>           /**
>>>>>>            * action list
>>>>>>            * @return void
>>>>>>            */
>>>>>>           public function listAction() {
>>>>>>                   $eventRecords = $this->eventRepository->findAll();
>>>>>>                   $this->view->assign('eventRecords', $eventRecords);
>>>>>>           }
>>>>>>
>>>>>>
>>>>>>           /**
>>>>>>            * action edit
>>>>>>            * @param Tx_RoqNewsevent_Domain_Model_Event $eventItem
>>>>>>            * @return string
>>>>>>            */
>>>>>>           public function
>>>>>> editAction(Tx_RoqNewsevent_Domain_Model_Event
>>>>>> $eventItem) {
>>>>>>                   $this->view->assign('eventItem', $eventItem);
>>>>>>
>>>>>>           }
>>>>>>
>>>>>>           /**
>>>>>>            * action add
>>>>>>            * @param Tx_RoqNewsevent_Domain_Model_Event $eventItem
>>>>>>            * @return string
>>>>>>            */
>>>>>>           public function
>>>>>> addAction(Tx_RoqNewsevent_Domain_Model_Event
>>>>>> $eventItem) {
>>>>>>                   $this->view->assign('eventItem', $eventItem);
>>>>>>           }
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> --
>>>>>> regards
>>>>>> Vikram Mandal
>>>>>> --
>>>>>> FiveE Technologies.
>>>>>> http://FiveEtechnologies.com
>>>>>> _______________________________________________
>>>>>> TYPO3-english mailing list
>>>>>> TYPO3-english at lists.typo3.org
>>>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> regards
>>>> Vikram Mandal
>>>> --
>>>> FiveE Technologies.
>>>> http://FiveEtechnologies.com
>>>>
>>>> _______________________________________________
>>>> TYPO3-english mailing list
>>>> TYPO3-english at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>>>
>>
>>
>
>


-- 
regards
Vikram Mandal
--
FiveE Technologies.
http://FiveEtechnologies.com



More information about the TYPO3-english mailing list