First run php bin/console server:start
Available API routes (from php bin/console debug:router
):
-------------------------- -------- -------- ------ -----------------------------------
Name Method Scheme Host Path
-------------------------- -------- -------- ------ -----------------------------------
api_place_index ANY ANY ANY /api/place/.{_format}
api_place_show ANY ANY ANY /api/place/{id}.{_format}
Example:
http://127.0.0.1:8000/place/
To create a client:
[0] % php bin/console cd:oauth-server:client-create facebook --grant-type=password
Added a new client with name facebook and public id 3_2786j2vc3gn4g80o4s8o0g0ws84ow0440gkoo80g4wwk4gsgkk.
Warning, in DB, the client random_id
is stored without the 2_
. But if you forgot it, it will not work.
To retrieve an access token :
http://127.0.0.1:8000/oauth/v2/token?client_id=[RANDOM_ID]&client_secret=[SECRET]&grant_type=password&username=[USERNAME]&password=[PASSWORD] http://127.0.0.1:8000/oauth/v2/token?client_id=3_2786j2vc3gn4g80o4s8o0g0ws84ow0440gkoo80g4wwk4gsgkk&client_secret=4hpy482lklmo8w0gocwocs84wksc844w8cc0848okwsk8c8wgc&grant_type=password&username=lolo&password=lolo
It return something like:
{"access_token":"N2RmYTM3ODkyNjU2ODA0MGFlM2UzODAwNTliNTMxYjI3YjZiMTk5MWI0NDFiMmY1MTEwMTkyYzhlY2JlZmM1Zg","expires_in":3600,"token_type":"bearer","scope":null,"refresh_token":"ODcwOTQ5ZTcxMmRmOGUyZGE1ZTZhMjJiOGJiMTUzYWU2NDE4MDFmMjVhYThkNGY1NzFjZjhkNDQ5NGM0NDBhMw"}
Then you can access api with the token like:
http://127.0.0.1:8000/api/place/?access_token=[ACCESS_TOKEN] http://127.0.0.1:8000/api/place/?access_token=N2RmYTM3ODkyNjU2ODA0MGFlM2UzODAwNTliNTMxYjI3YjZiMTk5MWI0NDFiMmY1MTEwMTkyYzhlY2JlZmM1Zg
For an hour only, then the token will be too old.
Don't forget to add the fos:oauth-server:clean
command to remove old tokens.
Available API routes (from php bin/console debug:router
):
-------------------------- -------- -------- ------ -----------------------------------
Name Method Scheme Host Path
-------------------------- -------- -------- ------ -----------------------------------
place_index ANY ANY ANY /place/
place_show ANY ANY ANY /place/{id}
Example:
http://127.0.0.1:8000/api/place/
On a new server :
npm install -g gulp
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:$APACHEUSER:rwX -m u:`whoami`:rwX var/cache var/logs var/sessions
sudo setfacl -dR -m u:$APACHEUSER:rwX -m u:`whoami`:rwX var/cache var/logs var/sessions
After each release :
php bin/console assets:install --symlink
npm install
gulp
Here is the doc for reverse engineering.
As explained in the documentation, we can follow these steps:
php bin/console doctrine:mapping:import --force CarpeDeumBundle yml
php bin/console doctrine:mapping:convert annotation ./src
And php bin/console doctrine:generate:entities CarpeDeumBundle
can be replaced by PhpStorm Getter/Setter generation.
If doctrine:mapping:import
fail like that:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: class_parents(): Class Place does not exist and could not be loaded
Then you need to comment SyliusResourceBundle
in AppKernel.php
.
To generate the engine switch :
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=InnoDB;')
FROM information_schema.tables
WHERE engine = 'MyISAM';
and run the resulting requests that look like :
ALTER TABLE geomesse.PLACES engine=InnoDB;
ALTER TABLE geomesse.PLACESCHEDULE engine=InnoDB;
UPDATE place SET name = REPLACE(name, 'é', 'é'), address = REPLACE(address, 'é', 'é'), address_1 = REPLACE(address_1, 'é', 'é'), address_2 = REPLACE(address_2, 'é', 'é'), city = REPLACE(city, 'é', 'é'), history = REPLACE(history, 'é', 'é'), schedule_notes = REPLACE(schedule_notes, 'é', 'é'), schedule_eucharist = REPLACE(schedule_eucharist, 'é', 'é');
UPDATE place SET name = REPLACE(name, 'è', 'è'), address = REPLACE(address, 'è', 'è'), address_1 = REPLACE(address_1, 'è', 'è'), address_2 = REPLACE(address_2, 'è', 'è'), city = REPLACE(city, 'è', 'è'), history = REPLACE(history, 'è', 'è'), schedule_notes = REPLACE(schedule_notes, 'è', 'è'), schedule_eucharist = REPLACE(schedule_eucharist, 'è', 'è');
UPDATE place SET name = REPLACE(name, 'ç', 'ç'), address = REPLACE(address, 'ç', 'ç'), address_1 = REPLACE(address_1, 'ç', 'ç'), address_2 = REPLACE(address_2, 'ç', 'ç'), city = REPLACE(city, 'ç', 'ç'), history = REPLACE(history, 'ç', 'ç'), schedule_notes = REPLACE(schedule_notes, 'ç', 'ç'), schedule_eucharist = REPLACE(schedule_eucharist, 'ç', 'ç');
UPDATE place SET name = REPLACE(name, 'Å“', 'œ'), address = REPLACE(address, 'Å“', 'œ'), address_1 = REPLACE(address_1, 'Å“', 'œ'), address_2 = REPLACE(address_2, 'Å“', 'œ'), city = REPLACE(city, 'Å“', 'œ'), history = REPLACE(history, 'Å“', 'œ'), schedule_notes = REPLACE(schedule_notes, 'Å“', 'œ'), schedule_eucharist = REPLACE(schedule_eucharist, 'Å“', 'œ');
UPDATE place SET name = REPLACE(name, 'â', 'â'), address = REPLACE(address, 'â', 'â'), address_1 = REPLACE(address_1, 'â', 'â'), address_2 = REPLACE(address_2, 'â', 'â'), city = REPLACE(city, 'â', 'â'), history = REPLACE(history, 'â', 'â'), schedule_notes = REPLACE(schedule_notes, 'â', 'â'), schedule_eucharist = REPLACE(schedule_eucharist, 'â', 'â');
UPDATE place SET name = REPLACE(name, 'É', 'É'), address = REPLACE(address, 'É', 'É'), address_1 = REPLACE(address_1, 'É', 'É'), address_2 = REPLACE(address_2, 'É', 'É'), city = REPLACE(city, 'É', 'É'), history = REPLACE(history, 'É', 'É'), schedule_notes = REPLACE(schedule_notes, 'É', 'É'), schedule_eucharist = REPLACE(schedule_eucharist, 'É', 'É');
UPDATE place SET name = REPLACE(name, 'ô', 'ô'), address = REPLACE(address, 'ô', 'ô'), address_1 = REPLACE(address_1, 'ô', 'ô'), address_2 = REPLACE(address_2, 'ô', 'ô'), city = REPLACE(city, 'ô', 'ô'), history = REPLACE(history, 'ô', 'ô'), schedule_notes = REPLACE(schedule_notes, 'ô', 'ô'), schedule_eucharist = REPLACE(schedule_eucharist, 'ô', 'ô');
UPDATE place SET name = REPLACE(name, 'î', 'î'), address = REPLACE(address, 'î', 'î'), address_1 = REPLACE(address_1, 'î', 'î'), address_2 = REPLACE(address_2, 'î', 'î'), city = REPLACE(city, 'î', 'î'), history = REPLACE(history, 'î', 'î'), schedule_notes = REPLACE(schedule_notes, 'î', 'î'), schedule_eucharist = REPLACE(schedule_eucharist, 'î', 'î');
UPDATE place SET name = REPLACE(name, 'Ì‚', 'â'), address = REPLACE(address, 'Ì‚', 'â'), address_1 = REPLACE(address_1, 'Ì‚', 'â'), address_2 = REPLACE(address_2, 'Ì‚', 'â'), city = REPLACE(city, 'Ì‚', 'â'), history = REPLACE(history, 'Ì‚', 'â'), schedule_notes = REPLACE(schedule_notes, 'Ì‚', 'â'), schedule_eucharist = REPLACE(schedule_eucharist, 'Ì‚', 'â');
UPDATE place SET name = REPLACE(name, 'aâ', 'â'), address = REPLACE(address, 'aâ', 'â'), address_1 = REPLACE(address_1, 'aâ', 'â'), address_2 = REPLACE(address_2, 'aâ', 'â'), city = REPLACE(city, 'aâ', 'â'), history = REPLACE(history, 'aâ', 'â'), schedule_notes = REPLACE(schedule_notes, 'aâ', 'â'), schedule_eucharist = REPLACE(schedule_eucharist, 'aâ', 'â');
— prerequisites :
SET sql_mode=(SELECT REPLACE(@@sql_mode,'NO_ZERO_DATE',''));
—
Allow missing private key :