79 $this->objectType = preg_replace(array(
'/' . $nsSeparator .
'Repository' . $nsSeparator .
'(?!.*' . $nsSeparator .
'Repository' . $nsSeparator .
')/',
'/Repository$/'), array($nsSeparator .
'Model' . $nsSeparator,
''), $this->
getRepositoryClassName());
90 public function add($object) {
91 if (!$object instanceof $this->objectType) {
92 throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(
'The object given to add() was not of the type (' . $this->objectType .
') this repository manages.', 1248363335);
94 $this->persistenceManager->add($object);
105 public function remove($object) {
106 if (!$object instanceof $this->objectType) {
107 throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(
'The object given to remove() was not of the type (' . $this->objectType .
') this repository manages.', 1248363336);
109 $this->persistenceManager->remove($object);
119 public function replace($existingObject, $newObject) {
132 public function update($modifiedObject) {
133 if (!$modifiedObject instanceof $this->objectType) {
134 throw new \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException(
'The modified object given to update() was not of the type (' . $this->objectType .
') this repository manages.', 1249479625);
136 $this->persistenceManager->update($modifiedObject);
167 foreach ($this->
findAll() AS $object) {
168 $this->
remove($object);
205 if ($this->session->hasIdentifier($identifier, $this->objectType)) {
206 $object = $this->session->getObjectByIdentifier($identifier, $this->objectType);
209 $query->getQuerySettings()->setRespectStoragePage(FALSE);
210 $query->getQuerySettings()->setRespectSysLanguage(FALSE);
211 $object = $query->matching($query->equals(
'uid', $identifier))->execute()->getFirst();
251 $query = $this->persistenceManager->createQueryForType($this->objectType);
252 if ($this->defaultOrderings !== array()) {
253 $query->setOrderings($this->defaultOrderings);
255 if ($this->defaultQuerySettings !== NULL) {
256 $query->setQuerySettings(clone $this->defaultQuerySettings);
270 public function __call($methodName, $arguments) {
271 if (substr($methodName, 0, 6) ===
'findBy' && strlen($methodName) > 7) {
272 $propertyName = lcfirst(substr($methodName, 6));
274 $result = $query->matching($query->equals($propertyName, $arguments[0]))->execute();
276 } elseif (substr($methodName, 0, 9) ===
'findOneBy' && strlen($methodName) > 10) {
277 $propertyName = lcfirst(substr($methodName, 9));
280 $result = $query->matching($query->equals($propertyName, $arguments[0]))->setLimit(1)->execute();
287 } elseif (substr($methodName, 0, 7) ===
'countBy' && strlen($methodName) > 8) {
288 $propertyName = lcfirst(substr($methodName, 7));
290 $result = $query->matching($query->equals($propertyName, $arguments[0]))->execute()->count();
293 throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedMethodException(
'The method "' . $methodName .
'" is not supported by the repository.', 1233180480);
302 return get_class($this);
replace($existingObject, $newObject)
__construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
__call($methodName, $arguments)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
setDefaultOrderings(array $defaultOrderings)
setDefaultQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $defaultQuerySettings)
findByIdentifier($identifier)