Don't wanna be here? Send us removal request.
Text
Pluralizacja w FosRestBundle
Wkurzała mnie liczba mnoga automatycznie generowana dla routingów w FosRestBundle. Co nalezy zmienić/zrobić. Idąc za cookbookiem:
Tworzymy własną klasę inflector przy implementacji interfejsu FOS\RestBundle\Inflector\InflectorInterface (zauważyć należy, że usunąłem Util ze ścieżki ponieważ nie pokrywała się z tym co ja miałem u siebie w Vendorach).
Definiujemy service dla naszego inflectora
Każemy fos_rest używać naszego servicu jako inflectora
http://symfony.com/doc/current/bundles/FOSRestBundle/5-automatic-route-generation_single-restful-controller.html#changing-pluralization-in-generated-routes
0 notes
Text
Brak primary key na tabeli przy imporcie do doctrine
[Doctrine\ORM\Mapping\MappingException] Table _m_PPS01 has no primary key. Doctrine does not support reverse engineering from tables that don't have a prim ary key.
Rozwiązanie
I've successfully imported some database entities by adding a schema_filter in the doctrine dbal config (~/app/config/config.yml)
# Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 schema_filter: /^users_table/
app/console doctrine:mapping:import --force MyBundle yml
Then revert config.yml.
Link: https://stackoverflow.com/a/38645802
0 notes
Text
Api - przesyłanie plików curlem
Potrzebowałem odbierać pliki przez API. W API nie ma opcji odbierania multipart data form tylko json.
Co w takim przypadku z plikami ? Myślałem, że base64_encode rozwiąże sprawę, ALE niestety nie. Po base64_decode okazało się, że pliki są uszkodzone. Długość stringów pokrywała się. Nie wiedziałem o co chodzi, ale z tego wynika, że któryś znak musiał być walnięty. Jak to ogarnąć ?
urlencode will help
$file = 'test.pdf'; $content = urlencode(file_get_contents($file)); $content = base64_encode($imageData);
następnie po stronie API
$content = base64_decode($request_data[’file']); $content = urldecode($content); file_put_contents('../tmp/plik_test.pdf', $content);
0 notes
Text
Zarezerwowane słowa MySql
Jedną z tabel nazwałem ORDER co dla MySql jest słowem zarezerwowanym w wyniku czego w Sonata Admin (doctrine) wywaliło mi błąd:
Something is wrong in your syntax obok 'Order o0_ LEFT JOIN Customer c1_ ON o0_.customer_id = c1_.id' w linii 1
Rozwiązaniem było backticks czyli (przed i za nazwą tabeli dodanie znaczków `):
Plik:
AppBundle/Entity/Order dodałem
/** * Order * * @ORM\Table(name="`Order`") * @ORM\Entity(repositoryClass="AppBundle\Repository\OrderRepository") */ class Order
0 notes
Text
Composer error
Przy próbie odpalenia instalacji admina sonaty w composerze dostałem:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/php5.3/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php on line 254
Zwiększyłem ilość pamięci:
php -d memory_limit=1024M
Wyedytowałem .bashrc i jego końcówka obecnie wygląda tak:
alias composer='/usr/local/php5.6/bin/php -d memory_limit=1024M ~/composer.phar' (wgrałem własnego composera a nie korzystam już z wbudowanego, którego nie można było self-update) export PATH=/usr/local/php5.6/bin/:$PATH
alias php='/usr/local/php5.6/bin/php'
Przy okazji można posilić się :
http://blog.elimu.pl/11494-drush-na-linuxpl-com/
0 notes
Text
Kiedy zip nie jest dostępny
With the help of the tar command, we can create a tar file of a whole directory and gzip the result. We can perform the whole lot in one step, as the tar command allows us to specify a compression method to use.
tar czvf etc.tar.gz /etc/
This example creates a compressed etc.tar.gz file of the entire /etc/ directory. The tar flags are as follows, ‘c’ creates a new tar archive, ‘z’ specifies that we want to compress with gzip, ‘v’ provides verbose information, and ‘f’ specifies the file to create. The resulting etc.tar.gz file contains all files within /etc/ compressed using gzip.
Więcej na stronie: https://www.rootusers.com/11-simple-gzip-examples/
0 notes
Text
Admin do Symfonii2 jak ta lala
Link do stronki z Sonata Admin Bundle:
https://sonata-project.org/bundles/admin/3-x/doc/getting_started/installation.html
Prowadzi każdego za rączkę.
Jeżeli na serwerze nie jest ustawiona strefa czasowa w php.ini to :
http://stackoverflow.com/questions/24251793/warning-date-default-timezone-get-installing-symfony
natomiast info jakie są strefy czasowe znajdziecie tutaj :
http://php.net/manual/en/timezones.europe.php
U mnie wyrzuciło jeszcze info o nieaktywnym serwisie translation. Co zrobić? Jak żyć ?
http://symfony.com/doc/current/book/translation.html#book-translation-configuration
Po zakończeniu instalacji admin jest dostępny pod adresem : http://domena/web/admin
(oczywiście w zależności jak ustawicie przekierowanie domeny na który folder. Jeżeli tego nie zrobicie to web jest tym miejscem gdzie admin się pojawi :) )
0 notes
Text
Wamp Turn On - Win10
Udało mi się odpalić tego nieszczęsnego wampa na Win 10.
Update: this seems to fix it permanently
Search for "Turn Windows features on or off" on the taskbar.
Under "Internet Information Services" deselect "World Wide Web Services" that Microsoft must turn on by default (takes port).
Reboot and WAMP came back up as before.
Original solution
I can confirm the following fixed the problem:
Run cmd as Administrator, and enter: iisreset /stop
Then Apache > Service > Install Service will prompt you to press Enter to install as normal.
You may also need to install: http://www.microsoft.com/en-us/download/details.aspx?id=30679
Żródło: http://superuser.com/a/948525
P.S. dorzucam od Siebie - Windows Feature znajduje się w Dodaj/Usuń aplikację w panelu admina ( po lewej stronie).
0 notes
Text
Przenosiny
Wkurzał mnie pinger więc zabieram od nich graty.
Wcześniejszy link do moich notek to :
http://petre.pinger.pl/
1 note
·
View note