valid_children setting for Symfony Sonata / CMF - php

Continuing on the journey to install the Symfony2 CMF, I am getting the error:
[InvalidArgumentException]
The following document types provided in valid_children are invalid:
Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page
The class names provided could not be loaded.
The following lines causing this error are here in the config.yml file:
sonata_doctrine_phpcr_admin:
document_tree:
/...
Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
valid_children:
- all
/...
I am following the instructions from the docs here:
http://symfony.com/doc/current/cmf/cookbook/creating_cms_using_cmf_and_sonata.html
below Configuration. Is this an error in the docs, or a setting that need to adjust? The docs do not explain what the valid_children parameter is controlling or the possible settings.
What are the possible options for this setting? Any further explanation of what this code is actually doing would be beneficial.

Thanks for trying the CMF tutorials! This documentation was not tested recently (as the warning at the head of the page says). Thanks for pointing out this issue. I updated the tutorial and added some explanation:
The tree is used to know what is allowed in the left side of the admin dashboard, and also for sonata tree widgets. Classes in the tree where not validated at the time this tutorial was written, but are validated now to detect typos explicitly rather than having no clue why things do not show up in the tree. The simple cms is another bundle that can be used with the cmf, but which is not installed in the prerequisite tutorial...
http://symfony.com/doc/current/cmf/cookbook/creating_cms_using_cmf_and_sonata.html will be updated in the next few minutes.
Please open github issues on symfony-cmf-docs if you find further issues with this tutorial or elsehwere in the documentation.

Related

CodeIgniter 3.1.4 - Implementing evert's Sitemap PHP Library

I'm trying to get evert's sitemap-php library working in CodeIgniter using the vague instructions that I found in another StackOverflow post, but I'm not having any success. I've got a few questions that should be enough to point me in the right direction when answered:
Should the makeSitemap() function be added to the default controller?
If evert's Sitemap.php file is placed in the libraries folder (instead of nested in the SitemapPHP folder like the example), can it be loaded properly using the standard CI syntax?
$this->load->library('sitemap');
Where does the sitemap folder belong?
I'd greatly appreciate any insight on these questions. Unless someone beats me to it, I'll be sure to post a code-based solution once I get this working.
You can do it on two ways. First would be modifying Sitemap.php code including property (i.e. $CI) and getting codeigniter's object by reference in constructor as described in documentation. However second way would be using composer autoloader and IMHO that should be your prefered way. In this answer I described how to use github repository in CI application but there is more answers and articles that can point you in right direction how to use composer in CI.
If you go with first way, you would call $this->sitemap->method() and if you would go with second method, you would use library as described on github's readme section.

Sylius ProductBundle/ResourceBundle : how to enable HTML routing for products?

I am trying to install some bundles provided by Sylius, but I don't want to install it fully. I began with ProductBundle. I'm using the v0.15.
After some struggle, I managed to create the schema in my database and enabled the router for the API endpoint of products. The code shown in the ProductBundle documentation fails, but I managed to have my routes with this code:
app_product:
resource: app_product
type: sylius.api
I guess it's thanks to the #SyliusResourceBundle/Routing/ApiLoader.php class.
However, I would like to test the type sylius.resource described in the ResourceBundle documentation.
I can't find the definition of the loader - if there is one. And it collapses as soon as I try php app/console debug:router :
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot load resource "alias: app.product
".
with the config:
app_product:
resource: |
alias: app.product
type: sylius.resource
Can anyone point me to a correct configuration ?
Or could someone point me to a Loader or a similar tool that is defined somewhere in the code ?
Thanks for your time
I finally understood how is that suppose to work. Sorry for answering to my own question, but if anyone actually come accross the same problem, it might help.
The documentation is actually up to date with the dev version of the project. If you still want to stick with some previous versions, you have to define your own routes as you would do in a standard Symfony application.
You can help yourself with php app/console debug:container to see what actually was created for your resource/product.
For french speaking developers, this talk helped me a lot :
http://fr.slideshare.net/ArnaudLanglade/dvelopper-avec-le-sylius-resourcebundle

