Skip to content

Instantly share code, notes, and snippets.

@xmsi
xmsi / Php_xmsi.md
Last active April 22, 2025 13:08
Code sheat

Null Coalescing (??) vs Ternary (?:) operators

  • Null coalescing - check for null and performs next (?? ??=)
  • Ternary - check for false and performs next (?:)

Oneline if

if (is_string($hashesForCherryPick)) $hashesForCherryPick = explode(" ", $hashesForCherryPick);
@xmsi
xmsi / git.md
Last active January 16, 2025 07:16
Git helper

Undo pushed Merge request

  1. git log --oneline see to which commit you need to jump
  2. git reset --hard branch_hash
  3. git push origin feature/DATRUECALL-180 --force force push branch to remote origin

It is better to pull from origin before doing massive changes

Server certificate verification failed CAfile:

@xmsi
xmsi / Versioning.md
Last active February 21, 2025 06:46
Packages Versioning in composer.json, PHP

There is a difference between ~ and ^ in Composer, though it might not be immediately obvious in some cases. Let me clarify:

Key Difference Between ~ and ^:

  • ~ (tilde): Allows updates for the last digit specified.
  • ^ (caret): Allows updates for all minor versions within the same major version.

In your example, ~7.3 vs. ^7.3:

  • ~7.3:
@xmsi
xmsi / Larahelper.md
Last active March 18, 2025 05:51
Helper for Laravel

Sail

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/var/www/html \
    -w /var/www/html \
    laravelsail/php82-composer:latest \
    composer install
@igormukhingmailcom
igormukhingmailcom / STUPID_SYLIUS_ISSUES.md
Last active December 20, 2024 14:25
Symfony/Sylius stupid issues that hard to debug and which may waste too many hours

Symfony/Sylius stupid issues that hard to debug and which may waste too many hours

1. [Doctrine\Common\Persistence\Mapping\MappingException] Class 'Your\SyliusPlugin\Entity\YourEntity' does not exist

When your plugin is AbstractResourceBundle and all your entities should be and actually placed at Model directory, you have that exception (notice ...\Entity\... at exception rather than ..\Model\...) for your Your\SyliusPlugin\Model\YourEntity.php that is weird.

This happens when you accidentally have your mapping file at src/Resources/config/doctrine/YourEntity.orm.xml (without ../model/.. part) rather than src/Resources/config/doctrine/model/YourEntity.orm.xml.

This issue may happen when you convert some of your application code (which use Entity directory) to plugin (which use Model directory).