Automatizace jednodušše (6. sraz přátel Symfony v Praze)
-
Upload
martin-zeman -
Category
Presentations & Public Speaking
-
view
173 -
download
0
Transcript of Automatizace jednodušše (6. sraz přátel Symfony v Praze)
![Page 1: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/1.jpg)
6. sraz přátel Symfony - Bude stovka stačit?Praha, 31. 3. 2016, Usertech
![Page 2: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/2.jpg)
Martin Zeman
@zemistr
![Page 3: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/3.jpg)
Dnešní téma:
Automatizace jednodušše
To není překlep...to je schválně! Přeci jen, je to ukázka automatizace pro kriply. ;-)
![Page 4: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/4.jpg)
Auto … co?
![Page 5: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/5.jpg)
![Page 6: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/6.jpg)
Automatizace označuje použití samočinných řídicích systémů k řízení technologických
zařízení a procesů. Z pohledu industrializace jde o krok následující po mechanizaci.
Zatímco mechanizace poskytuje lidem k práci zařízení, které jim usnadňuje práci,
automatizace snižuje potřebu přítomnosti člověka při vykonávání určité činnosti.
https://cs.wikipedia.org/wiki/Automatizace
![Page 7: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/7.jpg)
Automatizace označuje použití samočinných řídicích systémů k řízení technologických
zařízení a procesů. Z pohledu industrializace jde o krok následující po mechanizaci.
Zatímco mechanizace poskytuje lidem k práci zařízení, které jim usnadňuje práci,
automatizace snižuje potřebu přítomnosti člověka při vykonávání určité činnosti.
https://cs.wikipedia.org/wiki/Automatizace
![Page 8: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/8.jpg)
Co můžemeautomatizovat?
![Page 9: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/9.jpg)
Cokoliv … :)
![Page 10: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/10.jpg)
● Generování dat (statistiky)● Zpracování dat (newsletter)● Spouštění procesů (viz. ↑ )● … osvětlení● … splachování● … fakt cokoliv :)
![Page 11: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/11.jpg)
![Page 12: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/12.jpg)
![Page 13: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/13.jpg)
![Page 14: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/14.jpg)
$ bin/consoledoctrine:generate:entity
![Page 15: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/15.jpg)
The Entity shortcut name: Welcome to the Doctrine2 entity generator
This command helps you generate Doctrine2 entities.
First, you need to give the entity name you want to generate.You must use the shortcut notation like AcmeBlogBundle:Post.
![Page 16: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/16.jpg)
AppBundle:PostConfiguration format (yml, xml, php, or annotation) [annotation]: Determine the format to use for the mapping information.
New field name (press <return> to stop adding fields): Instead of starting with a blank entity, you can add some fields now.Note that the primary key will be added automatically (named id).
Available types: array, simple_array, json_array, object, boolean, integer, smallint, bigint, string, text, datetime, datetimetz, date, time, decimal, float, binary, blob, guid.
![Page 17: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/17.jpg)
titleField type [string]: Field length [255]: Is nullable [false]: Unique [false]:
New field name (press <return> to stop adding fields): key Name "key" is a reserved word.
New field name (press <return> to stop adding fields): ukeyField type [string]: Field length [255]: 50Is nullable [false]: trueUnique [false]: true
![Page 18: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/18.jpg)
Entity generation
> Generating entity class ...\AppBundle\Entity\Post.php: OK!> Generating repository class ...\AppBundle\Repository\PostRepository.php: OK!
Everything is OK! Now get to work :).
Process finished with exit code 0 at 14:41:16.Execution time: 1 032 236 ms.
![Page 19: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/19.jpg)
/*** @ORM\Table(name="post")* @ORM\Entity(repositoryClass="AppBundle\Repository\PostRepository")*/class Post{ /** * @var int * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id;
/** * @var string * * @ORM\Column(name="title", type="string", length=255) */ private $title;
/** * @var string * * @ORM\Column(name="ukey", type="string", length=50, nullable=true, unique=true) */ private $ukey;
![Page 20: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/20.jpg)
$ bin/consoledoctrine:generate:entity
![Page 21: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/21.jpg)
$ bin/consoledoctrine:generate:entity
--entity=AppBundle:Post
![Page 22: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/22.jpg)
$ bin/consoledoctrine:generate:entity
--entity=AppBundle:Post--no-interaction
![Page 23: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/23.jpg)
$ bin/consoledoctrine:generate:entity
--entity=AppBundle:Post--fields="title:string(255)"
--no-interaction
![Page 24: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/24.jpg)
--fields= " ukey:string( length=50 unique=true nullable=true ) title:string(255) "
![Page 25: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/25.jpg)
$ bin/consoledoctrine:generate:entity
--entity=AppBundle:Post--fields="ukey:string(length=50
unique=true nullable=true)title:string(255)"--no-interaction
![Page 26: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/26.jpg)
/*** @ORM\Table(name="post")* @ORM\Entity(repositoryClass="AppBundle\Repository\PostRepository")*/class Post{ /** * @var int * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id;
/** * @var string * * @ORM\Column(name="title", type="string", length=255) */ private $title;
/** * @var string * * @ORM\Column(name="ukey", type="string", length=50, nullable=true, unique=true) */ private $ukey;
![Page 27: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/27.jpg)
$ bin/consoledoctrine:generate:entity
--entity=AppBundle:Post--fields="ukey:string(length=50
unique=true nullable=true)title:string(255)"--no-interaction
![Page 28: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/28.jpg)
1.
![Page 29: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/29.jpg)
2.
![Page 30: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/30.jpg)
![Page 31: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/31.jpg)
AppBundle:$Prompt$
![Page 32: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/32.jpg)
![Page 33: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/33.jpg)
![Page 34: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/34.jpg)
...\php.exe bin/console doctrine:generate:entity --entity=AppBundle:Post "--fields=ukey:string(length=50 unique=true nullable=true) title:string(255)" --no-interaction Entity generation > Generating entity class ...\AppBundle\Entity\Post.php: OK!> Generating repository class ...\AppBundle\Repository\PostRepository.php: OK!
Everything is OK! Now get to work :).
Process finished with exit code 0
![Page 35: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/35.jpg)
/** * @var string * * @ORM\Column(name="`key`", ...) */private $key;
![Page 36: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/36.jpg)
/*** @var string** @ORM\Column(* name="body",* type="text",* nullable=true* )*/private $body;
![Page 37: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/37.jpg)
$ bin/consoledoctrine:generate:entities
![Page 38: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/38.jpg)
$ bin/consoledoctrine:generate:entities
AppBundle:Post
![Page 39: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/39.jpg)
1.
![Page 40: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/40.jpg)
2.
![Page 41: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/41.jpg)
![Page 42: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/42.jpg)
AppBundle:$FileNameWithoutAllExtensions$
![Page 43: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/43.jpg)
![Page 44: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/44.jpg)
...\php.exe bin/console doctrine:generate:entities AppBundle:Post
Generating entity "AppBundle\Entity\Post" > backing up Post.php to Post.php~ > generating AppBundle\Entity\Post
Process finished with exit code 0
![Page 45: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/45.jpg)
/*** Set body** @param string $body* @return Post*/public function setBody($body){ $this->body = $body;
return $this;}
/*** Get body** @return string*/public function getBody(){ return $this->body;}
![Page 46: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/46.jpg)
Čas na volnou debatu
![Page 47: Automatizace jednodušše (6. sraz přátel Symfony v Praze)](https://reader034.fdocument.pub/reader034/viewer/2022042611/587ac7151a28ab760f8b496d/html5/thumbnails/47.jpg)
Otázky?