<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marko Kunic on Medium]]></title>
        <description><![CDATA[Stories by Marko Kunic on Medium]]></description>
        <link>https://medium.com/@kunicmarko20?source=rss-94fd6ad78b74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GZyFiJtg-VyJx9lASpjO_Q.jpeg</url>
            <title>Stories by Marko Kunic on Medium</title>
            <link>https://medium.com/@kunicmarko20?source=rss-94fd6ad78b74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 01:27:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kunicmarko20/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Book recommendations for Developers]]></title>
            <link>https://medium.com/@kunicmarko20/book-recommendations-for-developers-11b96ed59d4a?source=rss-94fd6ad78b74------2</link>
            <guid isPermaLink="false">https://medium.com/p/11b96ed59d4a</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[books]]></category>
            <dc:creator><![CDATA[Marko Kunic]]></dc:creator>
            <pubDate>Fri, 31 Aug 2018 09:37:12 GMT</pubDate>
            <atom:updated>2018-10-25T19:24:22.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDolIW_SESDjOrOd5N2KIA.jpeg" /><figcaption>© Janko Ferlic — <a href="https://www.pexels.com/photo/blur-book-stack-books-bookshelves-590493/">https://www.pexels.com/photo/blur-book-stack-books-bookshelves-590493/</a></figcaption></figure><p>Like most of the developers, at the beginning of my career I started with watching video tutorials, which is completely fine. What I realized later is that only when you start reading books you can gain a certain type of depth in your knowledge base, which becomes stronger with every good book under your belt.</p><p>The idea of this post is to give my suggestion for people wanting to read books but do not know where to start or what to read. I will mention some mistakes that I made with previous choices and give my advice and opinion on books I read until now.</p><blockquote>This will be regularly updated with every new book I read.</blockquote><h3>Where to start</h3><p>I couldn’t decide between <a href="https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672"><strong>Refactoring</strong></a> and <a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"><strong>Clean Code</strong></a> for the first book so whichever you decide on be sure to read the other one next.</p><p>My first book was <a href="https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672"><strong>Refactoring</strong></a> and I can’t explain how good this book was. Book explains how to refactor your code and make it cleaner and readable. This is one of the books that changed the way I write my code completely and I think that everyone should read it at one point in their career.</p><p><a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"><strong>Clean Code</strong></a> is also a must read, you will find some stuff from the Refactoring book in here along with a lot of advice on how to take care of your code, and again, make it cleaner and readable.</p><p><a href="https://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073"><strong>Clean Coder</strong></a>, one more book from <a href="https://twitter.com/unclebobmartin">Uncle Bob</a> and his “Clean series”. This book is very easy to read and different from the other two because you mostly won’t see any code here (I am not 100% sure, I read it a long time ago). This book will teach you about estimations, how to manage your time, when to say “no” and how to behave as a software developer.</p><h3>Design Patterns</h3><p>I made a mistake with design patterns. I read a book too early in my career and it basically gave me no value. In my case the problem was I didn’t have much experience, and I couldn’t connect or understand a lot of stuff. About half a year ago I tried again but with a different book and it was totally different story. A lot of stuff was clear and most of the things in the book I already encountered without even knowing it was a design pattern. It helped that I could connect my previous coding to a pattern and that I understand where I could’ve used it if I knew about the pattern, that is what was missing for me the first time.</p><p><a href="https://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky/dp/0321213351"><strong>Refactoring to Patterns</strong></a> should for sure be your first book about patterns. I really enjoyed the approach in this book, it is very well explained. <a href="https://twitter.com/joshuakerievsky">Joshua Kerievsky</a> first shows the problem and then refactors the code step by step into a pattern. Why did I enjoy the approach? Because giving you a pattern catalog and just going over patterns isn’t enough. You need to understand when to use patterns and not to use it prematurely, maybe you won’t even need it. When you see the “bad” code and you take steps to refactor it into pattern you start appreciating that pattern more.</p><p><a href="https://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional-ebook/dp/B000SEIBB8"><strong>Design Patterns: Elements of Reusable Object-Oriented Software</strong></a> (also known as GOF) a legendary book about design patterns, anyone who heard about design patterns also heard about GOF. This should be your second book about patterns. A lot of times I heard how this book is boring and really hard to read, so I was delaying picking it up. Don’t listen to others, this book was great and I will probably read it again at one point. For me, it wasn’t boring at all, the question is how much you are interested in design patterns. The only “obstacle”, if I can say it like that, was that the code was in C++ and Smalltalk and I didn’t work with those languages, but I still understood almost everything.</p><p>The <a href="https://www.amazon.com/Agile-Principles-Patterns-Practices-C/dp/0131857258"><strong>Agile Principles, Patterns, and Practices</strong></a> is not a must read. I basically run through the design patterns examples just to confirm my knowledge from the 2 books before. Besides design pattern, here you will also learn about package designs, different types of UML diagrams, testing and much more. If you have time give it a read, it is worth it.</p><p>The <a href="https://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420"><strong>Patterns of Enterprise Application Architecture</strong></a> is another great book from <a href="https://twitter.com/martinfowler">Martin Fowler</a>. This book is in my eyes basically a continuation of GOF. The first part of this book is a short tutorial on developing enterprise applications. The second part is about patterns used in the first part. You will learn a lot about ORM patterns. Book also talks about Distribution patterns, Web Presentation Patterns, Concurrency Patterns, Approaches to organizing Business logic.</p><h3>Domain Driven Design</h3><p>DDD exists for a long time, <a href="https://twitter.com/ericevans0">Eric Evans</a> explained it in <a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215"><strong>Tackling Complexity in the Heart of Software</strong></a>.</p><p>If you never heard about Bounded Contexts, Ubiquitous Language, Strategic Design, Subdomains, Context Mapping, Aggregates and Domain Events, then start with <a href="https://www.amazon.com/Domain-Driven-Design-Distilled-Vaughn-Vernon/dp/0134434420"><strong>Domain-Driven Design Distilled</strong></a>. Short book that will explain all the basics you need to know and get you up to speed and into the DDD world.</p><p>Next on your list should be <a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215"><strong>Tackling Complexity in the Heart of Software</strong></a>. This book will explain everything you need to know about DDD. Unfortunately for me half way in it started to get pretty boring and very hard to read, it took double the time that I thought it will. I was probably expecting too much from this book since I already knew a lot of stuff.</p><p>If your language of choice is PHP, I can recommend <a href="https://leanpub.com/ddd-in-php">DDD in PHP</a>. This book is very good. There are a lot of code examples that will quickly get you into DDD with a lot of familiar code that makes it even easier to understand it. This was my second DDD book only because I mainly work with PHP.</p><h3>Other</h3><p><a href="https://www.amazon.com/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164"><strong>Clean Architecture</strong></a>, I am biased here. I really enjoy <a href="https://twitter.com/unclebobmartin">Uncle Bob</a>s books, talks, blog posts and his stories about programming decades ago. Another great book, explains why architecture goes wrong and how to prevent it, what software architects need to achieve, what’s critically important and what’s merely a “detail” and much more. Book will tech you a lot of stuff you need to know with great examples around architecture.</p><p><a href="https://www.amazon.com/You-Dont-Know-Js-Book/dp/B01AY9P0P6"><strong>You Don’t Know JS</strong></a> series proved to me that I really didn’t know JavaScript. Book are diving deep into the core mechanisms of the JavaScript language. I would recommend them to anyone who is learning or doing JS.</p><h3>Currently reading:</h3><p><a href="https://www.goodreads.com/review/list/86120825?shelf=currently-reading">https://www.goodreads.com/review/list/86120825?shelf=currently-reading</a></p><h3>Future read list (unordered):</h3><p><a href="https://www.goodreads.com/review/list/86120825-marko-kunic?shelf=to-read">https://www.goodreads.com/review/list/86120825-marko-kunic?shelf=to-read</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11b96ed59d4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned in the last 2 years]]></title>
            <link>https://medium.com/@kunicmarko20/what-i-learned-in-the-last-2-years-5dc90c1df072?source=rss-94fd6ad78b74------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dc90c1df072</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[symfony]]></category>
            <dc:creator><![CDATA[Marko Kunic]]></dc:creator>
            <pubDate>Mon, 23 Apr 2018 05:35:46 GMT</pubDate>
            <atom:updated>2018-04-23T05:35:46.845Z</atom:updated>
            <content:encoded><![CDATA[<p>I quit my job and this can be considered as a short recap of my last 2 years with some advice for new people getting into the dev world.</p><p><strong>TL;DR</strong>: Books are great, if you want to be better, you will have to read. Join the community and start giving back. If you are not happy with your current job, it is time for a change. Don’t allow yourself to get too comfortable, that is never a good sign.</p><p>So, I am a PHP Developer, 2 years ago I knew basic procedural PHP and Wordpress. I was looking for an internship, so I could get my Bachelor’s degree and that is where my career began. School didn’t teach me much, they introduced me to PHP and Web Development but that is about it, most of the things I know now, I learned on my own.</p><p>Over a year ago I was at work, and I was in between projects, so I didn’t have much work to do. I was never a fan of books, and I was always looking for a video tutorial to learn new things. I saw a book named <a href="https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672">Refactoring</a> at the shelf and I started reading. I can’t explain what that book did to my code, but I started writing code that was a lot better, cleaner and more understandable. <a href="https://stackoverflow.com/users/story/5258172#form-section-Readings">I was hooked</a>, and since then I am always looking for my next book and I started improving a lot faster, everything was getting easier to understand. Books are great, they teach so much more than people think, you can’t even compare the stuff you learn from books to video tutorials. I barely even watch tutorials now. <strong>Don’t wait, grab a book </strong>as soon as you can. I dedicate around 1 hour per day to reading, and it is enough, you can’t force anything.</p><p>Besides reading books, I started attending user groups and conferences. Almost all conferences are recorded, and they upload videos online, so if you can’t attend find them online and watch. Conferences are great, you can learn a lot and my recommendation is to start watching them. My old company started doing meetups, and I was the first one that was giving a talk. It was few months ago and about <a href="https://speakerdeck.com/kunicmarko20/symfony-4-lets-get-dangerous">Symfony 4</a>. I was nervous, and I was not really happy about how I handled it but it was a great experience and you can’t get better if you don’t do it. Maybe you are not for public speaking but you will never know if you don’t try.</p><p>Over half a year ago, the thing that made me improve a lot was joining the community, in my case it was the <a href="https://symfony.com/community">Symfony Slack chat</a> and I also joined Twitter and started actively using Github where I started following people from PHP world. Everything that is important I first see on Twitter. I never thought that a Social Network could have an impact on my career, but I was wrong. On Github, the first thing you see is the activity tab, I regularly check what people star and that is another way how I find great tools that I use. Joining Symfony Slack was one of the greatest decisions I made. There are a lot of great and smart people there and I had a lot of great discussions that helped me understand things better. There is a <strong>#support</strong> channel, and there is always someone online that is ready to help. If you are still not on Slack/Gitter/IRC or whatever your community is using, find it and join, you can’t lose anything, but you can have a great experience and learn something. I am sad that I learned about Slack Chat so late, but better late than never.</p><p>Another thing that helped me was to start giving back to the community. How many times did you find a solution to a problem that you couldn’t solve on some random blog? If you don’t have a blog, it is time to create one, every developer <a href="https://kunicmarko20.github.io/">should have one</a>. You can start writing about the issues you encountered and the solution you came up with, because you never know who will find your blog post and be grateful that you wrote it. Another way to give back to the community is contributing to <a href="https://en.wikipedia.org/wiki/Free_and_open-source_software">FOSS</a>. We all depend on open source software and use it every day, one of the things that made me start contributing to FOSS was this great tweet:</p><h3>Jon Kuperman on Twitter</h3><p>Stop treating open source like a product you purchased and start treating it like a team you belong to.</p><p>With the help of <a href="https://twitter.com/greg0ire">@greg0ire</a> that I met at Slack I made my first <a href="https://help.github.com/articles/about-pull-requests/">PR</a> ever on <a href="https://github.com/sonata-project">Sonata Project</a>. It was a great experience and I continued contributing. I enjoy helping people and programming so FOSS is a thing that makes me happy, I also improved my skills and understanding of how the tools I use work. If you have spare time, find a FOSS library you use every day, help them with some issues, maintainers love to see that “First-time Contributor” badge and are always eager to help new people.</p><p>So, what went wrong? Why did I quit my job?</p><p>I was getting too comfortable, I was doing stuff I already knew and did a lot of times. I started feeling like I was wasting my time. I was learning and reading about great stuff (currently <a href="https://en.wikipedia.org/wiki/Domain-driven_design">DDD</a>) that I didn’t have the opportunity to use and my every day at work was just like washing the dishes, I had to do it but I didn’t like it. I had to do something, I started looking at job offers and that was it. Don’t get me wrong, I am grateful that I was given an opportunity to work at my old job and I met some great people but I wasn’t happy. If you can do something about it, go for it, you should be happy, don’t allow yourself not to be.</p><p>I guess that is it, if this post helps you in any way that is enough of a reward for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dc90c1df072" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sonata Admin Custom Page]]></title>
            <link>https://medium.com/@kunicmarko20/sonata-admin-custom-page-61b99d4bd9d4?source=rss-94fd6ad78b74------2</link>
            <guid isPermaLink="false">https://medium.com/p/61b99d4bd9d4</guid>
            <category><![CDATA[sonata-admin]]></category>
            <category><![CDATA[custom-pages]]></category>
            <category><![CDATA[symfony]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Marko Kunic]]></dc:creator>
            <pubDate>Sun, 17 Sep 2017 17:13:38 GMT</pubDate>
            <atom:updated>2018-03-26T18:40:02.374Z</atom:updated>
            <content:encoded><![CDATA[<p>Sonata admin is one of the most used Admin bundles for Symfony Framework. If you do a google search for “sonata admin custom page” you will probably find <a href="http://blog.eike.se/2014/03/custom-page-controller-in-sonata-admin.html">this</a>, while this is still a valid solution there is a better one. I needed to create a statistics page that would cover various Entities and I needed it in Sonata Admin. Here I will explain a better way for a custom page and how to use sonata blocks to make a universal block for statistics.</p><p><em>Note: This was originally posted on my blog </em><a href="https://kunicmarko20.github.io/2017/09/17/Sonata-Admin-Custom-Page.html"><em>here</em></a><em>.</em></p><p><strong>TL;DR</strong>: Code for this can be found <a href="https://gist.github.com/kunicmarko20/f500c5ed1e4cee7c6df8cbcc7c7053c0">here</a>.</p><h3>Custom Page</h3><p>You can register Sonata Admin class without Entity (I was shocked too as this is not mentioned anywhere).</p><p>services.yml</p><pre>#app/config/services.yml<br>bundle.admin.stats:<br>    class: YourBundle\Admin\StatsAdmin<br>    arguments: [~, ~, YourBundle:StatsCRUD]<br>    tags:<br>        - { name: sonata.admin, manager_type: orm, label: Stats }</pre><p>As you can see here, we registered admin class without Entity with a custom controller.</p><p>StatsAdmin.php</p><pre>&lt;?php</pre><pre>namespace YourBundle\Admin;</pre><pre>use Sonata\AdminBundle\Admin\AbstractAdmin;<br>use Sonata\AdminBundle\Route\RouteCollection;</pre><pre>class StatsAdmin extends AbstractAdmin<br>{<br>    protected $baseRoutePattern = &#39;stats&#39;;<br>    protected $baseRouteName = &#39;stats&#39;;</pre><pre>    protected function configureRoutes(RouteCollection $collection)<br>    {<br>        $collection-&gt;clearExcept([&#39;list&#39;]);<br>    }<br>}</pre><p>You have to define ‘$baseroutePattern’ and ‘$baseRouteName’, and we will clear all other routes but the list.</p><p>StatsCRUDController.php</p><pre>&lt;?php</pre><pre>namespace YourBundle\Controller;</pre><pre>use Sonata\AdminBundle\Controller\CRUDController;</pre><pre>class StatsCRUDController extends CRUDController<br>{<br>    public function listAction()<br>    {<br>        return $this-&gt;render(&#39;YourBundle::stats.html.twig&#39;);<br>    }<br>}</pre><p>In a controller, it is up to you but as I said that I am making statistics page I will just render my template here. I will now go to creating custom Sonata Block and after that, I will show you template.</p><h3>Sonata Block</h3><p>Here we will create a universal block that will accept any Entity and Repository Method, also CSS class, font awesome icon, and a title.</p><p>StatsBlockService.php</p><pre>&lt;?php</pre><pre>namespace YourBundle\Block\Service;</pre><pre>use Doctrine\ORM\EntityManagerInterface;<br>use Sonata\AdminBundle\Form\FormMapper;<br>use Sonata\CoreBundle\Validator\ErrorElement;<br>use Sonata\BlockBundle\Block\Service\AbstractBlockService;<br>use Sonata\BlockBundle\Block\BlockContextInterface;<br>use Sonata\BlockBundle\Model\BlockInterface;<br>use Symfony\Component\HttpFoundation\Response;<br>use Symfony\Component\OptionsResolver\OptionsResolver;<br>use Symfony\Bundle\TwigBundle\TwigEngine;</pre><pre>class StatsBlockService extends AbstractBlockService<br>{</pre><pre>    private $entityManager;</pre><pre>    public function __construct(<br>        string $serviceId,<br>        TwigEngine $templating,<br>        EntityManagerInterface $entityManager<br>    ) {<br>        $this-&gt;entityManager = $entityManager;<br>        parent::__construct($serviceId, $templating);<br>    }</pre><pre>    <em>/**<br>     * {@inheritdoc}<br>     */</em><br>    public function getName()<br>    {<br>        return &#39;Stats Block&#39;;<br>    }</pre><pre>    <em>/**<br>     * {@inheritdoc}<br>     */</em><br>    public function configureSettings(OptionsResolver $resolver)<br>    {<br>        $resolver-&gt;setDefaults([<br>            &#39;entity&#39; =&gt; &#39;Add Entity&#39;,<br>            &#39;repository_method&#39; =&gt; &#39;findAll&#39;,<br>            &#39;title&#39; =&gt; &#39;Insert block Title&#39;,<br>            &#39;css_class&#39; =&gt; &#39;bg-blue&#39;,<br>            &#39;icon&#39; =&gt; &#39;fa-users&#39;,<br>            &#39;template&#39; =&gt; &#39;YourBundle:Block:block_stats.html.twig&#39;,<br>        ]);<br>    }</pre><pre>    <em>/**<br>     * {@inheritdoc}<br>     */</em><br>    public function buildEditForm(<br>        FormMapper $formMapper,<br>        BlockInterface $block<br>    ) {<br>        $formMapper-&gt;add(<br>            &#39;settings&#39;,<br>            &#39;sonata_type_immutable_array&#39;,<br>            [<br>                &#39;keys&#39; =&gt; [<br>                    [&#39;entity&#39;, &#39;text&#39;, [&#39;required&#39; =&gt; false]],<br>                    [&#39;repository_method&#39;, &#39;text&#39;],<br>                    [&#39;title&#39;, &#39;text&#39;, [&#39;required&#39; =&gt; false]],<br>                    [&#39;css_class&#39;, &#39;text&#39;, [&#39;required&#39; =&gt; false]],<br>                    [&#39;icon&#39;, &#39;text&#39;, [&#39;required&#39; =&gt; false]],<br>                ]<br>            ]<br>        );<br>    }</pre><pre>    <em>/**<br>     * {@inheritdoc}<br>     */</em><br>    public function validateBlock(<br>        ErrorElement $errorElement,<br>        BlockInterface $block<br>    ) {<br>        $errorElement<br>            -&gt;with(&#39;settings[entity]&#39;)<br>                -&gt;assertNotNull(array())<br>                -&gt;assertNotBlank()<br>            -&gt;end()<br>            -&gt;with(&#39;settings[repository_method]&#39;)<br>                -&gt;assertNotNull(array())<br>                -&gt;assertNotBlank()<br>            -&gt;end()<br>            -&gt;with(&#39;settings[title]&#39;)<br>                -&gt;assertNotNull(array())<br>                -&gt;assertNotBlank()<br>                -&gt;assertMaxLength(array(&#39;limit&#39; =&gt; 50))<br>            -&gt;end()<br>            -&gt;with(&#39;settings[css_class]&#39;)<br>                -&gt;assertNotNull(array())<br>                -&gt;assertNotBlank()<br>            -&gt;end()<br>            -&gt;with(&#39;settings[icon]&#39;)<br>                -&gt;assertNotNull(array())<br>                -&gt;assertNotBlank()<br>            -&gt;end();<br>    }</pre><pre>    <em>/**<br>     * {@inheritdoc}<br>     */</em><br>    public function execute(<br>        BlockContextInterface $blockContext,<br>        Response $response = null<br>    ) {<br>        $settings = $blockContext-&gt;getSettings();<br>        $entity = $settings[&#39;entity&#39;];<br>        $method = $settings[&#39;repository_method&#39;];</pre><pre>        $rows = $this-&gt;entityManager<br>                    -&gt;getRepository($entity)<br>                    -&gt;$method();</pre><pre>        return $this-&gt;templating<br>            -&gt;renderResponse($blockContext-&gt;getTemplate(), [<br>            &#39;count&#39;     =&gt; $rows,<br>            &#39;block&#39;     =&gt; $blockContext-&gt;getBlock(),<br>            &#39;settings&#39;  =&gt; $settings,<br>            ],<br>        $response);<br>    }</pre><p>So basically, you define entity and method and return that to your template. We register block as a service:</p><p>services.yml</p><pre>#app/config/services.yml<br>admin.block.service.stats:<br>    class: YourBundle\Block\Service\StatsBlockService<br>    arguments:<br>        - &quot;admin.block.service.stats&quot;<br>        - &quot;@templating&quot;<br>        - &quot;@doctrine.orm.entity_manager&quot;<br>    public: true<br>    tags:<br>        - {name: &quot;sonata.block&quot;}</pre><p>Also, inside of your sonata config for blocks, you need to add this new block:</p><p>config.yml</p><pre>#app/config/config.yml<br>sonata_block:<br>    default_contexts: [cms]<br>    blocks:<br>        # enable the SonataAdminBundle block<br>        sonata.admin.block.admin_list:<br>            contexts: [admin]<br>        sonata.admin.block.search_result:<br>            contexts: [admin]<br>        admin.block.service.stats: ~</pre><p>block_stats.html.twig</p><pre>&lt;div id=&quot;cms-block-{{ block.id }}&quot; <br>     class=&quot;cms-block cms-block-element col-md-3&quot;&gt;<br>    &lt;div class=&quot;small-box {{ settings.css_class }}&quot;&gt;<br>        &lt;div class=&quot;inner&quot;&gt;<br>            &lt;h3&gt;{{ count }}&lt;/h3&gt;</pre><pre>            &lt;p&gt;{{ settings.title }}&lt;/p&gt;<br>        &lt;/div&gt;<br>        &lt;div class=&quot;icon&quot;&gt;<br>            &lt;i class=&quot;fa {{ settings.icon }}&quot;&gt;&lt;/i&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;</pre><p>And now we go back to twig template for stats admin:</p><p>stats.html.twig</p><pre>{% extends &#39;SonataAdminBundle::standard_layout.html.twig&#39; %}</pre><pre>{% block content %}<br>    &lt;div class=&quot;row&quot;&gt;<br>        {{ sonata_block_render({ &#39;type&#39;: &#39;admin.block.service.stats&#39; }, {<br>            &#39;entity&#39; : &#39;AppBundle:User&#39;,<br>            &#39;repository_method&#39; : &#39;findNumberofAllUsers&#39;,<br>            &#39;title&#39; : &#39;Users&#39;,<br>            &#39;css_class&#39; : &#39;bg-gray-active&#39;,<br>            &#39;icon&#39; : &#39;fa-users&#39;<br>        }) }}</pre><pre>        {{ sonata_block_render({ &#39;type&#39;: &#39;admin.block.service.stats&#39; }, {<br>            &#39;entity&#39; : &#39;AppBundle:Delivery&#39;,<br>            &#39;repository_method&#39; : &#39;findAllDeliversInProgress&#39;,<br>            &#39;title&#39; : &#39;Deliveries in Progress&#39;,<br>            &#39;css_class&#39; : &#39;bg-yellow&#39;,<br>            &#39;icon&#39; : &#39;fa-truck&#39;<br>        }) }}</pre><pre>        {{ sonata_block_render({ &#39;type&#39;: &#39;admin.block.service.stats&#39; }, {<br>            &#39;entity&#39; : &#39;AppBundle:Delivery&#39;,<br>            &#39;repository_method&#39; : &#39;findAllFailedDelivers&#39;,<br>            &#39;title&#39; : &#39;Failed Deliveries&#39;,<br>            &#39;css_class&#39; : &#39;bg-red&#39;,<br>            &#39;icon&#39; : &#39;fa-truck&#39;<br>        }) }}<br>    &lt;/div&gt;<br>{% endblock %}</pre><p>And that is it, you create a custom page that is more sonata way and you get a statistics page. I hope this helps someone as it helped me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61b99d4bd9d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>