Magento module controller won't update

I did some tweaking on a module a guy used for a website he was working on and now I was requested to change one line of code in the controller of that module. The problem: it doens't matter what I do, my changes won't get loaded and Magento uses the old controller code. How do I fix this?
What I tried:
cache management (refreshed it, flushed it, cleared it and disabled it. I have done all of it in any possible order)
checked if I was in the right place to begin with (edited etc/config.xml and Block/view.php these changes did show)
edited etc/config.xml and changed the version number
System=>Configuration=>Advanced=>Advanced and disabled/enabled the module to check if it would reload it
just to clearify the cache management part:
Configuration
Layouts
Blocks HTML output
Translations
Collections Data
EAV types and attributes
Web Services Configuration
Web Services Configuration
are the only rows I have here.
installed Magento version:
Magento ver. 1.8.1.0
If there is anything else you may need to solve this problem please let me know!
I have allready wasted a day on this problem.
Maybe compilation mode is enabled.
Go to System -> Tools -> Compilation and if compilation is enabled, click Run Compilation Proces.
I fixed my problem with a workaround, it seemed that I was able to edit the model.
The code in the controller was never called because he put the logic that actually was called in the Model.

FOSUserBundle : configuration error (handler)

I'm using Symfony 2.1 for a project and trying to use FOSUserBundle to manage the users.I am also following the documentation but i'm getting an error:
Unrecognized options "handler" under "fos_user.change_password.form"
Any idea?
Thanks in advance!
FOSUserBundle recently went through several major changes in 2.0.x. The FOSUserBundle documentation as of right now is not up to date and currently is for 1.3.x and below.
If you would like to still use handlers, you can revert back to 1.3.x via composer. Take a look at the different releases on packagist.
The latest version of FOSUserBundle got rid of handlers and now uses EventListeners. You can take a look at the list of FOSUserEvents and decide which event you want to hook on to. You can see an example of subscribing to a FOSUserEvent from the controller on the "Hooking into the controllers" part of the documentation.
Also, note that if you're overriding the FOSUserBundle's controller, it now requires the Symfony2 Request component class as its parameter.

Zend Framework 1.8 Autoloading Zend_Gdata_YouTube VideoQuery.php

I'm having issues with Zend_Gdata_YouTube.
It seems unable to locate the file VideoQuery.php despite the fact it is one of the directories mentioned in the warning messages.
Also I created a standalone version of the example just including 'Zend/Gdata/YouTube.php'. This works fine.
I've dropped the error messages then the class followed by the working example into a paste bin.
Paste Bin
I got the same error after I upgraded from ZF 1.8.0 to 1.8.4, after searching for a solution with no luck I posted my error on the ZF Gdata mail list and Trevor Johns was nice enough to get back to me with this response:
"This looks like this issue:
http://framework.zend.com/issues/browse/ZF-7013
This will be fixed in the next release of Zend Framework. If you don't
want to wait that long, you can either:
Download a development snapshot from here:
hxxp://framework.zend.com/code/browse/~tarball=zip/Zend_Framework/standard/trunk/trunk.zip
Use version 1.8.3:
hxxp://framework.zend.com/releases/ZendFramework-1.8.3/ZendFramework-1.8.3.tar.gz
Don't use Zend_Loader's autoloader functionality. (This bug only
seems to show up if you're trying to autoload the classes.)"
I'll be rolling back my ZF version until the next release.
p.s. had to substitute http with hxxp because "new users can only post a maximum of one hyperlink" apparently.
The files Zend\Gdata\Media\Extension\VideoQuery.php and Zend\Gdata\YouTube\Extension\VideoQuery.php do not exist in the framework. I think the file you want is Zend\Gdata\YouTube\VideoQuery.php
Does this help? What code is using these classes, your code or the framework code?

Categories