Pascal Bartl
Test por , creado hace más de 1 año

TYPO3 CD 2020 (zweite Auflage) Test sobre 4.3 Models, Repositories and Relations, creado por Pascal Bartl el 09/04/2021.

5
0
0
Pascal Bartl
Creado por Pascal Bartl hace más de 3 años
Cerrar

4.3 Models, Repositories and Relations

Pregunta 1 de 21

1

Which of the following statements about domain models in Extbase is correct? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Three different basis objects exist: entity, value object and factory

  • Properties of models should be accessed and modified directly

  • A “getter” method should be used to access a property

  • The visibility of domain model properties in Extbase should be public

  • All options listed above are wrong

Explicación

Pregunta 2 de 21

1

What is required in an Extbase repository to prevent it from returning deleted records? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • The TypoScript setting setup.tx_extbase.view.hidden = 0 must be set

  • The query setting setIncludeDeleted(false) must be set

  • The parameter true must be passed to the repository method findAll()

  • The parameter true must be passed to the repository method execute()

  • Nothing: the repository does not return deleted records by default

Explicación

Pregunta 3 de 21

1

What needs to be done in an Extbase repository to include hidden and deleted records in the result set? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • This is not possible. Deleted records are removed from the database

  • Both query settings setIncludeHidden() and setIncludeDeleted() need to be set to true

  • Both query settings setIgnoreEnableFields() and setEnableFieldsToBeIgnored() need to be
    set appropriately

  • The TCA configuration ['ctrl']['ignoreEnableFields'] of the table need to be set to true

Explicación

Pregunta 4 de 21

1

Which type of relation is not possible with TCA’s inline field type (IRRE)? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • 1:n

  • n:1

  • 1:1

  • m:n

  • IRRE supports all types of relations

Explicación

Pregunta 5 de 21

1

Which property annotation is required to define a relation of type 1:n in your domain model? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • /**
    * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
    */

  • /**
    * @var \Foo\Bar\Domain\Model\Post
    */

  • /**
    * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Foo\Bar\Domain\Model\Post>
    */

  • /**
    * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage[\Foo\Bar\Domain\Model\Post]
    */

  • /**
    * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<1:n><\Foo\Bar\Domain\Model\Post>
    */

Explicación

Pregunta 6 de 21

1

Which repository method tests whether the value of a domain model property, which has a m:n relation, contains a specific value? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • in()

  • between()

  • contains()

  • is()

  • inbetween()

Explicación

Pregunta 7 de 21

1

Which repository method tests whether the value of a domain model property is included in a list of possible
values? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • in()

  • between()

  • contains()

  • is()

  • inbetween()

Explicación

Pregunta 8 de 21

1

What needs to be configured to instruct all methods of a repository to return results ordered by a specific property? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • This can be achieved in a TypoScript file.

  • By passing the parameter $order in the method’s signature

  • By adding the @sort annotation to the domain model

  • By setting the $defaultOrderings property in the repository class

  • By adding an appropriate sortby property to the TCA

Explicación

Pregunta 9 de 21

1

Which statements about the following code snippet are correct? (2)
<?php
namespace Vendor\MyExtension\Domain\Repository;
use \TYPO3\CMS\Extbase\Persistence\Repository;
use \TYPO3\CMS\Extbase\Persistence\QueryInterface;

class ExampleRepository extends Repository
{
protected $defaultOrderings = [
'title' => QueryInterface::ORDER_DESCENDING
];
...
}

Selecciona una o más de las siguientes respuestas posibles:

  • Records read from this repository are sorted by their title field in descending order by default

  • The additional configuration sortBy is required in the TCA of the repository to set the default sort order

  • The property $defaultOrderings has no effect by default

  • The constant ORDER_ASCENDING can be used instead of ORDER_DESCENDING to sort in ascending order

  • If the property $defaultOrderings would not exist, the repository would use the sorting
    defined in the TCA

Explicación

Pregunta 10 de 21

1

Assuming two domain objects Book and Chapters exist, which have a 1:n-relation. How can you determine all chapters of a book which match a search string? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • By searching in the Book repository and by using in() on the property chapters

  • By searching in the Book repository and by using contains() on the property chapters

  • By searching in the Chapters repository and by using in() on the property books

  • By searching in the Chapters repository and by using contains() on the property books

  • By searching in the Chapters repository and iterating all records to find the appropriate
    chapters

Explicación

Pregunta 11 de 21

1

