·
Added a discussion

Hi all!

I need to create posts without una interface. I have file with structured data: title, text and i'd like to create a several posts. All posts should be with one una person profile.

I'd like to use UNA classes

Is this posible?

 

  • 1721
Comments
    • Hello zaytseff !

      Yes, it's possible to do via the using the following command:

      $a = BxDolService::call('bx_posts', 'entity_add', array($iProfileId, array('title' => 'title')));

      • Thanks, man.
        I'll try this code and report here

        • Hello LeonidS !
          That code work fine,thanks. I could have guessed for myself that one should use BxDolService :: call (...);
          Now I got another one question. Can I edit some posts if I know $iContentId?
          I tried to use 'entity_edit' by analogy with the previous code, but it not work.

          Can you tell me which function I need use for that?

          I looked code and couldn't find analog addData() function for edit action in BxBaseModGeneralFormsEntryHelper.php. Is it possible?  

           

          • I got some idea if 'entity_edit' not work such as 'entity_add'
            So, I know post ID and can modify values with $oDb->prepare("UPDATE... WHERE id=?", $iPostId); code 

            • Not to hijack this thread but, can the post date be specified this way as well?

              • Hi all!

                How to use the service edit form method:

                $oForm = BxDolService::call('bx_posts', 'entity_edit', array($iPostId));

                $oForm->update($iPostId, array('title' => 'title'));

                Login or Join to comment.