Doctrine 2.2 Bisna CLI - doctrine

I can't get the Bisna doctrine cli to work. It complains about not being able to find the Symfony Console application. Notice it's trying to look for it in a nested directory of Doctrine/Symfony/Console/Symfony/Component/Console. Anybody ever seen this?
PHP Warning: require(/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php): failed to open stream: No such file or directory in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
PHP Fatal error: require(): Failed opening required '/Users/jhicks/workspace/production/application/../library/Doctrine/Symfony/Console/Symfony/Component/Console/Application.php' (include_path='/Users/jhicks/workspace/production/library:.:/opt/local/lib/php') in /Users/jhicks/workspace/production/library/Doctrine/Common/ClassLoader.php on line 163
Here's the Github page for the doctrine cli from Bisna: https://github.com/guilhermeblanco/ZendFramework1-Doctrine2/blob/master/bin/doctrine.php

There are many repositories that call themsemves Bisna in Github, it is difficult to find what of them you are using without further information.
The original one is the one created by Guilherme Blanco (Bisna used to be his nickname) called Zend Framework 1 + Doctrine 2 and works like a charm, but it does not bundle the Symfony components necessary to run the CLI tool.
What you have to do is download them from GitHub (search for "Symfony" and you will find the components inside the Organization repository) and put them inside your project's library folder paying attention to the PSR #0 naming conventions.
If you provide the piece of code that generates this error and the repository and version you are using, it will be easier to detect the error and give a better answer. It is naive to try and guess the type of error, but probably you have problems with namespaces and/or how you are calling Symfony's Console component.
If you need some guidance on how this integration can be achieved, you can look at doctrine.php inside Blanco's repository.

Looks like I needed to add these two lines to my existing autoloader bootstrap method:
$symfonyAutoloader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$autoloader->pushAutoloader(array($symfonyAutoloader, 'loadClass'), 'Symfony');
I didn't think this would be necessary since I included Symfony in the autoloaderNamespaces array in my application.ini file.
autoloaderNamespaces[] = "Symfony"

Related

Sulu, strange hash related error when trying to save page / post?