What needs to be configured to access records from the repository stored on page UID = 0? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Nothing needs to be configured as this is the default

  • The query setting in the repository must be set explicitly: setStoragePageIds([0])

  • This feature needs to be enabled in the repository explicitly: setEnableRootPage(true)

  • When the query is executed, the page UID must be passed as an argument in the function call: execute(0)

  • Records on page UID = 0 can not be accessed as a general rule

Explicación

Pregunta 12 de 21

1

What needs to be configured to access all records, regardless of which page they are stored on? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Nothing needs to be configured as this is the default

  • The TypoScript configuration persistence.storagePid needs to be set to all

  • The page restriction needs to be lifted by using the Restriction Builder

  • The query setting in the repository must be set explicitly: setRespectStoragePage(false)

Explicación

Pregunta 13 de 21

1

How can a custom extension access the fe_users database table? (2)

Selecciona una o más de las siguientes respuestas posibles:

  • By extending the domain model TYPO3\CMS\Extbase\Domain\Model\FrontendUser

  • By adding the mapping as TypoScript

  • By adding the mapping as TSconfig

  • By extending the fe_users TCA appropriately

  • The only option is to frequently copy the content of table fe_users into a custom table via a cron-job

Explicación

Pregunta 14 de 21

1

Which statement about the Persistence Manager is correct? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • The Persistence Manager is loaded in the controller automatically and can be used in custom scripts

  • The Persistence Manager is loaded in the repository automatically and can be used in custom scripts

  • By using the Persistence Manager, a single object or all objects can be made persistent

  • The Persistence Manager is an internal method of Extbase which is not part of the public API

  • The Persistence Manager is of type “prototype”

Explicación

Pregunta 15 de 21

1

How can you access TypoScript settings within a domain model? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Via $this->setting

  • Via $this->settings

  • Via $this->typoscript

  • Via $this->config

  • None of the options above

Explicación

Pregunta 16 de 21

1

What is the recommended way to access TypoScript settings in a repository? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • It’s recommended to access TypoScript configuration from the controller only

  • It’s recommended to access TypoScript configuration by using the Object Manager

  • It’s recommended to access TypoScript configuration by using the Settings Manager

  • TypoScript settings can be accessed by using $this->settings directly

  • TypoScript settings can be accessed by using $settings directly

Explicación

Pregunta 17 de 21

1

Which statments about the following TypoScript code are correct? (2)

plugin.tx_myextension {
persistence {
classes {
Vendor\MyExtension\Domain\Model\Client {
mapping {
tableName = fe_users
columns {
first_name.mapOnProperty = name
}
}
}
}
}
}

Selecciona una o más de las siguientes respuestas posibles:

  • The code has no effect: a fully qualified class name must be used as a tableName value

  • The property name of the model Client maps to the field first_name of the database table
    fe_users

  • The code has no effect: table and attribute names have to be written in UpperCamelCase

  • Only one property can be mapped between two tables

  • All properties are mapped by default if their name scheme matches

Explicación

Pregunta 18 de 21

1

A domain model has a relation parent to itself. Is it possible to access the relation via the Query Manager? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Yes, this is possible without any configuration

  • Yes, if the relation has the annotation @selfreference

  • Yes, if the TypoScript key features.selfreference = 1 is set

  • This is not possible – no error message is generated

  • This is not possible – an error message is generated

Explicación

Pregunta 19 de 21

1

How can we make a TypoScript object available in a controller? (1)

Selecciona una o más de las siguientes respuestas posibles:

  • Via $this->configurationManager->getContentObject()->data

  • Via $this->cObj

  • By utilising the “ContentObjectRenderer”

  • By utilising the “ContentObjectModel”

  • This is not possible in a controller

Explicación

Pregunta 20 de 21

1

Is it possible to use stdWrap in Extbase TypoScript settings as shown below? (1)

plugin.tx_myextension_example {
settings {
uid.dataWrap = {page:uid}
}
}

Selecciona una o más de las siguientes respuestas posibles:

  • Yes, this is supported out-of-the-box

  • Yes, but this needs to be activated in the Extbase configuration

  • Yes, you have to use PHP code to process stdWrap functions

  • Yes, but extbaseWrap must be used instead of dataWrap

  • No, this is not supported and not possible at all

Explicación

Pregunta 21 de 21

1

What are “Switchable Controller Actions”? (2)

Selecciona una o más de las siguientes respuestas posibles:

  • An option to limit which controller-action-combinations are executable

  • An option to switch between actions at run time

  • An option to control the sort order of actions shown in the backend

  • A configuration option to switch between backend users

  • An option to switch between controllers, based on actions

Explicación