Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:48:41+00:00 2026-06-03T10:48:41+00:00

After creating a model and adding it to a repository I want to have

  • 0

After creating a model and adding it to a repository I want to have the new ID for different purposes (creating a mail, updating other fields outside the Extbase world)

$page = t3lib_div::makeInstance('Tx_MyExt_Domain_Model_Page');
$page->setTitle('Hello World');
$this->pageRepository->add($page);

At this point $page hasn’t got an ID yet, uid is null.

$page->getUid(); // returns null

When does it get it? And how can I retrieve in on runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:48:44+00:00Added an answer on June 3, 2026 at 10:48 am

    In ExtBase, objects are “managed”. This means every persistence transaction (add/remove/update) is simply noted in the underlying logic, but not yet executed until the appropriate time (like the end of processing a request). So, just because you add an object to a repository doesn’t mean that it’s actually added yet. That actually happens once $persistenceManager->persistAll() is called, which isn’t something you need to do manually, ever. The point is, your $page object won’t have a UID until it’s saved and that’s why $page->getUid() returns null. Look here for a great explanation.

    I suspect that you are trying to do something outside of the ExtBase object/MVC lifecycle. At least, last time I got null when I tried to get the UID of an object, it was because I wasn’t operating within the framework appropriately.

    However, if you post some more code and give us a bigger picture of what you’re trying to achieve, maybe we can help you get to a point where that object actually has a UID. For instance, if you’re in a Controller object, tell us which Action method you’re in, or if you’re in a Repository object, tell us what you’re trying to get from the repository and where/how you plan on using the query results.

    EDIT

    Just guessing here, but I’m assuming you’re executing this code in some action of a controller. Since after the controller is executed a view is rendered, you can just pass the page object to the view:

    $this->view->assign('page', $page);
    

    And then in your view you can use the page object in a link:

    <f:link.action action="show" arguments="{page:page}">
        See this page object
    </f:link.action>
    

    And then in the show action of your controller you can show the page:

    public function showAction(Tx_MyExt_Domain_Model_Page $page) {
        // Do whatever you need to show the page in the `Show.html` template
    }
    

    I really am just guessing here. If you can give us a larger picture of what you’re trying to do, what your action methods are supposed to do and things like that, we can answer your question a little more confidently.

    (I’m also assuming that your page object isn’t a replacement for the regular TYPO3 pages and that they are something totally different. It’s much easier to deal with those TYPO3 pages through the backend interface than at the php level.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After creating a new form, I usually perform this ritual: Change the name into
After creating a new object (Foo), I set the key (BarId) for an EntityRef
After creating a child process and exiting it immediately (_exit()), I want to perform
After creating a table (by migration), I want to insert some entries directly. How
After creating the parse tree, i have to populate symbol table now. I have
After creating a listview from VS2010 and adding it as a web part to
After creating a Web Application project in VS2010, adding a routing route and run
When clicking on save (after creating a new instance) in the Django Admin Site
I am creating an Entity model applying the Model first approach. I want that
After following the official tutorial here: tutorial I'm still having issues adding rows/creating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.