Nette Framework 2.3.0 released!
- David Grudl
- Nette Core | 8218
One – two – three, we are very proud to announce the Nette Framework two three!
Application
- all presenters are created by Dependency Injection container
- added
LinkGenerator
- Presenter: changed handling of invalid link, they triggers warnings on production and are configurable on development via ‘silentLinks’
- Routing: speed optimization & caching
- added bridges for Nette DI
- added
Request::getParameter()
, deprecatedRequest::isPost()
BC breaks:
- routes and presenter names are case sensitive. Nette will
warn you if you use the wrong case in presenter name. But due to performance
limitation it is not checking Route mask – you should check them manually.
Correct is
<presenter=UpperCasedDefaultValue>
and<presenter url-cased-regexp-mask>
. Route::addStyle()
&Route::setStyleProperty()
are deprecated and now will triggerE_USER_DEPRECATED
- removed support for deprecated Nette\Templating, template extension
.phtml
and old link syntax (undeprecated in 2.3.2)
Bootstrap
- in config file you can move all sections placed in
nette
to one level up. If you move up one of the sectionscontainer
,mailer
ordebugger
, rename it todi
,mail
andtracy
. - added
Configurator::addServices()
- uses new
DI\ContainerLoader
- removed deprecated constants
Configurator::DEVELOPMENT & PRODUCTION
(BC break) Configurator::setDebugMode()
accepts only bool / string / array
Caching
FileStorage
: removed usage of realpath()- added bridge for Nette DI
- ancient and deprecated ArrayAccess syntax
$val = $cache[$key]
or$cache[$key] = $val
triggersE_USER_DEPRECATED
. Use please$cache->load($key)
and$cache->save($key, $val)
Database
- throws own exceptions:
DriverException
,ConnectionException
ConstraintViolationException
,ForeignKeyConstraintViolationException
,NotNullConstraintViolationException
andUniqueConstraintViolationException
- added support for += and -= in UPDATE statement
- added support for operators in WHERE & AND
- implemented
?and
?or
?set
?values
?order
?name
- added support for ‘.’ in column names
- forbidden syntax ‘sql’, ‘sql’, …, i.e. after every SQL string must be at least one parameter
- SqlLiteral is parsed using SqlPreprocessor
- table and column names in joins can begin with number or underscore
- classes *Reflection split into with *Conventions & Structure
- added
IRowContainer::fetchAssoc()
,ISupplementalDriver::convertException()
(BC break) - PgSqlDriver: fixed formatLike() #46
- MySqlDriver by default uses utf8mb4 encoding for MySQL >= 5.5.3 instead of utf8 (possible problem)
- Connection: undeprecated some methods
- DatabaseExtension: added alias ‘database.x.connection’ for ‘database.x’
- to ensure that new SQL translator do the same job as older one, you can install special tool named CompatibilityChecker22
Deprecated
new package for deprecated stuff
DI
- parameters auto-resolution for generated factories
- service aliases
- removed ServiceDefinition & Statement magic methods (makes it 3× faster)
- added
DecoratorExtension
,DIExtension
andInjectExtension
- added
CompilerExtension::validateConfig()
- ExtensionsExtension: allows to pass params
- dynamic services
- chained syntax
Class::method()::method()::method()
- removed dependency on nette/reflection
- ContainerFactory replaced with light ContainerLoader
- ContainerBuilder: implement escaping of ‘@’ at the beginning of string
- Compiler: added
addConfig() & loadConfig()
, compile() returnsClassType[]
BC breaks:
- Container & ContainerBuilder::findByType() returns all services, including non-autowired
- class names are case sensitive
- removed support for placing services inside extension section in configuration file
- removed support for dynamically added extensions
Finder
Finder::filter()
callback always receives as argument (at least) aFilesystemIterator
- Finder is countable
Forms
- fixed some limitations of
netteForms.js
- TextBase: input is not silently truncated to max-length
TextBase::addFilter()
is processed during validation, addedRules::addFilter()
- now you can add filters to conditions
$input->addCondition(...)->addFilter(...)
- to
Container::onValidate
callbacks are passed values via second parameter - added bridge for Nette DI
- internal filtering methods like
Nette\Forms\Controls\TextBase::filterFloat
was removed - internal validation methods like
Nette\Forms\Controls\TextBase::validateFloat
was moved toNette\Forms\Validator
, as well asRules::$defaultMessages
- Buttons and Hidden fields are generated without HTML ID. Relying on
autogenerated ID is very bad, if you want ID, set it
via
setHtmlId()
- RadioList items are generated without ID too. You can enable it via
$radioList->generateId = TRUE
. But again: set you base ID viasetHtmlId()
- DefaultFormRenderer adds classes to inputs & label only during rendering process (BC break)
Http
- RequestFactory: speed optimizations
- Url: internally stores query parameters as array, improved canonicalize(), etc…
- added briges for Nette DI
- added
Helpers::formatDate()
, addedIResponse::getHeader()
(BC break) Request::getUrl()
is immutableResponse::date()
,Request::isPost()
&Request::getFile()
with multiple keys are deprecated
Latte
- template is wrapped in an class → much faster repeated rendering
- faster loading from cache file
- faster autoloader for non-Composer usage
{ifset block}
&{elseifset block}
without#
- parser detects for unclosed / malformed macros (nette/nette#711)
- added support for
<script type="text/html">
(#24 & nette/nette#705) - added macro
{php …}
as replacement for{? …}
- fills Html::$attrs with actual attribute values
- “words” can contain concatenation dots (i.e.
{include $dir . '/template.latte'}
#26) - combination of
n:class
&class
leads to exception
- added bridge for Nette DI
- variable
$mail
is not automatically passed to templates, you have to do it yourself (BC break) (but better than{var $mail->subject = "Your new order"}
is this<title>Your new order</title>
, isn't it?) - if you have linked images (with relative paths) in template, pass base file
path to images as second parameter to
setHtmlBody()
- Message: removes <title> from body
Neon
- chained syntax
first(a, b)second(1, 2)
Php Generator
- generating PHP files with multiple namespaces & classes
- removed magic methods (makes it much faster)
- splits long lines, uses single-quotes strings when possible
- short phpDoc for properties
Reflection
- added
Helpers::getDeclaringClass()
- added bridge for Nette DI
Robot Loader
- added support for loading from Phar
- removed usage of realpath()
- is now case sensitive and will warn you if you use the wrong case in class name
Safe Stream
- it is recommended to change protocol
safe://...
to namespacednette.safe://...
- protocol is registered automatically, no longer need to
call
SafeStream::register()
Security
- added bridge for Nette DI
Tracy
- Bluescreen & Debug Bar: 10× smaller HTML code, 10× faster, deeper depth of dumps
- Debug Bar: redesigned, uses vector icons
- Bluescreen: dumps contain location of class definition (can be opened in editor with ctrl key)
- Bluescreen: added link “skip error” to suppress strictMode
- Bluescreen: added Exception panel
- added
Tracy\ILogger
and rewritten defaultLogger
Debugger::enable()
implements checking of cookie (formatcookie@ip.address
)- customizable 500 error template via
Debugger::$errorTemplate
- Dumper: new options
LOCATION_SOURCE, LOCATION_LINK, LOCATION_CLASS
- Dumper: customizable object exportes
- completely rewritten JavaScript, now requires IE 10+ (removed tracyQ.js)
- added bridge for Nette DI
Utils
- added
Arrays::normalize()
,Callback::invokeSafe()
,Html::data()
,Strings::firstLower()
Image::from()
throwsImageException
when is unable to decode fileImage::place()
fixes support for alpha channelCallback::closure()
returns native closures since PHP 5.4Strings::chr()
throwsNette\InvalidArgumentException
if code point is not in valid rangeValidators::isUrl()
accepts underscores in subdomains
- Zdenal
- Member | 21
Hi,
I have problem with tracy. After i upgraded version 2.2.7 to 2.3 debug panel disappear. When I look to source code, panel's code is at the end of code after the tag html, but on the screen it is not showing. There is an error in console TypeError: JSON.parse is not a function.
Can you help me? Thank you.
- Tomáš Pilař
- Member | 14
Zdenal wrote:
bckp wrote:
@Zdenal What browser you use? Have you tried other browser?
FF 35.0.1
Console in Chrome
Uncaught TypeError: undefined is not a functionVM98:15 c.restorePositionVM98:14 c.initVM98:15 g.init(index):491 (anonymous function)
Same here.
- H0w4rd
- Member | 96
My project doesn't work with 2.3.0 because of an error:
[Mon Mar 02 13:59:05.884320 2015] [core:notice] [pid 3691] AH00052: child pid 15391 exit signal Segmentation fault (11)
after submitting a form, the method for saving the form is not called,
browser says ‘Connection interrupted’, nothing in log directory, no tracy
shown.
PHP 5.5.15 and 5.6.5
- Pavel Janda
- Member | 977
Nette 2.3 moved displayed error call stack one level above. Why is that?
For example: this Tracy output will tell me absolutely nothing about what happened.
2.2 is more friendly with “Can not write to temp dir”, or something particular like that..
PS: Sorry about the attached image, try zooming out.
Last edited by Beton (2015-03-10 15:36)
- David Grudl
- Nette Core | 8218
I don't know what you mean by moving one level above, but this error is fixed in master.
- vvoody
- Member | 910
My experience of updating nette from 2.2 to 2.3 on my project:
- ITemplateFactory::createTemplate was changed, so I needed to change my custom TemplateFactory also
http://prntscr.com/6f5ysb
https://api.nette.org/…ory.php.html#22
https://api.nette.org/…ory.php.html#22
- Autowiring of class FileStorage no longer works, now is defined in CacheExtension as interface IStorage
- Pavel Janda
- Member | 977
David Grudl wrote:
I don't know what you mean by moving one level above, but this error is fixed in master.
That means old Nette would tell me this:
1, Something wrong in Application
2, Something wrong in PresenterFactory
3, An unreadable underhood error
4, **Can not write to temp dir**
While new Nette throws:
1, Something wrong in Application
2, Something wrong in PresenterFactory
3, **An unreadable underhood error**
Last edited by Beton (2015-03-11 12:05)
- David Grudl
- Nette Core | 8218
I don't understand. Btw on your screenshot is E_WARNING (and not related to temp dir), not exception.
- Pavel Janda
- Member | 977
David Grudl wrote:
I don't understand. Btw on your screenshot is E_WARNING (and not related to temp dir), not exception.
All right, i have been mistaken, it is not thrown by Nette at all.
But still, people won't understand that
"touch(): Utime failed: Permission denied"
means they have to
change permission bits on “temp” directory..
Edit: And yes, it is related to “temp” dir.
Last edited by Beton (2015-03-11 18:53)
- David Grudl
- Nette Core | 8218
It is solved in master and is not related to temp dir. Look at $touchToRefresh.
- Pavel Janda
- Member | 977
The warning no longer pops up when i put ownership of temp dir to hands of _www user, or chmod the temp dir.
Ok.
- Matúš Matula
- Member | 257
protocol is registered automatically, no longer need to call SafeStream::register()
does not work automatically for me.. I still need to register manually
otherwise I get Unable to find the wrapper "nette.safe"
- greeny
- Member | 405
@radas @MatúšMatula if you install Nette/SafeStream using composer, the protocol is registered automatically.
See loader.php and composer.json . There is no longer registration through SystemContainer.
- Pavel Janda
- Member | 977
@DavidGrudl Nette\DI\Extensions\InjectExtension
throws
unrecognized Exception viz: http://www.tiikoni.com/tis/view/?…
(nette/di v2.3.1)
Fatal Error
Class 'Nette\DI\Extensions\ServiceCreationException' not found
in nette/di/src/DI/Extensions/InjectExtension.php:128
Last edited by Beton (2015-03-27 20:13)