I don't see anything to change, the only thing which i could do different is the return line from
return $this->render('MatiitBookBundle:Book:new.html.twig', ['form' => $form->createView()]);
i would write something like this to make it more clear
'form' => $form -> createView()
So if one day you need to add another line you will just add a
, and the code will still look good.
var $file? Why this
$? It remember me something which is related to
jQuery... Do you really need this? I would just do
var file or choose a more specific name. (no idea right now,
file could be ok but what is
You use documentation only to specify the type of the fields? You could start with add the documentation of the fields and document all methods (or at least public/protected methods)
I'm wrong or here the indentation is a bit messed up? Could be just a copy/paste bug, anyway from
protected $category; it wil look like you start write an inner class. (same for the end of the file)
Fix it if it's in your code.
length? I'm not English so maybe i'm wrong but i don't think
length is a great name for a
Book class (without documentation it's more hard to understand what is it).
It's the book pages? What about
totalPages? It's the
length (size) of the file in bytes? What about
class BookType extends AbstractType
Why not call your class
AbstractType could sound as something which is related to variables type, not your class.
I know you use
namespaces but i think it's important to make the name of something very clear.
Here you could add documentation too.
It looks so similar to
Some methods are similar, maybe
Book should have an instance of
BookCover inside instead of recreate the methods from zero?
I need more info about it.
protected function getUploadRootDir()
// the absolute directory path where uploaded
// documents should be saved
I'm not a PHP expert, but what if one day you change the location? You should remember to edit this method inside
BookCover and inside
Book too! Can't you make it in a static field for the two classes?
And you should maintain the
/../../../../../ to point in the new location!
Anyway my review is more about style than other.