Until recently everything was working well. Now, when I try to save (create or update) any page or post I get error message at top of the form "Error - There was an error when trying to save the form".
In error log I see this error:
“Uncaught PHP Exception Sulu\Component\Rest\Exception\InvalidHashException: “The given hash for the entity of type “Sulu\Bundle\ArticleBundle\Document\ArticleDocument” with the id “9e0720a7-5565-4a6f-a735-8a186b8fef9b” does not match the current hash. The entity has probably been edited in the mean time.” at /var/www/html/vendor/sulu/sulu/src/Sulu/Component/Hash/RequestHashChecker.php line 53"
Tried clearing symfony cache, website cache from admin, restarting docker containers.
I'm totally unaware that I did something to cause this error. Please help.
Update: strange thing I just noticed. When I try to save some article and I get that error and go back to overview page (where i.e. all articles of that type are listed) then I see unchanged article title. But when I click to edit it I see changed title?!? Like title on overview page and title on edit page are not used from the same place? How is that possible?
Update:
Now even I setup once more project from scratch saving articles causes that error. Some more info:
In stack trace last command executed is:
in vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php (line 64)
an it shoots out “No alive nodes found in your cluster”.
And while I'm setting up the project when executing:
php bin/console ongr:es:index:create
I get error:
{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason
":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] already exists","index_uuid":
"sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"}],"type":"resource_already_e
xists_exception","reason":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] alrea
dy exists","index_uuid":"sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"},"st
atus":400}
And when I run:
php bin/console ongr:es:index:create --manager=live
I get similar:
In Connection.php line 675:
{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrD
AA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","index":"su_articles_live"}],"type":"resource_already_exists_exc
eption","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrDAA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","i
ndex":"su_articles_live"},"status":400}
Also to mention that now saving pages works, but saving articles doesn't.
This solved the issue on ElasticSearch index creation for me:
php bin/console ongr:es:index:drop --force
The error can happen in the following cases.
Expected Case somebody else did edit the same article like you and did save it
Unexpected Case your phpcr cache is not in sync
Unexpected Case you have a multi server setup but your cache.app is not configured to use a central cache
So if its one of the unexpected cases first you should clear your cache.pools with:
bin/console cache:pool:prune
If you have a multi server setup make sure you configure a central cache. Most use in this case a redis-server which you configure in your cache.yaml e.g.:
# config/packages/prod/cache.yaml
framework:
cache:
default_redis_provider: "%env(resolve:REDIS_DSN)%"
app: cache.adapter.redis
Also make sure that you use the latest version and maybe update your phpcr cache configuration based on the sulu/skeleton: https://github.com/sulu/skeleton/blob/2.x/config/packages/prod/sulu_document_manager.yaml, there you could when performance doesn't matter in your case disable the phpcr cache, I would not recommend that.

When Doctrine Generate doctrine/base/*.class.php

I am having a web site live built with symfony 1 and Doctrine.
sometimes i get error like:
Doctrine don't have the permission to write on
../../../model/doctrine/base/BaseClassName.class.php
But i didn't change any permission. So why and when Doctrine regenerate those files?
Base classes are generated when invoking
./symfony doctrine:build-model
or
./symfony doctrine:build
from command line. There's no code to generate these classes for you when it's not generated yet. You will get fatal error in that case.

Laravel Generate not working

I am running Sublime Test 2 in Windows 7 64-bit. I have installed (and re-installed many times) Laravel Generator and Laravel 4 Artisan. I have updated composer and all dependencies. But I cannot get it to work properly. If I press ctrl-shift-P and type 'laravel' I get a list of 11 Artisan options, then a list of 17 Generate options, 6 of which appear to be duplications, and then another list of 20 Artisan options. The first lot of Artisan options give WindowsError: [Error 2] The system cannot find the file specified, the Generate options give [InvalidArgumentException] There are no commands defined in the "generate" namespace.
The second batch of Artisan options do appear to work eg Laravel Artisan: Controller: Make gives a command line and if I type 'test' it creates a restful controller called test.php.
However, the more comprehensive resource generation remains unavailable to me.
Can anyone shed any light?
If you are using the way/generators package, you need to make sure to include the service provider ('Way\Generators\GeneratorsServiceProvider') in your config.app file.
First make sure you install this plugin first: https://github.com/laravelbook/laravel4-sublimetext-helper
And then you might want to do what is referred here:
http://net.tutsplus.com/tutorials/tools-and-tips/pro-workflow-in-laravel-and-sublime-text/#comment-925470112
There are other Windows users that had difficulties with this, but seem to have resolved them.

Scaffolding error with CodeIgniter_2.1.2

I am using codeigniter 2.1.2 and I want to use scaffolding feature to add information to table. When I set this $route['scaffolding_trigger'] = 'scaffolding'; in routes.php and call it in controller $this->load->scaffolding('applicants'); I get the following Error:
Fatal error: Call to undefined method CI_Loader::scaffolding() in C:\xampp\htdocs\hmplatform\application\controllers\Applicant.php on line 6 So I am asking if I can find a library that contains scaffolding features because in this version I downloaded from GIT there is no scaffolding folder.
Scaffolding was depreciated in codeigniter. It isn't longer offered. The tutorials are outdated, so I'm guessing this is where you saw it?

codeigniter modular extensions

I'm trying to implement modular extensions into a codeigniter 2 setup but am having a few problems. I followed the installation instructions on the wiki and everything was working fine. Then I started to play around a bit and try and use it. All I did was create a new module called users with the required folders and added a model class called users_m. I then tried to load this from my welcome module controller. According to the wiki this should be very straightforward. I simply added this line
$this->load->model('users/users_m');
to the constructor of my welcome controller.
Unfortunately at this point I get the white screen of death.
So I tried something else. This time I removed the load model line and added
$this->output->enable_profiler(TRUE);
This time I got the welcome page displayed and I got the profiler, but at the top of the page I got this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$profiler
Filename: MX/Loader.php
Line Number: 145
I don't know if these two tries are related or not, but there's obviously something not right with my setup. Could someone point me in the right direction?
If you accessing the model from the controller in the same module, you can load it using just:
$this->load->model(‘user_m’);
You only have to do $this->load->model(‘module/model_name’); when your cross loading between modules.
Just to make sure, your model is located here right?
application/modules/users/models/users_m.php
As for the profiler error:
1) Have you done installation step 5 and put the Modular Extensions core files into application/core?
2) Do you have the latest version of HMVC? There have been updates to mx/loader.php in the last couple days.
Ps. great tutorial on HMVC: http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/
if you have folder structure like:
application/
modules/
users/
models/
users_m.php
then use this to call modelsin you controller
$this->load->model('users/users_m','',TRUE);

Resources