I want to automatically append my user tag to the class documentation when I edit an existing class from the following:
/**
*
*
* #author inoue.orihime
*
*/
#Entity
#Table
public class ..
To this:
/**
*
* #author inoue.orihime
* #author ichigo.kurosaki
*
*/
#Entity
#Table
public class ..
Is this possible on eclipse or using some 3rd library ?
The Javadoc for a class is defined as a Code Template in Window > Preferences > Java > Code Style > Code Templates. In this preference page, select Comments => Types, then you will see the default Javadoc for new classes/interfaces/enums/annotations. Click on the Edit button to change its content.
Related
The code below was generated by netbeans. When I right click it there is an error that it does not have a main method. What should I do? It is on xubuntu using netbeans IDE 10 JDK 11 . I created the app using netbeans.org/kb/docs/java/quickstart.html. I right click HelloWorldApp.java and choose run. then I get the error .Error screenshot
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package helloworldapp;
/**
*
* #author peter
*/
public class HelloWorldApp {
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
I am writing an export feature using phpexcel library. I have included the library into typo3conf/ext/extension_name/Classes/Library/PHPExcel. And also included the file typo3conf/ext/extension_name/Classes/Library/PHPExcel.php. And injected this file into my typo3 extbase controller as
/**
* PHPExcel
*
* #var \VendorName\ExtensionName\Classes\PHPExcel
* #inject
*/
protected $PHPExcel;
And called this into my export function as
public function exportxlsAction() {
$objPHPExcel = new \PHPExcel();
}
On clicking the backend module it throws the error as
Could not analyse class: "VendorName\ExtensionName\Classes\PHPExcel" maybe not loaded or no autoloader? Class VendorName\ExtensionName\Classes\PHPExcel does not exist..
Why is it so?
Problems in your namespace. Just change it like below.
\VendorName\ExtensionName\Classes\PHPExcel to \VendorName\ExtensionName\Library
Also if you have added all PHPExcel library on this path \VendorName\ExtensionName\Classes\Library\PHPExcel then your name space like below.
\VendorName\ExtensionName\Library\PHPExcel
Another Way.
In your ext_emconf.php File. add below code.
'autoload' => [
'classmap' => [
'Classes',
'Classes/Library/PHPExcel/PHPExcel.php',
]
]
Your controller file code like below.
/**
* PHPExcel
*
* #var \PHPExcel
* #inject
*/
protected $PHPExcel = null;
And you function as it is. like below.
public function exportxlsAction() {
$objPHPExcel = $this->PHPExcel;
}
After replace this changes you need to once install/Uninstall Extension.
I have TYPO3 version 7.6.18. Tell me please how make auto deleting all reference files when I repository->remove($object) ?
You can add #cascade remove to your domain model property's docblock to have it removed on removal of the entity.
Here's a snippet of the blog_example extension used in Extbase's functional tests:
/**
* The posts of this blog
*
* #var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Post>
* #lazy
* #cascade remove
*/
protected $posts = null;
I try to extend the tx_news extension with the field imageright.
For that I found this tutorial: https://docs.typo3.org/typo3cms/extensions/news/2.2.1/Main/Tutorial/ExtendingNews/Index.html
The first step is to use extension_builder to add the field. As I already have a extension in where I want to implement the extension I do not want to use the extension_builder (also I tried it with a new extension and extend the news-model did not work - I have no clue how to do it right). However this are the steps I did:
In my extension my_template I added the folders and file: Classes/Domain/Model/News.php:
class MyTemplate_Domain_Model_News extends Tx_News_Domain_Model_News {
/**
* #var bool
*/
protected $imageright;
/**
* Returns the imageright
*
* #return bool $imageright
*/
public function getImageright() {
return $this->imageright;
}
/**
* Sets the sort
*
* #param bool $imageright
* #return void
*/
public function setImageright($imageright)
{
$this->imageright = $imageright;
}
}
?>
/Ressources/Private/extend-news.txt:
Domain/Model/News
Created the field imageright as tinyint in the table tx_news_domain_model_news (and added it to the SQL file)
I knew I have to create a TCA file in /Configuration/TCA/, but I have no clue how this should look like or what name it needs to have. I think this is the last step I need to make this working.
Also note the extension my_template was just a template, so before my changes there where no Classes and no TCA files.
Solution is to use this tutorial: http://www.lukasjakob.com/extend-a-typo3-extbase-model-with-custom-field/
I have 2 bundles, 1 CMS bundle that will be the parent bundle.
I have in both bundles duplicated entitys. Like User The user in the CMS bundle i made it a abstract class. (not sure if that is the right choice. Actually, what I want is extending my user entity IF needed.).
cms user:
abstract class User implements UserInterface
bundle user:
use MV\CMSBundle\Entity\User as BaseUser;
/**
* #ORM\Entity(repositoryClass="MV\NameBundle\Repository\UserRepository")
* #DoctrineAssert\UniqueEntity(fields={"email"}, message="user.email.already.exist" )
*/
class User extends BaseUser
{
....
}
Im getting the error Class "MV\CMSBundle\Entity\User" is not a valid entity or mapped super class.
I have searched in the documentation of symfony and found this page: entities-entity-mapping but they didn't add some content xD
Oh, and no I dont want to use FOSUserBundle ;)
Symfony: 2.1
In my case I was missing * #ORM\Entity in my class definition.
/**
* #ORM\Entity
* #ORM\Table(name="listtype")
*/
class ListType
{
...
}
Define the base-class as follows:
/**
* #ORM\MappedSuperclass
*/
abstract class BaseUser
{
// ...
}
Define the real entity:
/**
* #ORM\Entity
*/
class User extends BaseUser
{
// ...
}
Because you're missing the #MappedSuperclass annotation on the base-class, Doctrine throws the exception you mention.
In my case, the problem was eaccelerator because it strips out all the comments which Doctrine uses. After disabling eaccelerator it worked . You can disable your php settings or,
in the web/app_dev.php or web/app.php file.
<?php
ini_set('eaccelerator.enable', 0);
ini_set('eaccelerator.optimizer', 0);
//rest of the code.
Note: Do clear the symfony2 cache after disabling this.
I had the same problem. But to make it work but, I had to shift the lines:
* #ORM\Table
* #ORM\Entity