Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If <code>$this-&gt;userRepository-&gt;findByUid(15);</code> works, there is no reason why <code>$this-&gt;userRepository-&gt;findAll();</code> should not. However <code>$this-&gt;userRepository-&gt;findAll();</code> returns not a single Object but a collection of all objects, so you have to iterate over them.</p> <p>If you add a column to the fe_users, you have to add it to TCA and to your extbase model (you need a getter and a setter), too! After that you can call <code>findByProperty($property)</code> in your repository. In your case that would be</p> <pre><code>$user = $this-&gt;userRepository-&gt;findByVipnumber($vip); </code></pre> <p>This will return all UserObjects that have $vip set as their Vipnumber. If you just want to check if that $vip is already in use, you can call</p> <pre><code>$user = $this-&gt;userRepository-&gt;countByVipnumber($vip); </code></pre> <p>instead. Which obviously returns the number of Users that have this $vip;</p> <p>You never use <code>$query = $this-&gt;createQuery();</code> outside your Repository.</p> <p>To add the property to the fronenduser Model you create your own model Classes/Domain/Model/FronendUser.php:</p> <pre><code>class Tx_MyExt_Domain_Model_FrontendUser extends Tx_Extbase_Domain_Model_FrontendUser { /** * @var string/integer */ protected $vipnumber; } </code></pre> <p>Add a getter and a setter. Now you create your own FrontendUserRepository and extend the extbase one like you did with the model. You use this repository in your Controller. Now you're almost there: Tell Extbase via typoscript, that your model is using the fe_users table and everything should work:</p> <pre><code>config.tx_extbase { persistence{ Tx_MyExt_Domain_Model_FrontendUser{ mapping { tableName = fe_users } } } } </code></pre> <p>To disable storagePids in your repository in general, you can use this code inside your repository:</p> <pre><code>/** * sets query settings repository-wide * * @return void */ public function initializeObject() { $querySettings = $this-&gt;objectManager-&gt;create('Tx_Extbase_Persistence_Typo3QuerySettings'); $querySettings-&gt;setRespectStoragePage(FALSE); $this-&gt;setDefaultQuerySettings($querySettings); } </code></pre> <p>After this, your Querys will work for all PIDs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload