I've hit a snag with Doxygen (v1.8.16) and am hoping someone can help. The function I'm documenting returns an enum that's described elsewhere, so I want to link to it in the generated documentation. All is fine and dandy on that front.
<myheader.h>
/* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ MyCoolFunction() ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ */
/**
* #brief This function does lots of cool stuff. You should check it out.
*
* Here's another line of text describing what a great function this is.
*
* #since 2.1.1
*
* #return
* The #link THE_RESULT #endlink enumeration.
* <TABLE>
* <TR><TH>Result</TH><TH>Description</TH></TR>
* <TR><TD>#link SUCCESS #endlink</TD><TD>The method ran perfectly.</TD></TR>
* <TR><TD>#link ERROR1 #endlink</TD><TD>The method didn't run so well.</TD></TR>
* <TR><TD>#link ERROR2 #endlink</TD><TD>The method utterly failed.</TD></TR>
* </TABLE>
*
* #see MyOtherFunction
* #ingroup These_Methods
*/
THE_METHOD THE_RESULT MyCoolFunction();
And here's an example of calling my function:
<mylittleapp.cpp>
/**
* #file mylittleapp.cpp
* #brief Here's an example of how to use MyCoolFunction.
*/
void Example()
{
if (MyCoolFunction() == SUCCESS)
{
// Now we get to do more cool stuff
}
else
{
// Uh oh!
}
}
The problem is for the SDK user when they want the context documentation popping up about how to use the function in their code. When I mouse-over MyCoolFunction in mylittleapp.cpp, this is what I see when the #link is in the #return.
Removing the #link...#endlink in the #return line fixes that problem, but then there's no link to my THE_RESULT enum in the generated documentation. How can I get the full return statement to show up in the context pop-up and also include a link in the generated doc?
Looks like #link ... #endlink isn't correct for internal links. Changing them to #refs fixes both problems.
Related
Here is my VerifyUserbyEmail custom middle-ware
Can any one please help to sort it out ?
while I have used namespace properly but still getting error
<?php
namespace App\Http\Middleware;
use App\Http\Middleware\Auth;
use Closure;
class VerifyUserbyEmail
{
/**
* Handle an incoming request.
*
* #param \Illuminate\Http\Request $request
* #param \Closure $next
* #return mixed
*/
public function handle($request, Closure $next)
{
$user = \App\User::findOrFail(Auth::id());
if ($user->status == 0){
Auth::logout();
return redirect('login')->with('messege', 'you need to verify your account, check your email');
}
return $next($request);
}
}
Try changing
use App\Http\Middleware\Auth;
with
use Illuminate\Support\Facades\Auth;
I created (my first) extension with one viewhelper.
Oops, an error occurred!
Could not analyse class:My\Mlv\ViewHelpers\Format\ReplacenewlinesViewHelper maybe not loaded or no autoloader?
In use (with news):
{namespace m=My\Mlv\ViewHelpers}
{newsItem.bodytext -> m:format.replacenewlines()}
Directory tree of extension:
typo3conf/ext/mlv
ext_emconf.php (copied from another ext)
/Classes
/ViewHelpers
/Format
ReplaceNewLinesViewHelper.php
ReplaceNewLinesViewHelper.php:
<?php
namespace My\Mlv\ViewHelpers\Format;
/**
* Replaces newlines in plain text with <br> tags.
*
* #author johndoe33
* #package Mlv
* #subpackage ViewHelpers\Format
*/
class ReplaceNewLinesViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* Replaces newlines in plain text with <br> tags.
*
* #param string $content
* #return string
*/
public function render($content = NULL) {
if (NULL === $content) {
$content = $this->renderChildren();
}
$content = str_replace( "\n", '<br>', $content );
return $content;
}
}
You need to use camel case in the view helper invocation:
{newsItem.bodytext -> m:format.replaceNewLines()}
Furthermore you may need to define an autoload definition in your ext_emconf.php if you're using TYPO3 >=7.6 (reinstall the extension after doing so):
'autoload' => array(
'psr-4' => array('My\\Mlv\\' => 'Classes')
)
For more information see: http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in
The function :
function show($string = "hi") {
echo $string;
}
I need the comments like:
/**
* #brief
*
* #param $string
*
* #returns
*/
function show($string = "hi") {
echo $string;
}
Can I generate comments like this by yasnippet?
In vim, doxygentoolkit can do it.
Whitch tool i can use in emacs?
Use Doxymacs. It hasn't been updated in a while, but still works for me.
I'm trying to get Netbeans to provide some code completion on objects. Here is the basic code without JSdoc:
; var docTest = ( function( $, MyGlobal ){
console.log( MyGlobal.foo );
} )( jQuery, SOME_GLOBAL_OBJECT );
SOME_GLOBAL_OBJECT is defined elsewhere and is basically a configuration object that looks something like this:
var SOME_GLOBAL_OBJECT = { foo: "bar", baz: "blech" };
I'm hoping it's possible to coerce Netbeans to auto-suggest "foo" and "baz" when I type MyGlobal.
I've tried a few things, such as:
/**
* #typedef Global - My global options
* #type {object}
* #property {string} foo - Some foo
* #property {string} baz - Blech!
/*
Followed by
/**
* #param {jQuery} $
* #param {Global} MyGlobal
*/
function ( $, MyGlobal ){ // ....
And I've also tried
/**
* #param {jQuery} $
* #param {{ foo: string, baz: string }} MyGlobal
*/
function ( $, MyGlobal ){ //....
And even
/** #type {{ foo: string, baz: string }} MyGlobal */
But no joy. Is this sort of thing supported in Netbeans 7.4? What's the correct way to document my object so that Netbeans knows about its properties?
I am trying to read the username of a front end user whose uid is known. I tried this in my controller's showAction method:
$objectManger = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
// get repository
$repository = $objectManger->get('Tx_Extbase_Domain_Repository_FrontendUserRepository ');
$newObject = $repository->findByUid($coupon->getCreator()); //this is the uid of whoever was loggin in
print_r($newObject);
echo $newObject->getUsername(); die;
but when that code runs I get:
Oops, an error occured!
"Tx_Extbase_Domain_Repository_FrontendUserRepository " is not a valid cache entry identifier.
It turns out that $repository is empty, so how do I get fe_user data?
I am using typo3 v4.5 with extbase.
Thanks
Update to show complete answer.
This is the code (it goes in my CouponController) that worked (plus the typoscript mentioned):
/**
* #var Tx_Extbase_Domain_Repository_FrontendUserRepository
*/
protected $userRepository;
/**
* Inject the user repository
* #param Tx_Extbase_Domain_Repository_FrontendUserRepository $userRepository
* #return void */
public function injectFrontendUserRepository(Tx_Extbase_Domain_Repository_FrontendUserRepository $userRepository) {
$this->userRepository = $userRepository;
}
public function showAction(Tx_Coupons_Domain_Model_Coupon $coupon) {
$userRepository = $this->objectManager->get("Tx_Extbase_Domain_Repository_FrontendUserRepository");
$newObject = $userRepository->findByUid($coupon->getCreator());
$this->view->assign('coupon', $coupon);
$this->view->assign('creatorname', $newObject->getUsername() );
}
If you are using extbase yourself you dont have to call makeInstance for your objectManager, it's already there ($this->objectManager).
anyway, you should inject this repository (see my answer here: TYPO3 - Call another repository)
Clear the Cache after the Injection.
You maybe have to disable the recordtype extbase sets for its FrontendUser:
config.tx_extbase.persistence.classes.Tx_Extbase_Domain_Model_FrontendUser.mapping.recordType >
Set the source storage pid where the repository fetches the data from:
/** #var Tx_Extbase_Domain_Repository_FrontendUserRepository $repos */
$repos = $this->objectManager->get("Tx_Extbase_Domain_Repository_FrontendUserRepository");
$querySettings = $repos->createQuery()->getQuerySettings();
$querySettings->setStoragePageIds(array(123, 567));
$repos->setDefaultQuerySettings($querySettings);
$user = $repos->findByUid(56); // Queries for user 56 in storages 123 and 567