Skip to content

Instantly share code, notes, and snippets.

@martinlipp
martinlipp / EntityManagerConfiguration.php
Last active April 29, 2022 07:31
Add custom Doctrine query hints in Neos Flow
<?php
namespace Acme\Demo\Persistence\Doctrine;
use Doctrine\DBAL\DBALException;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Query;
use Gedmo\Translatable\Query\TreeWalker\TranslationWalker;
use Gedmo\Translatable\TranslatableListener;
@martinlipp
martinlipp / FrontendUserHook.php
Last active January 15, 2021 15:13
Cart hook to prefill billing address with data from frontend user (TYPO3 10.4, extcode/cart)
<?php
namespace Acme\Demo\Hooks;
use Extcode\Cart\Domain\Model\Order\BillingAddress;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@martinlipp
martinlipp / Flow.php
Last active September 26, 2019 08:14
src/Application/Neos/Flow.php
<?php
public function buildCommand($targetPath, $command, array $arguments = [])
{
$phpBinaryPathAndFilename = isset($this->options['phpBinaryPathAndFilename']) ? ' ' . $this->options['phpBinaryPathAndFilename'] : '';
return 'cd ' . $targetPath . ' && FLOW_CONTEXT=' . $this->getContext()
. $phpBinaryPathAndFilename . ' ./' . $this->getFlowScriptName() . ' ' . $this->getCommandPackageKey($command) . ':' . $command . ' '
. implode(' ', array_map('escapeshellarg', $arguments));
}
88a89
>
91c92,104
< $checked = in_array($valueAttribute, $propertyValue);
---
> foreach ($propertyValue as $value) {
> if (is_object($value)) {
> $identifier = $this->persistenceManager->getIdentifierByObject($value);
> if ($identifier !== NULL) {
> $value = $identifier;